指定 MText 对象的连接点。 支持的平台:仅窗口 属性值只读:不 类型:枚举acAttachmentPoint
言论连接点指定插入点与文本边界对齐的位置。您选择的选项确定相对于文本边界的文本对齐和文本溢出。文本对齐的选项包括“左”、“右”和“居中”。文本溢出的选项包括“顶部”、“中间(中间)”和“底部”。
更改属性时,现有边界框的位置不会更改;文本只是在边界框中重新对齐。但是,属性反映正在使用的连接点的坐标,因此属性的值将更改以反映对齐方式的变化。AttachmentPointInsertionPointInsertionPoint 例子工 务 局: 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)) ) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:24
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.