CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

附件点属性 (ActiveX)

2023-1-3 22:22| 发布者: admin| 查看: 591| 评论: 0|来自: AutoCAD

摘要: 指定 MText 对象的连接点。

指定 MText 对象的连接点。

支持的平台:仅窗口

签名

工 务 局:

object.AttachmentPoint
对象

类型:MText

此属性适用的对象。

属性值

只读:

类型:枚举acAttachmentPoint

  • acAttachmentPointTopLeft
  • acAttachmentPointTopCenter
  • acAttachmentPointTopRight
  • acAttachmentPointMiddleLeft
  • acAttachmentPointMiddleCenter
  • acAttachmentPointMiddleRight
  • acAttachmentPointBottomLeft
  • acAttachmentPointBottomCenter
  • acAttachmentPointBottomRight

言论

连接点指定插入点与文本边界对齐的位置。您选择的选项确定相对于文本边界的文本对齐和文本溢出。文本对齐的选项包括“左”、“右”和“居中”。文本溢出的选项包括“顶部”、“中间(中间)”和“底部”。



左上角

左对齐,溢出



顶部中心

居中对齐,向下溢出



右上

右对齐,溢出



左中

左对齐,上下溢出



中中心

居中对齐,上下溢出



右中

右对齐,上下溢出



左下角

左对齐,溢出



底部中心

居中对齐,溢出



右下角

正确对齐,溢出

更改属性时,现有边界框的位置不会更改;文本只是在边界框中重新对齐。但是,属性反映正在使用的连接点的坐标,因此属性的值将更改以反映对齐方式的变化。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))
    )
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-12 18:01

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部