Dynamo for Civil 3D: Creating Objects by Region

Dynamo for Civil 3D: Creating Objects by Region

in this dynamo for civil3d example we will place a guardrail along the edge of a highway corridor this highway corridor is divided up into multiple regions and we only want to have guardrail along the areas where we have retaining wall there are a number of bridges along this corridor as well and we don’t need to install any guardrail along those as well because they already have barrier we have a few gaps because of ramp transitions as well and so we’ll take a look at how we’re gonna do this in our dynamo script in the script that we’ve already established we’ll take a look at each of the nodes and how they interact first we’re gonna start with our current document and the corridor we want to use in this case is our eastbound corridor we do also want to take note of the baseline that we have used to generate that corridor and we’ve got that as a code block in our baseline by name as well one other area that we’ll want to pay particular attention to is our feature line and we have created a feature code right there called guardrail right in our corridor we have three different assemblies that were utilizing we have a bridge sub assembly as well as a sub assembly for the ramp transition but where we’re gonna place barriers is on the right side of our wall assembly and we have created a point called guardrail right that we’re gonna utilize to place our barrier posts and we’ve just done that with a mark point we’ve select mark point and we select the specific point that we want to create and this is how we’re able to identify this by region this feature only exists in these regions it doesn’t exist on the ramp transition as we can see here where we just have the eps code so we’ll make note of that particular point that we’ll use in our assembly and use in our script as well and we’ll identify the start and end stations for each one of those feature lines that are created and we’re using a code block here to identify our start and end station for our step command this is where we’ll determine the spacing between each post we use a slider command here we’ll just use an integer slider there with this we have the ability to determine the spacing and we use 20 there so that will our stationing and our coordinate system next we’re ready to start placing our barrier the barrier that we’re going to be using is a post that we’ve identified as a block we want to be able to rotate that 180 degrees so that it’s facing in the correct direction in here we’ve identified the name of the block that we’re gonna use for our posts as well as where that’s going to be placed that’s going to be placed along our feature line that’s our origin and our rotation is going to be about our Z access and so we’re using that as our coordinate for our normal since it’s being placed in plain view now for the rotation we need to use a series of vectors for the x and y values and we’re going to use a little bit of trigonometry here we’re going to use a function that’s taking the arctangent of the opposite and the adjacent angles or the X and the Y’s and it’s going to add 180 degrees to that angle and this is going to orient our objects that we place in the correct manner along those feature lines our lair is going to be set as whatever we want to create it as and we’re placing these in model space once we’re ready for that we’re ready to run the initial command just to look and see how our posts have been placed and as we look in and view each one of these we can see that they’re in the correct position and in the correct rotation as well the next step that we want to do is to create the face of our guardrail we have our insertion point as well as our existing ground and our posts are three feet above that existing point so this is going to help us with the coordinates we’re creating this W shape for the face of our barrier and it’s going to be point two feet out we’re going to create a point at each one of these inflection points on the W beam and we’re gonna extrude that so that it is parallel to our profile we’ll do this using a code block for this particular command we’re gonna use points by coordinates and we’re gonna set up a point by coordinate for each of those points and we’ll set up five points we’ll provide a coordinate relative to that insertion point so our first point we’re gonna specify X as a variable we’re gonna go zero direct zero feet in the Y direction and three feet up in the Z direction the next point will come down and we’ll go out just a bit and we’ll repeat this process until we’ve created our five points to create that W beam shape we’ll copy that for the next code and we’ll modify that to two and a half next point will be our D value and that coming out points your feet and back down at two point two five and our last point will call at two feet down we’ll call that our a point now this would be the shape of a barrier on the left so we’ll call this W beam L for left and this is gonna be a Polly curve this is gonna follow the feature line and the profile exactly and we’ll use that five points and we use points a B C and D and you but this would be for the left side if we’re gonna create one for the right side will create our W right and we’ll just mirror our left side shape we’ll mirror that about the Y Z plane and in the condition where we would want to create both faces we’ll create that as W both and we’ll utilize both the left and the right shapes that we have just created now this provides a number of outputs that we can use our x-value is just going to be the width of our block or our post in this case that’s about 0.9 feet and we’ll provide that as our x-value now once we have that we’re just going to use the right side as our output and we want to utilize a geometry transform node at this point in order to provide the correct orientation and location for this bear our coordinate system will again come from the same coordinate system that we’re using to extract our feature line and so we’ll connect those points here as well the next step that we want to take is to create a surface from those points that we just created and we’ll do that by selecting surface by loft and again that is going to create that surface parallel to our profile and to our feature line now the next step we want to create a solid out of that and so we want to actually create a thickness to that surface so we’ll connect that there we can provide a code block to give the value of the thickness or the gauge size and that’s a good example right there we have a syntax error because I haven’t provided a zero before that the code blocks will generally warn us and so here I want a 0.01 and that’s gonna be the thickness of that gauge face so Dynamo will tell us oftentimes when we have warnings or issues like that the next step is to create the actual object itself and we’ll do that by geometry here so the bottom bottom node here our geometry comes from our solid our layer we can specify as whatever we care to and in this case we’ll call this guardrail face and that’s just as a code block and we’ll connect that again our block comes from our model space block that we had with placing the posts as well so we’re ready to run the command and view the output of our script once again we can see that this is an effective way that we can create solids and objects along a corridor we can break those up by future line and by region


  1. Post

Leave a Reply

Your email address will not be published. Required fields are marked *