InsertionPoint プロパティ(ActiveX)

幾何公差、文字、ブロック、シェイプ、および OLE オブジェクトの原点(左上コーナー)の挿入点。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.InsertionPoint
object

タイプ: AttributeAttributeReferenceBlockReferenceExternalReferenceMInsertBlockMTextOLEPointCloudPointCloudExShapeTableTextTolerance

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: いいえ

タイプ: バリアント型(倍精度実数の 3 要素配列)

挿入点または原点を表す 3D WCS 座標。

注意

MText: 文字境界のコーナー位置を指定します。AttachmentPoint プロパティを使用して、文字境界のどのコーナーをこの挿入点に位置付けるかを指定します。

Text: このプロパティは、Alignment プロパティが acAlignmentLeftacAlignmentAligned、または acAlignmentFitに設定されている文字を除き、読み込み専用です。位置合わせが、左、両端合わせ、フィット以外の場合は、TextAlignmentPoint プロパティを使用して文字の位置を決定します。

VBA:

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