CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2020 开发者帮助

CenterType 属性 (ActiveX)

2024-5-18 18:21| 发布者: admin| 查看: 104| 评论: 0|原作者: admin|来自: AutoCAD

CenterType 属性 (ActiveX)

指定径向尺寸和直径尺寸的中心标记类型。

支持的平台:仅限 Windows

签名

VBA:

object.CenterType
对象

类型:DimDiametricDimRadialDimRadialLarge

此属性应用于的对象。

属性值

只读:

类型:枚举acDimCenterType

  • acCenterMark
  • acCenterLine
  • acCenterNone

言论

仅当将尺寸线放置在圆或圆弧之外时,中心标记才可见。

注意:此属性将覆盖给定维度的 DIMCEN 系统变量的值。

例子

VBA:

Sub Example_CenterType()
    ' This example creates a diametric dimension in model space.
    ' It then changes the type of center for the dimension.
    
    Dim dimObj As AcadDimDiametric
    Dim chordPoint(0 To 2) As Double
    Dim farChordPoint(0 To 2) As Double
    Dim leaderLength As Double
    
    ' Define the dimension
    chordPoint(0) = 5#: chordPoint(1) = 3#: chordPoint(2) = 0#
    farChordPoint(0) = 5#: farChordPoint(1) = 5#: farChordPoint(2) = 0#
    leaderLength = 1#
    
    ' Create the diametric dimension in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimDiametric(chordPoint, farChordPoint, leaderLength)
    ZoomAll
    
    ' Set the center to be none
    dimObj.CenterType = acCenterNone
    dimObj.Update
    MsgBox "The dimension center type is set to none."
    
    ' Change the center type to center mark
    dimObj.CenterType = acCenterMark
    dimObj.Update
    MsgBox "The dimension center type is set to center mark."
    
    ' Change the center type to center line
    dimObj.CenterType = acCenterLine
    dimObj.Update
    MsgBox "The dimension center type is set to center line."
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_CenterType()
    ;; This example creates a diametric dimension in model space.
    ;; It then changes the type of center for the dimension.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq chordPoint (vlax-3d-point 5 3 0)
          farChordPoint (vlax-3d-point 5 5 0)
          leaderLength 1)
    
    ;; Create the diametric dimension in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimDiametric modelSpace chordPoint farChordPoint leaderLength))
    (vla-ZoomAll acadObj)
    
    ;; Set the center to be none
    (vla-put-CenterType dimObj acCenterNone)
    (vla-Update dimObj)
    (alert "The dimension center type is set to none.")
    
    ;; Change the center type to center mark
    (vla-put-CenterType dimObj acCenterMark)
    (vla-Update dimObj)
    (alert "The dimension center type is set to center mark.")
    
    ;; Change the center type to center line
    (vla-put-CenterType dimObj acCenterLine)
    (vla-Update dimObj)
    (alert "The dimension center type is set to center line.")
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-12-16 00:08

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部