公差、文本、块或形状的插入点,以及 OLE 对象的原点(左上角)。 支持的平台:仅窗口 签名工 务 局: object.InsertionPoint 属性值只读:不 类型:变体(双精度的三元素数组) 表示插入点或原点的 3D WCS 坐标。 言论MText:指定文本边界一角的位置。使用该属性指定文本边界的哪个角要定位在此插入点。AttachmentPoint 文本:此属性是只读的,但文本除外,该属性设置为 ,或。若要定位对齐方式不是左对齐、对齐或适合的文本,请使用 theproperty 。AlignmentacAlignmentLeftacAlignmentAlignedacAlignmentFitTextAlignmentPoint 例子工 务 局: Sub Example_InsertionPoint() ' This example creates a text object in model space. ' It then changes the insertion point 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) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0 height = 0.5 ' Create the text object in model space Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height) ZoomAll ' Return the current value of the insertion point Dim currInsertionPoint As Variant currInsertionPoint = textObj.insertionPoint MsgBox "The insertion point of the text is " & currInsertionPoint(0) & ", " & currInsertionPoint(1) & ", " & currInsertionPoint(2), vbInformation, "InsertionPoint Example" ' Change the insertion point of the text object and ' update the display of the text object. insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0 textObj.insertionPoint = insertionPoint textObj.Update MsgBox "The new insertion point of the text is " & textObj.insertionPoint(0) & ", " & textObj.insertionPoint(1) & ", " & textObj.insertionPoint(2), vbInformation, "InsertionPoint Example" End Sub Visual LISP: (vl-load-com) (defun c:Example_InsertionPoint() ;; This example creates a text object in model space. ;; It then changes the insertion point 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 2 2 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) ;; Return the current value of the insertion point (setq currInsertionPoint (vlax-safearray->list (vlax-variant-value (vla-get-InsertionPoint textObj)))) (alert (strcat "The insertion point of the text is " (rtos (nth 0 currInsertionPoint) 2) ", " (rtos (nth 1 currInsertionPoint) 2) ", " (rtos (nth 2 currInsertionPoint) 2))) ;; Change the insertion point of the text object and ;; update the display of the text object. (setq insertionPoint (vlax-3d-point 3 3 0)) (vla-put-insertionPoint textObj insertionPoint) (vla-Update textObj) (setq newInsertionPoint (vlax-safearray->list (vlax-variant-value (vla-get-InsertionPoint textObj)))) (alert (strcat "The new insertion point of the text is " (rtos (nth 0 newInsertionPoint) 2) ", " (rtos (nth 1 newInsertionPoint) 2) ", " (rtos (nth 2 newInsertionPoint) 2))) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:44
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.