Rotation Angle of Placed Family

Hello,

I will appreciate any help or direction or my issue described below.

So basically I was able to obtain the start/send point of pipe segments. Then I am inserting a family by first point and the rotation of the pipe segments.
As you can see in the screen capture, it works well on the two bottom pipe layouts. But the strange think is that, on the upper two layouts, some of the placed families have the wrong rotation angle.

Thanks for your help.

1 2

Hi there,

Well you have pipes, you have a start point and and end point o each pipe, even you have two connector of each pipe, so you could set a vector with two points, then get vector angle and finally rotate your family to this angle.

I’m just guessing, so it is only an idea. I’m would try this.

I hope that help you.

Cheers

Manel

Hi Manel,

Thanks for your reply. I thought I was actually doing what you are saying by getting the angle between start/end point vector line! But it seems it is unable to tell the difference between a negative or positive angle (+90 or - 90).

Start from Left to right/down = working

Start from Right to left/down = working

Start from Left to right/up = Not working

Start from Right to left/up = Not working

3

That is correct. Looks like if your vector is in the positive Y you’ll need to adjust your angles by multiplying the angle by -1. Should be able to do so via an if statement in designscript fairly easily. Try building this and testing it out.

//If PipeVector's Y component is greater than 0, multiply the angle by -1, otherwise return the angle. 
PipeVector.Y > 0 ? PipeAngle * -1 : PipeAngle ;
2 Likes

Thank you JacobSmall for your help. It worked well to adjust the angle rotation toward the correct facing.

1 Like

Glad I could help. Please mark a solution so others can learn from reading this thread.

1 Like

I also have problem with rotation and came across this post looking for a solution.
Basicly i don’t get the rotation i expect(ed).

EDIT
I use the Python from this post.

EDIT2
Solved! I totally missed.