VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 2
Anonymous
167 Views, 1 Reply

OCS to WCS

How can i find the rotation of an entity from the WCS, if it's Rotation property is based on the OCS? I don't have any points that can be used for calculations, just an entity in a selection set.
1 REPLY 1
Message 2 of 2
Jbrauer
in reply to: Anonymous

I have worked with blocks placed in 3D space.

The simple one is the rotation in xy plan,- when rotatet around the y-axis. You can calculate it from the .normal like this.

Private Function xyRotation(objAcad As AcadObject) As Double
Dim ZeroP(0 To 2) As Double

ZeroP(0) = 0#
ZeroP(1) = 0#
ZeroP(2) = 0#

xyRotation = ThisDrawing.Utility.AngleFromXAxis(ZeroP, objAcad.Normal)

End Function

With the rotation around the y-axisI have some difficulty. Right now I calculate it via good old Phytagoras, the normal forms an triangle equal to the one that is formed by the WCS plan and the xdirection, but this only works if the object is not rotated around the x axis, I think that you can read the rotation in space from the .rotation property but I have to figure out how.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost