How do I get proper rotation?

Hi guys/gals!

EDIT:
GO TO FOURTH REPLY; IGNORE EVERYTHING ELSE.
FIRST POST WAS TOO CONFUSING/INCORRECT.

it isn’t clear (to me at least) what you want to achieve
But I think the answer is that you need the geometry of the family to rely upon the adaptive reference points.
It would help if you included the Dynamo graph & family

Hi Andrew, thank you for a reply.

Here is my family and graph

I have everything figured out except for rotation angle (I know how to rotate it). I just want to place my adaptive family so that smooth/flat part of the unistrut is on the triangle plane. Afterwards, I want the opposite side or the lip portion to face perpendicular to the plane. Something like this

.

But when I place my family the orientation is not correct. It comes out looking like this.

I still can’t figure this out guys. Any help will be appreciated. I added my files so you guys can tinker with it. You can ignore everything else above as that is quite confusing now that I think about it. Anyways, I just need help with getting the proper rotation.

Here is an overview of what I want to do:
I want my outcome to be this (notice unistrut facing direction)

But I keep getting this (unistrut direction is off)

I am using adaptive points so I am not sure if that is the issue or what. If I can get the normal of the adaptive family then I can find the proper angle and rotate them but so far I can only get the normal of the curve and plane, not adaptive family.

I also tried messing around with these settings but they didn’t do much for me.
Revit_dv0SmIncLp

Here are the files.
Polygons.rvt (3.6 MB)
Unistrut Adaptive.rfa (360 KB)
Triangle.dyn (173.2 KB)

So I manged to get the proper rotation by using these nodes. The way I got the angle was to get the normal vector of the triangle and get the vector of the facing orientation of the family then using node AngleWithVector to calculate the angle between the two vectors.

Here are some more pictures to help someone understand my situation a little more.
I created axis to help with visualization. This pictures shows what my vector is from the Dynamo node ‘FacingOrientation’.

Here are the vectors that I want it to show.

So as you can see, I always have to add 90 degrees to get the vectors to be the way I want them to be.

However, I am now having a problem. Sometimes the FaceOrientation node puts out an empty list on first run and I have to run it a second time for it to work correctly. Here is an example of what I am talking about.


Is there anyway to avoid having it run twice for it to work properly?

Also another solutions for getting the vectors correctly would be appreciated. The FacingOrientation node is wrong for some reason. Maybe it has to do with my family or something but I am not too familiar with how adaptive components works.

EDIT: I think the problem on why I have to run it twice has to do with the “FamilyInstance.ByFamilyType” Node. On first run the node doesn’t have a family instance so it outputs nothing then second runs it has a family and updates it.

So now I have to figure out the orientation BEFORE the family is placed but I have no idea how to do that. It is based on the points and which way they are facing? Not sure if there is a way to rotate points or something.

I keep making progress towards this but it’s not quite right. Any help would be appreciated or maybe point me to the right direction so I can fix this problem.

If you put a Transaction.End after you’ve placed the family instance you should be able to get parameter values as expected. I’m didn’t have time to look at you’re unistrut family. Personally my approach would be to create a reference plane by the triangle surface and make sure that adaptive family is hosted by that reference plane, that way your instance’s Z up will stay consistent with the ref plane normal.

one more hint: be sure to name your reference plane when creating it, otherwise you’ll have a hard time selecting it in revit