Need Help with Lisp to change visibility of Dynamic Block

Need Help with Lisp to change visibility of Dynamic Block

quocanh_elnino
Contributor Contributor
268 Views
2 Replies
Message 1 of 3

Need Help with Lisp to change visibility of Dynamic Block

quocanh_elnino
Contributor
Contributor

Hi guys, Im have some dynamic blocks in drawing with Visiblity 1 , 1a 2 , 2a , 3 , 3a... 

Im need a Lisp can change all Visibility of blocks from 1 to 1a, 2 to 2a, 3 to 3a... in one time (Like in attach image)

Thanks for any help !

0 Likes
269 Views
2 Replies
Replies (2)
Message 2 of 3

ВeekeeCZ
Consultant
Consultant

Possibly this one. You need to change the name of the visibility parameter. Twice.

 

(vl-load-com)

(defun c:visa ( / s i e)
  
  (if (setq s (ssget "_:L" '((0 . "INSERT"))))
    (repeat (setq i (sslength s))
      (and (setq e (ssname s (setq i (1- i))))
	   (not (vl-catch-all-error-p (setq x (vl-catch-all-apply 'getpropertyvalue (list e (strcat "AcDbDynBlockProperty" "Visibility1"))))))
	   (distof x)
	   (vl-catch-all-apply 'setpropertyvalue (list e (strcat "AcDbDynBlockProperty" "Visibility1") (strcat x "a"))))))
  (princ)
  )

 

0 Likes
Message 3 of 3

quocanh_elnino
Contributor
Contributor

@ВeekeeCZ It's work perfect !

Thank you very much bro ! 🤗

0 Likes