Rotation Property (ActiveX)

Specifies the rotation angle for the object.

Supported platforms: Windows only

Signature

VBA:

object.Rotation
object

Type: Attribute, AttributeReference, BlockReference, DgnUnderlay, Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, DwfUnderlay, ExternalReference, GeomapImage, GeoPositionMarker, MInsertBlock, MText, OLE, PdfUnderlay, PointCloud, PointCloudEx, RasterImage, Shape, Text, Wipeout

The objects this property applies to.

Property Value

Read-only: No

Type: Double (except an OLE object which is of the ACAD_ANGLE type)

The rotation angle in radians.

Remarks

The rotation angle is relative to the X axis of the object's WCS with positive angles going counterclockwise when looking down from the Z axis toward the origin.

Raster: To display the raster image at the specified rotation, set the ShowRotation property to True.

Text: The rotation angle is read-only for text whose Alignment property is set to acAlignmentAligned or acAlignmentFit.



Text rotation angle



Dimension line angle

Examples

VBA:

Sub Example_Rotation()
    ' This example creates a text object in model space.
    ' It then changes the Rotation of the text object.

    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double
    
    ' Define the text object
    textString = "Hello, World."
    insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0
    height = 0.5
    
    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
    ZoomAll
    MsgBox "The Rotation is " & textObj.rotation, vbInformation, "Rotation Example"
    
    ' Change the value of the Rotation to 45 degrees (.707 radians)
    textObj.rotation = 0.707
    ZoomAll
    MsgBox "The Rotation is set to " & textObj.rotation, vbInformation, "Rotation Example"
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Rotation()
    ;; This example creates a text object in model space.
    ;; It then changes the Rotation of the text object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the text object
    (setq textString "Hello, World."
          insertionPoint (vlax-3d-point 3 3 0)
          height 0.5)

    ;; Create the text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))
    (vla-ZoomAll acadObj)

    (alert (strcat "The Rotation is " (rtos (vla-get-Rotation textObj) 2)))
    
    ;; Change the value of the Rotation to 45 degrees (.707 radians)
    (vla-put-Rotation textObj 0.707)
    (vla-ZoomAll acadObj)
    (alert (strcat "The Rotation is set to " (rtos (vla-get-Rotation textObj) 2)))
)