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.
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.
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).
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 ;