How do you Modify the current Dim style on autolisp without it overriding like I want to change the dimscale with either one of these it overrides it (COMMAND "DIMSCALE" 25.4) (Setvar "DIMSCALE" 25.4)
|
|
|
How do you Modify the current Dim style on autolisp without it overriding like I want to change the dimscale with either one of these it overrides it (COMMAND "DIMSCALE" 25.4) (Setvar "DIMSCALE" 25.4)
HTH., M.R.Code:(defun c:dimstsav ( / curdimst varname value ) (setq curdimst (getvar 'dimstyle)) (while (or (not (setq varname (getstring "\nSpecify variable you want to change directly to current dimstyle : "))) (if (or (= varname "") (not (wcmatch (strcase varname) "DIM*")) ) t (not (snvalid varname)) ) ) (prompt "\nVariable specified not valid...") ) (setq value "") (while (not (snvalid value)) (initget 1) (setq value (getstring t "\nSpecify value to assign to variable : ")) ) (cond ( (= (type (getvar varname)) 'str) (setvar varname value) ) ( (= (type (getvar varname)) 'int) (setvar varname (atoi value)) ) ( (= (type (getvar varname)) 'real) (setvar varname (atof value)) ) ( (= (type (getvar varname)) 'list) (setvar varname (read (strcat "(" value ")"))) ) ) (vl-cmdf "_.-dimstyle" "_s" curdimst) (while (< 0 (getvar 'cmdactive)) (vl-cmdf "") ) (princ) )
Last edited by marko_ribar; 2019-04-13 at 06:26 AM.
Both Vanilla and Visual LISP works well on my PC :
Visual LISP example :
HTH., M.R.Code:(defun c:dimstsav ( / adoc curdimst varname value ) (vl-load-com) (setq adoc (vla-get-activedocument (vlax-get-acad-object))) (setq curdimst (vla-get-activedimstyle adoc)) (while (or (not (setq varname (getstring "\nSpecify variable you want to change directly to current dimstyle : "))) (if (or (= varname "") (not (wcmatch (strcase varname) "DIM*")) ) t (not (snvalid varname)) ) ) (prompt "\nVariable specified not valid...") ) (setq value "") (while (not (snvalid value)) (initget 1) (setq value (getstring t "\nSpecify value to assign to variable : ")) ) (cond ( (= (type (getvar varname)) 'str) (setvar varname value) ) ( (= (type (getvar varname)) 'int) (setvar varname (atoi value)) ) ( (= (type (getvar varname)) 'real) (setvar varname (atof value)) ) ( (= (type (getvar varname)) 'list) (setvar varname (read (strcat "(" value ")"))) ) ) (vla-copyfrom curdimst adoc) (princ) )
Last edited by marko_ribar; 2019-04-13 at 06:26 AM.
it started working on mine i cut it down to just this thanks
(defun c:dimsm ( / adoc curdimst varname value )
(vl-load-com)
(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
(setq curdimst (vla-get-activedimstyle adoc))
(setq varname "dimscale")
(setq value 24.5)
(setvar varname value)
(vla-copyfrom curdimst adoc)
(princ)
)