Rotating objects along a line

I’m having problems with rotating my objects so they all point along this centerline.

Here is the script I’m using to rotate them.

Here’s a picture that shows it well. The way I want this to work is for them to link perfectly together. I can’t just add some degrees to them, since most of the objects gets rotated perfectly.

Thank you for any help fixing this!

I would create your tangent vector in another way.

What about something like this:

  1. Get the point of your familyinstance.
  2. Get the closest point on the centerline curve.
  3. Using ParameterAtPoint and TangentAtParameter determine the tangent of that point.
  4. Use that vector as your rotation value.

Thank you for your suggestion! I’m very new to Dynamo and not sure I understood how to do what you’ve said. I tried this and didn’t seem to work as I had hoped.

Hi @SeGra ,

This workflow should rotate your elements correctly, I don’t know why the rotation is going wrong.
Could you share your source files so I could take a better look?

I have tried tidying the script up a bit. The center set of nodes are the center line, and the series of nodes under are the offset line. CAD.CurvesFromCadLayers are from the BimorphNodes package.
One more thing is that the offset lines needs to be PolyCurve.ByPoints and not PolyCurve.ByJoinedCurves, otherwise they won’t offset to - values.
SenterlinjeGrethesHus.dwg (911.3 KB)
_SpuntSørFerdig.rfa (480 KB)
DynamoBIM_Rotate.dyn (374.8 KB)

Hi @SeGra ,

I’ve looked at your source files and it seems that the vertical curvature of the curve was (one) part of the problem. As a result, the rotation calculation on the vertical curvature part was wrong.

I’ve reworked your script to account for this:

The results now:


Dynamo file:
2022-05-21 Place & Rotate Revit elements along Curve.dyn (354.3 KB)

2 Likes

This helped alot! Thank you for taking your time to help me!

1 Like