Change all Dimension style text fill color to background and bring all dimensions draworder to front

Change all Dimension style text fill color to background and bring all dimensions draworder to front

anton_chmidt
Advocate Advocate
411 Views
2 Replies
Message 1 of 3

Change all Dimension style text fill color to background and bring all dimensions draworder to front

anton_chmidt
Advocate
Advocate

Is this possible to do with a lisp? Would be great if it would do it to all dim styles and aligned dimensions too. Without changing any other settings. 

If someone can help me that would be great 

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

ВeekeeCZ
Consultant
Consultant
Accepted solution

Try this. 

 

(defun c:DimStylesAllBackground ( / :AllNonXrefDimstyles s)
  
  (defun :AllNonXrefDimstyles (s / d r n)
    (while (setq d (tblnext s (null d)))
      (if (not (wcmatch (setq n (cdr (assoc 2 d))) "*|*"))
	(setq r (cons n r))))
    r)

  (foreach e (:AllNonXrefDimstyles "dimstyle")
    (setpropertyvalue (tblobjname "dimstyle" e) "Dimtfill" 1))
  (setvar 'Dimtfill 1)
  (if (setq s (ssget "_X" '((0 . "DIMENSION"))))
    (command "_.draworder" s "" "_front"))
  (princ)
  )

 

Message 3 of 3

anton_chmidt
Advocate
Advocate

This is perfect thank you very much!

Also I wanted to make sure it only changes text background and no other dim properties, so made dimstyle comparison before and after lisp. Indeed only difference was "Text background enabled". So it is working perfectly

0 Likes