指定活动标注样式。 支持的平台:仅窗口 言论此样式将应用于所有新创建的维度。若要更改现有维度上的样式,请使用属性。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))) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:08
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.