マルチ テキスト オブジェクトのアタッチ点を指定します。
サポートされているプラットフォーム: Windows のみ
読み込み専用: いいえ
タイプ: acAttachmentPoint 列挙型
アタッチ点は挿入点を文字境界と位置合わせする場所を指定します。選択したオプションにより、文字揃えと文字境界内の文字の配置が決まります。位置合わせのオプションは、Left、Right、Center です。文字配置のオプションは、Top、Mid、Bottomです。
![]() 左上 左に位置合わせ、下に伸びる |
![]() 上中心 中心に位置合わせ、下に伸びる |
![]() 右上 右に位置合わせ、下に伸びる |
![]() 左中央 左に位置合わせ、上下に伸びる |
![]() 中央 中心に位置合わせ、上下に伸びる |
![]() 右中央 右に位置合わせ、上下に伸びる |
![]() 左下 左に位置合わせ、上に伸びる |
![]() 下中心 中心に位置合わせ、上に伸びる |
![]() 右下 右に位置合わせ、上に伸びる |
AttachmentPoint プロパティが変更された場合、既存の境界ボックスの位置は変わらず、文字が境界ボックス内で単純に再度位置合わせされます。ただし、InsertionPoint プロパティは使用されているアタッチ点の座標を反映するので、位置合わせの変化を反映して InsertionPoint プロパティの値が変わります。
VBA:
Sub Example_AttachmentPoint()
Dim MTextObj As AcadMText
Dim width As Double
Dim text As String
Dim count As Integer
Dim attachPoint As String
Dim corner(0 To 2) As Double
corner(0) = 3#: corner(1) = 3#: corner(2) = 0#
width = 10
text = "Hello, World."
' Creates a MText object in model space
Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
For count = 1 To 9
MTextObj.AttachmentPoint = count
' Gets the attachment point of an MText object
attachPoint = Choose(MTextObj.AttachmentPoint, "TopLeft", "TopCenter", "TopRight", "MiddleLeft", "MiddleCenter", "MiddleRight", "BottomLeft", "BottomCenter", "BottomRight")
ThisDrawing.Regen True
MsgBox "The attachment point of the MText is now: " & attachPoint, vbInformation, "AttachmentPoint Example"
Next
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_AttachmentPoint()
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq corner (vlax-3d-point 3 3 0)
width 10
text "Hello, World.")
;; Creates a MText object in model space
(setq modelSpace (vla-get-ModelSpace doc))
(setq MTextObj (vla-AddMText modelSpace corner width text))
(setq count 1)
(repeat 9
(vla-put-AttachmentPoint MTextObj count)
;; Gets the attachment point of an MText object
(cond
((= (vla-get-AttachmentPoint MTextObj) 1)(setq attachPoint "TopLeft"))
((= (vla-get-AttachmentPoint MTextObj) 2)(setq attachPoint "TopCenter"))
((= (vla-get-AttachmentPoint MTextObj) 3)(setq attachPoint "TopRight"))
((= (vla-get-AttachmentPoint MTextObj) 4)(setq attachPoint "MiddleLeft"))
((= (vla-get-AttachmentPoint MTextObj) 5)(setq attachPoint "MiddleCenter"))
((= (vla-get-AttachmentPoint MTextObj) 6)(setq attachPoint "MiddleRight"))
((= (vla-get-AttachmentPoint MTextObj) 7)(setq attachPoint "BottomLeft"))
((= (vla-get-AttachmentPoint MTextObj) 8)(setq attachPoint "BottomCenter"))
((= (vla-get-AttachmentPoint MTextObj) 9)(setq attachPoint "BottomRight"))
)
(vla-Regen doc :vlax-true)
(alert (strcat "The attachment point of the MText is now: " attachPoint))
(setq count (1+ count))
)
)