Getting rotation angle of dimrotated object

Getting rotation angle of dimrotated object

aytekinr
Observer Observer
1,570 Views
4 Replies
Message 1 of 5

Getting rotation angle of dimrotated object

aytekinr
Observer
Observer
Dear sirs,
I am creating dimrotated object with given angle successfully. However when i try to get the angle of rotation i am failed. For example `msgbox obje.rotation` gives the message" 0" always even if for vertical or horizontal dimensions..,i get the dimrotated object by selection methods or getentity methods..what i am trying to do is to choose the max vertical and horizontal dimensions in the drawing
Thanks in advance
0 Likes
1,571 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

I couldn't actually find a straight way to get back the RotationAngle specified at the time AddDimRotated() method was used

 

 

So I only can propose the following workaround

 

Function GetDimRotatedAngle(acDimRot As AcadDimRotated) As Double
    Dim dimRotTextHeight As Double
    Dim minext As Variant, maxext As Variant
    With acDimRot ' reference passed rotated dimension object
        dimRotTextHeight = .TextHeight 'store referenced object text height 
        .TextHeight = 0.0001 ' set referenced object text height to a very little value not to influence its boundingbox limits
.GetBoundingBox minext, maxext ' get referenced object boundingbox limits
GetDimRotatedAngle = ThisDrawing.Utility.AngleFromXAxis(minext, maxext) ' return the angle between the line passing through referenced object boundingbox limits and the X axis
.TextHeight = dimRotTextHeight ' set referenced object text height back to its original value
End With
End Function  

 

which you could use as follows:

 

MsgBox GetDimRotatedAngle(obje)

where obje is a valid DimRotated object

0 Likes
Message 3 of 5

aytekinr
Observer
Observer
Dear sir,

I am very delighted that you replied....

However,when i pick an vertical dimension it gives 0.9735.. which must be
1.57079 radian and for horizontal dimensions it results in 0.21384 which
must be 0 radian actually. For my surprise program gives the right angle
for 45 degree rotated dimensions....
Thanks in advance
0 Likes
Message 4 of 5

Anonymous
Not applicable

sorry but I didn't test my code as thoroughly as I should have done

I now realize that it only works with a limited range of rotation angles because the rotated dimension boundingbox is affected by the actual size of the dimension extension lines as well as the position of the points it shows the in between dimension of

 

so I'm afraid that I cannot help you further retrieving the rotation angle of a rotated dimension

 

0 Likes
Message 5 of 5

aytekinr
Observer
Observer
i appreciate that you tried to help me sir. i'd like to give my special
thanks to you...

Aytekin
0 Likes