Radians
On Error Resume Next
Set acadApp = GetObject(,"AutoCAD.Application")
Set wallObj = acadApp.ActiveDocument.ObjectIDToObject( [ObjectID] )
RESULT = CDbl( wallObj.Rotation )
Degrees
On Error Resume Next
Set acadApp = GetObject(,"AutoCAD.Application")
Set wallObj = acadApp.ActiveDocument.ObjectIDToObject( [ObjectID] )
pi = 4 * Atn( 1.0 )
RESULT = CDbl( (wallObj.Rotation * 180.0) / pi)
In both cases, the formulas above assume that, in the same Property Set Definition, an automatic property called ObjectID has been added, referencing the ObjectID automatic property source. The reference to this property in the formula needs to be made by double clicking on that property in the lower left pane of the Formula Property Definition dialog, when creating the Formula property.
Please note that I have had issues with Formula properties that use the Set acadApp = GetObject(,"AutoCAD.Application") line to get the AutoCAD application object, when multiple versions of AutoCAD are open at the same time. Something to keep in mind, should you see Formula properties failing, particularly ones that had worked before. (I am not certain whether the same effect occurs if you have multiple instances of the same version running simultaneously; I rarely do that, but often have multiple versions running at the same time.)
No comments:
Post a Comment