指定文本和属性的对齐点。 支持的平台:仅窗口 属性值只读:不 类型:变体(双精度的三元素数组) 表示对象对齐点的三维 WCS 坐标。 言论文本:此属性将重置为 0, 0, 0,并在属性设置为 时变为只读。若要定位对齐对齐方式为左对齐、适合或对齐的文本,请使用 theproperty 。AlignmentacAlignmentLeftInsertionPoint 例子工 务 局: 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))) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:34
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.