Rotating blocks along the path (Dynamo for C3D)

Helllo Everyone,
I am new to the Dynamo so I have one question if you could help me. I wanted to rotate already made blocks(as seen in the picture) along a path but I dont exactly know how to do it. I pressume it can be done through this rotationDegrees in BlockReference node but I am not sure how. I couldnt find exact topic about this so if there is one please guide me to it.Thanks in advance.

1 Like

Hi,
I might be wrong, but as far as I know the rotation angle default 0 is on the WCS X axis.
acad_dUoUZW5wbB
I assume you need the block references perpendicular to the lines.
You can use the insertion points and the lines with the Geometry.ClosestPointTo node, so you can create points on the line and then a vector between the to points. When you have the vector you can get the degrees between X axis and and the vector (Vector.AngleWithVector).
And if everything goes well that is your rotational angle. You may have to add ± 90 or 180 degrees depending the quadrant and the block’s default orientation.
If the blocks are on the lines get the vector between the consecutive vertices, rotate -+90 degrees and there you have it.
There are more complicated, but foolproof ways, but I think this is the easiest.

PS. If the lines can go as alignments, you can get the coord system at station and (I guess) X axis is the perpendicular one to the alignment.

Hi,
we dont understand what are we doing wrong. Is there maybe problem with path because z coordinate is in 0?

ubacivanje KT iz excela (1).dyn (256.5 KB)


Yes use the 2D of the points for the vector creation(create new ones from the XY).
And also, you need the pline geometry as input not the pline. Insert an Object.Geometry node.
The yellow warning are helpful is input types are not matched.

Some blocks are rotated and aligned but others are not.You can check it on the picture.Can you tell me what is the problem now?

Well it is hard to tell from the picture, from what I can see:

  • the line seems to be shorter than the extent of the points, that can cause some problems in matching.
  • I would separate the two sides, that can cause some mix ups.
  • because of the two above it is advised to check list levels, maybe there is some mismatching between the object.

Thank you Kovacsv for your help but i extend these lines and separate two sides but also Dynamo draw it incorrect. Most objects are perpendicular but some of them arent. Can you please explain it in more detail because i cant get it completely right? Will it be easier for you if i send you all files?

Yes it would be much easier, but I’m not sure I can take a look at it until next week.
Please try to filter out the problem with trial and error. Try it with one or a few items first, to fully understand how it works and check the input output list levels so the points, vectors, blockreferences are matched properly.

We tried to understand it but we cant figure why dynamo show some elements perpendicular to path and then some not.For example it draws 10 blocks perpendicular to path and then next 2 are not.Thats way we wanted to ask you to take a look at our files.

Please take a look when you have a time. Thank you.

ubacivanje KT iz excela.dyn (166.5 KB)
Drawing11.dwg (1.8 MB)
excel-xyz coordinates.xlsx (15.2 KB)

Hi,did you maybe found a solution for this problem beacuse we cant figure it out?

Hi,
Yes. First, it seems the Object.Geometry node cannot handle acad arcs, so the arc in the polyline are imported as lines, resulting in wrong vector directions.
Second, as I previously mentioned the excel coordinates should be split for the two sides, as the script cannot filter sides out and decide the right angle on its own.
I created two options (notes are in the script). The pline needs to be converted to alignment and it works as it should, I also filtered the two sides for you.
ubacivanje KT iz excela (2).dyn (289.3 KB)
Drawing11.dwg (1.8 MB)

1 Like

Thank you bro very much.You are saviour :clap:

1 Like