;;;从AutoCAD 2013 Active Reference帮助中code Examples中提取
;;;本源代码由 xshrimp 2013.2.20 搜集整理,版权归原作者所有!


(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)))
)