CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

ActiveDimStyle Property (ActiveX)

2023-1-4 00:13| 发布者: admin| 查看: 474| 评论: 0|来自: AutoCAD

摘要: 指定活动标注样式。

指定活动标注样式。

支持的平台:仅窗口

签名

工 务 局:

object.ActiveDimStyle
对象

类型:文档

此属性适用的对象。

属性值

只读:

类型:暗淡风格

声明为 AcadDimStyle 对象类型的用户指定的变量。

言论

此样式将应用于所有新创建的维度。若要更改现有维度上的样式,请使用属性。StyleName

要控制当前文档覆盖的设置,请使用尺寸标注系统变量。有关尺寸标注系统变量的列表,请参见 AutoCAD 文档中的“系统变量”。

更改尺寸标注系统变量时,实际上是在为活动标注样式设置文档覆盖。您不会更改活动标注样式本身。若要更改给定标注样式的设置,请使用该方法。此方法从文档、维度或其他维度样式复制维度样式配置,包括替代。CopyFrom

通过 AutoCAD 用户界面创建的尺寸是使用活动标注样式和所有文档覆盖创建的。通过 ActiveX 创建的维度仅使用活动维度样式创建。若要使通过 ActiveX 创建的维度采用文档替代,请使用该方法将维度样式从文档复制到活动维度样式。此过程会将所有现有替代复制到活动标注样式中。CopyFrom

例子

工 务 局:

Sub Example_ActiveDimStyle()
    ' This example returns the current dimension style
    ' and then sets a new style.
    ' Finally, it returns the style to the previous setting.
    Dim newDimStyle As AcadDimStyle
    Dim currDimStyle As AcadDimStyle
    
    ' Return current dimension style of active document
    Set currDimStyle = ThisDrawing.ActiveDimStyle
    MsgBox "The current dimension style is " & currDimStyle.name, vbInformation, "ActiveDimStyle Example"
    
    ' Create a dimension style and makes it current
    Set newDimStyle = ThisDrawing.DimStyles.Add("TestDimStyle")
    ThisDrawing.ActiveDimStyle = newDimStyle    ' set current dimension style to newDimStyle
    MsgBox "The new dimension style is " & newDimStyle.name, vbInformation, "ActiveDimStyle Example"
    
    ' Reset the dimension style to its previous setting
    ThisDrawing.ActiveDimStyle = currDimStyle
    MsgBox "The dimension style is reset to " & currDimStyle.name, vbInformation, "ActiveDimStyle Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ActiveDimStyle()
    ;; This example returns the current dimension style
    ;; and then sets a new style.
    ;; Finally, it returns the style to the previous setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Get the current dimension style of the active document
    (setq currDimStyle (vla-get-ActiveDimStyle doc))
    (alert (strcat "The current dimension style is " (vla-get-Name currDimStyle)))
    
    ;; Create a dimension style and make it current
    (setq dimStyles (vla-get-DimStyles doc))
    (setq newDimStyle (vla-Add dimStyles "TestDimStyle"))
    (vla-put-ActiveDimStyle doc newDimStyle)    ;; set current dimension style to newDimStyle
    (alert (strcat "The new dimension style is " (vla-get-Name newDimStyle)))
    
    ;; Restore the previously active dimension style
    (vla-put-ActiveDimStyle doc currDimStyle)
    (alert (strcat "The dimension style is restored to " (vla-get-Name currDimStyle)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-11 12:50

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部