文字と属性の位置合わせ点を指定します。
サポートされているプラットフォーム: Windows のみ
VBA:
object.TextAlignmentPoint
タイプ: Attribute、AttributeReference、Text
このプロパティが適用されるオブジェクト。
読み込み専用: いいえ
タイプ: バリアント型(倍精度実数の 3 要素配列)
オブジェクトの位置合わせ点を表す 3D WCS 座標
Text: Alignment プロパティが acAlignmentLeft に設定されている場合、このプロパティは 0, 0, 0 にリセットされ、読み込み専用になります。位置合わせが、左、両端合わせ、フィットの文字の位置を決めるには、InsertionPoint プロパティを使います。
VBA:
Sub Example_TextAlignmentPoint()
' This example creates a text object in model space.
' It then changes the TextAlignmentPoint and HorizontalAlignment
' properties 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) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0
height = 0.5
' Create the text object in model space
Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
ZoomAll
MsgBox "The TextAlignmentPoint is set to the default " & _
textObj.TextAlignmentPoint(0) & ", " & _
textObj.TextAlignmentPoint(1) & ", " & _
textObj.TextAlignmentPoint(2), vbInformation, _
"TextAlignmentPoint Example"
' Change the value of the HorizontalAlignment and
' TextAlignmentPoint properties.
' Note that the HorizontalAlignment property must be changed first,
' and to a value that requires the TextAlignmentPoint, before the
' TextAlignmentPoint property will allow a value to be set.
Dim alignmentPoint(0 To 2) As Double
alignmentPoint(0) = 5: alignmentPoint(1) = 3: alignmentPoint(2) = 0
textObj.HorizontalAlignment = acHorizontalAlignmentFit
textObj.TextAlignmentPoint = alignmentPoint
ZoomAll
MsgBox "The TextAlignmentPoint is set to " & _
textObj.TextAlignmentPoint(0) & ", " & _
textObj.TextAlignmentPoint(1) & ", " & _
textObj.TextAlignmentPoint(2) & vbCrLf & _
"The HorizontalAlignment is set to acHorizontalAlignmentFit", _
vbInformation, "TextAlignmentPoint Example"
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_TextAlignmentPoint()
;; This example creates a text object in model space.
;; It then changes the TextAlignmentPoint and HorizontalAlignment
;; properties of the text object.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Define the text object
(setq insertionPoint (vlax-3d-point 3 3 0)
textString "Hello, World."
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)
(setq alignmentPoint (vlax-variant-value (vla-get-TextAlignmentPoint textObj)))
(alert (strcat "The TextAlignmentPoint is set to the default " (rtos (vlax-safearray-get-element alignmentPoint 0) 2) ", "
(rtos (vlax-safearray-get-element alignmentPoint 1) 2) ", "
(rtos (vlax-safearray-get-element alignmentPoint 2) 2)))
;; Change the value of the HorizontalAlignment and
;; TextAlignmentPoint properties.
;; Note that the HorizontalAlignment property must be changed first,
;; and to a value that requires the TextAlignmentPoint, before the
;; TextAlignmentPoint property will allow a value to be set.
(setq alignmentPoint (vlax-3d-point 5 3 0))
(vla-put-Alignment textObj acHorizontalAlignmentFit)
(vla-put-TextAlignmentPoint textObj alignmentPoint)
(vla-ZoomAll acadObj)
(setq alignmentPoint (vlax-variant-value (vla-get-TextAlignmentPoint textObj)))
(alert (strcat "The TextAlignmentPoint is set to " (rtos (vlax-safearray-get-element alignmentPoint 0) 2) ", "
(rtos (vlax-safearray-get-element alignmentPoint 1) 2) ", "
(rtos (vlax-safearray-get-element alignmentPoint 2) 2)))
)