locationpoint.rotation not correct

locationpoint.rotation not correct

Anonymous
Not applicable
1,255 Views
4 Replies
Message 1 of 5

locationpoint.rotation not correct

Anonymous
Not applicable

I am trying to determine the rotation of face based element. I can get the rotation but it doesn't make sense.

 

On the north side of a horizontal wall it reports an angle of 180°.

North Horizontal Wall.PNG

 

 

 

 

 

On the south side of the wall it reports an angle of 90°.

South Horizontal Wall.PNG

 

 

And then on a vertical wall whether it is on the East or West side it reports 120°.

East Vertical Wall.PNGWest Vertical Wall.PNG

 

 

 

 

 

 

 

It all seems very strange. I would think at some point it would equal 0° but it doesn't. I've searched around and can't seem to find any solid answer on how Revit is coming up with the angles.

 

Can anyone give me some explaination? Thank you for your help.

 

 

0 Likes
1,256 Views
4 Replies
Replies (4)
Message 2 of 5

augusto.goncalves
Alumni
Alumni
Check the GetRotationAngleOfInstance() method at this blog post: http://thebuildingcoder.typepad.com/blog/2013/06/correct-detail-component-rotation-in-elevation-view...

Hope it helps
Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes
Message 3 of 5

Anonymous
Not applicable

I have seen that post before and assumed that it didn't necessarily pertain to what I was doing because the objects it shows are 2D and the objects I am trying to get the rotation of are 3D. I decided to give it a whirl and I am now getting closer. So thank you for that. I can at least get an angle anywhere between 0° and 360° but they are not right. I would expect that 0° would be when the symbol was pointing east then the angles would go in a counter clockwise direction. It is not. It is 0° when the symbol is pointing South and the angles go in a clockwise direction, so 90° is when the symbol point west. So it is mirrored and off by 90°. I can deal with the being off by 90° but the mirrored part is a little tricky. It is going to take a little bit of fancy math I think. Can you explain to me why the rotation that is giving by the locationpoint is wrong? It helps me to know why something happens to find a solution. Thanks.

0 Likes
Message 4 of 5

augusto.goncalves
Alumni
Alumni

we're indeed suggesting developers to use GetTransform instead LocationPoint, it's more consistent. 

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes
Message 5 of 5

Anonymous
Not applicable
The mirrored angles are probably related to the inconsistencies of the PlanarFace.Normal property which sometimes reports the opposite of the actual face normal. If the angle is being calculated in the background using the buggy Normal then you would of course get whacky inverse angles. Out of interest, if you compare the vectors returned by both PlanarFace. Normal and Face.ComputeNormal (UV.Zero) for the face that is giving the invrted angles are they the same or opposite?
0 Likes