Have ALL dim styles change to 1 layer

Have ALL dim styles change to 1 layer

3arizona
Advocate Advocate
917 Views
3 Replies
Message 1 of 4

Have ALL dim styles change to 1 layer

3arizona
Advocate
Advocate

I found this lisp on one of the forums.  

 

I have modified to my standards. Is there a way for all dims to update to the current style? the way its set up now, you have to give it a style.

 

if it can't be done is there a way to remove the dimension update? all i'm looking for is to place all dimensions to layer 35 color 10. 

 

 

 here is the lisp:

 

(defun c:TESTdims (/ *error* ocm lays ss)

(defun *error* (msg)
(if ocm (setvar "CMDECHO" ocm))
(if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
(princ (strcat "\n<< Error: " msg " >>")))
(princ))

(setq ocm (getvar "CMDECHO")
lays (vla-get-layers
(vla-get-ActiveDocument
(vlax-get-acad-object))))
(setvar "CMDECHO" 0)
(or (tblsearch "LAYER" "35")
(vla-put-color
(vla-add lays "35") 10))
(if (and (tblsearch "DIMSTYLE" "Standard")
(setq ss (ssget "_X" '((0 . "LEADER,DIMENSION")))))
(progn
(command "-dimstyle" "_R" "standard")
(command "_.chprop" ss "" "_LA" "35" "")
(command "-dimstyle" "_A" ss ""))
(princ "\n<< No Dimensions Found, or Dimstyle Doesn't Exist >>"))
(setvar "CMDECHO" ocm)
(princ))

0 Likes
Accepted solutions (1)
918 Views
3 Replies
Replies (3)
Message 2 of 4

DannyNL
Advisor
Advisor
Accepted solution

Use the variable DIMSTYLE to determine the current dimension style.

And as you are using the current dimension style there is no need to check if it exists anymore.

 

(non-tested)

   (if
      (setq ss (ssget "_X" '((0 . "LEADER,DIMENSION"))))      
      (progn
         (command "-dimstyle" "_R" (getvar "DIMSTYLE"))
         (command "_.chprop" ss "" "_LA" "35" "")
         (command "-dimstyle" "_A" ss "")
      )
      (princ "\n<< No Dimensions Found, or Dimstyle Doesn't Exist >>")
   )
Message 3 of 4

3arizona
Advocate
Advocate

DannyNL,

 

this works!!

 

thanks, for your time.

 

 

0 Likes
Message 4 of 4

DannyNL
Advisor
Advisor

You're welcome Smiley Happy

0 Likes