After using entmod to change a dimstyle, the original settings modified become overrides of the newly modified dimstyle. Here is a way to avoid the creation of overrides.
Example: If the old extension line color for the dimstyle was 6, and the new one is 2
- The modified dimstyle has extension lines with color 2
- The modified dimstyle now has an override DIMCLRE = 6
Assume there is a dimstyle "MyNewStyle" with DIMCLRE = 6. Executing the following code will modify the dimstyle "MyNewStyle" but will also create a dimstyle override DIMCLRE = 6.
(setq myDS-Info (entget (tblobjname "dimstyle" "MyNewStyle"))
(cons 177 2)
(assoc 177 myDS-Info)
myDS-Info-New (entmod myDS-Info))
To get rid of the Style Overrides, it is necessary to save them to the dimstyle. This can be achieved in two ways:
1. The above code should be followed with
(command "-DIMSTYLE" "R" "MyNewStyle")
To test it, first create the style "MyNewStyle" with DIMCLRE set to 6, and set the style current. After running the code, any subsequent dimensions will have color 2 on the extension lines, and DIMCLRE = 6 will no longer list as an override.
(defun c:modCurDimStyle ()
;; Get the current dimstyle
(setq acadApp (vlax-get-acad-object)
curDoc (vla-get-ActiveDocument acadApp)
curDimStyle (vla-get-ActiveDimstyle curDoc)
;; Modify the current dimstyle.
;; This is done by changing the current dimvars
;; and by saving the dimvars in the dimstyle.
;; Change a dimvar.
(vla-SetVariable curDoc "DIMCLRE" 2)
;; Save the current dim vars in the current dim style.
(vla-CopyFrom curDimStyle curDoc)