Vector orientation issues

Hello,

I’m working on an script to rotate elements regarding the wall orientation they are intersecting, but I’m stuck at getting the correct rotation and couldn’t find anything similar on forum. I’m working with the space boundaries for getting the line direction and their corresponding rotation. Here is where the problem comes. Those vectors follow the direction of an start/end point line, so it won’t always match the internal coordinates axis:

So, these are the results I get (elements are currently oriented to those faces):

Is there any way to set those vectors work regarding internal coordinates and get model rotation instead of individual line rotation? Or getting the rotations I’m looking for in any other way?

I hope I explained myself, any help is welcome.
Thank you in advance

@JoseLP i have a feeling this might be helpful.
Placing Family to Columns Corner - Revit - Dynamo

Correct. Elements have directionality. In fact, if they did “match” the global coordinate system you wouldn’t know which way to rotate your element - your left and right walls would have the same vector but would require different rotations. With the vectors always forming a counter-clockwise loop, you know that the interior of the bounds is always to the left of the vector.

An alternative way to go about this is to get the normal vector of the room bounding surface. This will always point to the exterior of the room (I think, for spatial types it may actually be the interior) which gives you the directionality of your rotated element.

1 Like

@BimAmbit , thank you for your reply. I was trying to follow that route but I didn’t get exactly what I was looking for. Maybe I didn’t understand well

@Nick_Boyts, big thanks, that was exactly the way I needed to focus on and now it’s working.

Thank you both!

1 Like