Specifies the active dimension style.
Supported platforms: Windows only
Read-only: No
Type: DimStyle
A user-specified variable declared as an AcadDimStyle object type.
This style will be applied to all newly created dimensions. To change the style on an existing dimension, use the StyleName property.
To control the settings of the current document overrides, use the dimensioning system variables. See "System Variables" in the AutoCAD documentation for a list of dimensioning system variables.
When you change a dimensioning system variable, you are actually setting a document override for the active dimension style. You are not changing the active dimension style itself. To change the settings of a given dimension style, use the CopyFrom method. This method copies a dimension style configuration, including overrides, from a document, dimension, or other dimension style.
Dimensions created via the AutoCAD user interface are created with the active dimension style plus all document overrides. Dimensions created via ActiveX are created with the active dimension style only. To have the dimensions created via ActiveX take on the document overrides, use the CopyFrom method to copy the dimension style from the document to the active dimension style. This process will copy all existing overrides into the active dimension style.
VBA:
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))) )