ViewUpDirection & ViewRightDirection Vector Query Issue

ViewUpDirection & ViewRightDirection Vector Query Issue

DavidBurchell
Participant Participant
872 Views
4 Replies
Message 1 of 5

ViewUpDirection & ViewRightDirection Vector Query Issue

DavidBurchell
Participant
Participant

I'm trying to use the ActiveView.UpDirection & ActiveView.RightDirection parameters to create a third directional vector pointing NorthEast or Up & Right.

 

Adding the two XYZ vectors programmatically yields the correct XYZ result, but a pipe in my project pointing in this direction reports an altogether different vector direction when queried via LocationCurve.Curve.Line Property.

 

Pipes pointing up and right respectively match the views up & right direction parameters, so it seems odd that this diagonal pipe isn't equal to the addition of the up & right vectors.

 

I attach a few screenshots of the file and the results for anyone who might be able to help solve this mystery.

 

Thanks in advance.

API Query Screenshot 1.PNGAPI Query Screenshot 2.PNGAPI Query Screenshot 3.PNG

 

0 Likes
Accepted solutions (1)
873 Views
4 Replies
Replies (4)
Message 2 of 5

jeremytammik
Autodesk
Autodesk

I would recommend that you not mix up view directions with pipe (model) directions.

 

If you have two vectors that you rely on to point up and right, e.g., vy and vx, then you can be certain that (vy + vx) will point half up and half right.

 

No doubt there.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 5

mhannonQ65N2
Collaborator
Collaborator
Accepted solution

The pipe's line's direction is a normal vector.

 

Try normalizing the result of adding the two vectors together. I think if you do so, the result should be very close to the pipe's line's direction.

0 Likes
Message 4 of 5

jeremytammik
Autodesk
Autodesk

Oh, yes, of course. My statement above assumes two vectors vx and vy of equal length. If they may be of different length, I would suggest normalising the two before addition.

  



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 5 of 5

DavidBurchell
Participant
Participant

Jeremy,

 

Thanks for input the method of comparing pipe line direction to view direction arose out of a need to determine whether a pipe was facing a cardinal direction or close to.

 

There was no doubt a more elegant solution as all I was really looking to do was to 'read' the pipes direction relative to the view 'Up' direction (being North).

 

My limited knowledge of Maths led me to find a workaround which, with the help of the answers provided by the members on here (the original reply to which seems to have gone missing) has thankfully solved my issue!

 

Many thanks to all.

0 Likes