# Rotate family after insert along curve to the tangent

I am trying to insert a family along a curve, and then rotate it to point to the center or be on the normal at each point. I have tried to follow this post Place family along curve but it has not worked as intended. I am sure it is something minor that I am not doing, and I am only using the Fans because it is easy to tell if they are aligned to the curve or not. I have attached the file I am using for your use.

Place Families_With Rotation.dyn (26.6 KB)

Hi, youâ€™ll probably find what you need here: Align objects with a 3d curve

1. Measure the angle manually thatâ€™s required to align the first family to the horizontal line
2. Generate a list of angles which increment by the angle of each segment (I.e. 180/count of segments).
3. Plus 1 to 2
4. Use the resultant list of angles to rotate the list of Families

@Thomas_Mahon, thanks for the suggestion, but one I want to be able to handle more complex curves than just a semicircle, and two I would prefer not to do anything â€śmanuallyâ€ť.

Agree, but youâ€™ll quickly discover that trying to fully automate this will be fraught with problems and ultimately fail to achieve its main objective.

For example:
You could extract the curves from each Family then find the curve at the tip of the fin closest to the grid line, then work out the angle of rotationâ€¦and deal with the fact its curvedâ€¦but not before getting the centre point of the Family (this wont always be possible depending on the geometry in the Family)! The only way I know to get curves from say, a Detail Family, is via the API and thatâ€™s before youâ€™ve even started to solve the problem. Also, you would need to create a set of rules to handle the + or - rotation that will result from the family position relative to its fin closest to the grid line.

It gets worse: even if you did get it working, this approach would only work with this family and no other since you are looking for a curve specific to the makeup of this Family. The amount of time youâ€™ll spend doing this will be grossly disproportional to the length of time that single manual intervention at the start would provide, which is why its the most sensible approach with this kind of problem. In addition a hybrid approach would ensure the solution would work on any Family type as you wont need to concern yourself with finding a specific piece of geometry to get the whole thing functional. Maintenance also becomes a lot more easier and manageable. If you work in a team, this is a key consideration. A single-use solution with any script is never worth it.

What I would say is that with any process, particularly where computation is concerned, its critical to establish what should be automated and what shouldnâ€™t.

To all useful ends, Iâ€™ve written something quite simple that works with regular curves:

I created little circle faces along tangents to place instances on thanks to Springs node. For the moment, I canâ€™t divide a spline equally, but thereâ€™s probably an answer to that somewhere (?)â€¦

Thanks to @Dimitar_Venkov on this thread Align objects with a 3d curve I was able to resolve the issue. I modified some of the code blocks he used with core nodes now available, but it has resolved the problem for me currently. More complex curves may still need work, but thanks for all of the help.

2 Likes

Hi everybody.
I tried to do the same thing described above, placing a desk family along a spline, but i noticed 2 weird results:
i) the PointAtParameter node doesâ€™nt place points at an equal distance.

so i solved the issue as in the image below.

ii) when i run my script, family instances are correctly distributed, rotated by correct angles, but it seems that their base point is displaced compared to points on curve (1).
The weird thing is that if i move manually (from Revit) any one of the istances (2), and run the script again, everytingh seems to move back to the correct position (3).

As you can see, trying to force dyanmo to firstly place instances, then rotating them, i used transact nodes, but the result is the same.

(1)

(2)

(3)

Anyone have any suggestion about, or can tell me what i donâ€™t understand or where i go wrong?

Thank you!

Hi, try to create instance along the curve to the tangent. By topology.face nodes seem has problems

Appreciate if someone can help ?

@lee129us You could use Element.Faces instead.
Also, ImportInstance.ByGeometry would be better.

Hi ,

thanks for your advise. I able to eliminate the error, but the last node output always " Null" . Can you assist to advise me if you also facing this issue

The result data structure is not same with surface. You could check your list structure. And I prefer to use Dynamo node instead of custom packages. You could find same function node in familyinstance.