CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

插入点属性 (ActiveX)

2023-1-3 14:23| 发布者: admin| 查看: 482| 评论: 0|来自: AutoCAD

摘要: 公差、文本、块或形状的插入点,以及 OLE 对象的原点(左上角)。

公差、文本、块或形状的插入点,以及 OLE 对象的原点(左上角)。

支持的平台:仅窗口

签名

工 务 局:

object.InsertionPoint
对象

类型:属性,属性引用,块引用,比较引用,外部引用最小块MTextOLE,点云,点云Ex,形状表格文本,容

此属性适用的对象。

属性值

只读:

类型:变体(双精度的三元素数组)

表示插入点或原点的 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)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-11 14:28

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部