Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Repeat Explode - Plines within blocks

21 REPLIES 21
SOLVED
Reply
Message 1 of 22
smaher12
769 Views, 21 Replies

Repeat Explode - Plines within blocks

I have multiple floor plans in a drawing one of which I need to explode 3-4 times to change the lineweight to 9mm. I have tried to put something that will repeat explode but I am having problems with plines within the blocks not exploding.

 

(defun c:tmp (ss)

  (setq ss (ssget))
  (setvar 'qaflags 1)
  (repeat 3 (vl-cmdf "._explode" ss ""))
  (setvar 'qaflags 0)
  (vl-cmdf "chprop" ss "" "lw" "0.09" "")

)

21 REPLIES 21
Message 21 of 22
smaher12
in reply to: hmsilva


I think that is what you want, try it, is minimally tested...

 

hope that helps

Henrique


Very nice... You saved the day. I was testing your code this morning and removed the *POYLINE,MLINE from the filter and it worked perfect for my purposes.

 

I have this block of a window with the glass created with mline and it just would not change the lineweight for the glass created on the left side. So my options were to remove MLINE from the filter or edit my block using just lines.

 

I attached the block if you would like to test. Maybe you might have a better explanation. Thanks again...

 

 

 

 

 

 

Message 22 of 22
hmsilva
in reply to: smaher12

smaher12,
revised code, with mline, polyline, layer S-FL-TILE, and minimally tested with the dwg's you provide...

 

(defun c:test (/ ss old-echo item ss1 item1 ss2 ss3 ss4)
  (setq old-echo (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (if (setq ss (ssget '((0 . "~*TEXT"))))
    (progn
      (if (setq ss3 (ssget "_P" '((8 . "S-FL-TILE"))))
	(progn
	  (command "select" ss "_r" ss3 "")
	  (setq ss nil)
	  (setq ss (ssget "_P"))
	  (command "erase" ss3 "")
	);; progn
      );; if
      (command "chprop" ss "" "lw" "0.09" "")
      (if (setq ss1 (ssget "_P" '((0 . "INSERT,*POLYLINE,MLINE"))))
	(foreach item (mapcar 'cadr (ssnamex ss1))
	  (command "Explode" item)
	  (if (setq ss4 (ssget "_P"))
	    (progn
	      (command "chprop" "_P" "" "lw" "0.09" "")
	      (setq ss4 nil)
	    );; progn
	  );; if
	  (while
	    (setq ss2 (ssget "_P" '((0 . "INSERT,*POLYLINE,MLINE"))))
	     (foreach item1 (mapcar 'cadr (ssnamex ss2))
	       (command "Explode" item1)
	       (command "chprop" "_P" "" "lw" "0.09" "")
	     );; foreach
	  );; while
	  (if (setq ss (ssget "_P"))
	    (command "chprop" ss "" "lw" "0.09" "")
	  );; if
	);; foreach
      );; if
    );; progn
  );; if
  (setvar "CMDECHO" old-echo)
  (princ)
);; test

 

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost