Measure angle between X axis to get angle deviation problems

Hello everyone
I have a problem to measure angle between x axis like in image below :

I want to know the value between X axis from my reference point and X axis in global, so the X axis each point will placed in route?

My problem also in my adaptive profile(2 points) when i put using dynamo, there is no rotation value but the shape is oblique, how to change them in normal condition shape/perpendicular in each point like the red line?

Can anyone help me to solve this problem or show me the mistake on my script/profile?
I’m so appreciate for your answer, thank you

Vector.AngleAboutAxis should do the trick. You’ll need to pull the tangent vector of the curve and the X axis of the coordinate system though.

2 Likes

Have an example or reference Sir ? I have tried that but still wrong

I had something like this. I hope it gives an idea:

1 Like

Thanks in advance, i will try that later

Not handy and I won’t be at my CPU to build a sample until Wednesday, but if you put something together I can give some guidance.

1 Like

Okay, i will share my script later, thanks in advance

1 Like

Still curious which one is my mistake, if I use the result of Vector.AngleAboutAxis, the profile still in wrong condition/direction
My goal is to make the profile in right direction using deviation angle between X axis of each reference/adaptive point at my profile and X axis that lay/tangent on the route

The angle seems correct, it’s just always going to be the ‘clockwise’ direction from your vector to the other vector. So if we rotate your vector by N degrees clockwise about the Z axis you will wind up tangent at that angle. Same result happens by rotating counter clockwise about the Z axis by the 360-N value.

One thing you can try: populate the adaptive components using points derived from the coordinate system. That is if you want points at ([-x,x],0,0) relative to the coordinate system, try using Curve.CoordinateSystemAtParameter to generate the list of coordinate systems, then a Point.ByCoordinares to generate the points at the origin. From there Geometey.Transform can move the points from the origin to the spots relative to the curve. From there you can populate your adaptive components directly.

Alternatively still you may want to consider letting the adaptive family be hosted on a model curve in Revit’s adaptive environment, which will allow manual edits in the future, and will simplify things quite a bit.

1 Like

Okay, thanks for your knowledge and solutions, may God bless you

2 Likes