dalekr Posted July 16, 2019 Posted July 16, 2019 I need a little help redefining the explode command. I am tired of users exploding dimensions, multileaders, Civil 3D objects and so on. I want to redefine explode so that the only objects that can be exploded are blocks and polylines. I managed to get it working, but it only selects one object. When I select more than one object it only explodes the last object selected. How do I make the lisp explode multiple polylines or blocks? (command "UNDEFINE" "EXPLODE") ;undefine the Explode command (setq echo (getvar "cmdecho")) (setvar "cmdecho" 0) (defun C:EXPLODE (/ blpl echo) (alert "\nYou are ONLY allowed to explode blocks or polylines\n\nContact CAD Manager if you have questions") ;inform the user (prompt "\nSelect a Block or Polyline: ") (setq blpl (ssget '((-4 . "<OR")(0 . "INSERT")(0 . "LWPOLYLINE")(-4 . "OR>")))) (command ".EXPLODE" blpl) ;explode the object (princ) ;finish clean );defun (setvar "cmdecho" echo) ;restore cmdecho Quote
dlanorh Posted July 16, 2019 Posted July 16, 2019 (edited) I think you need to set the sysvar "QAFLAGS" to 1 to allow explode to work on a selection set. (setvar "QAFLAGS" 1) (command ".EXPLODE" blpl "") (setvar "QAFLAGS" 0) NOTE : You have to insert a "" at the end of the command for it to work properly. You also need to set it back immediately you've finished as, IIRC, it is an undocumented variable and could have unforseen consequences with other commands. Edited July 16, 2019 by dlanorh Updated code Quote
ronjonp Posted July 16, 2019 Posted July 16, 2019 6 hours ago, dalekr said: I need a little help redefining the explode command. I am tired of users exploding dimensions, multileaders, Civil 3D objects and so on. I want to redefine explode so that the only objects that can be exploded are blocks and polylines. I managed to get it working, but it only selects one object. When I select more than one object it only explodes the last object selected. How do I make the lisp explode multiple polylines or blocks? (command "UNDEFINE" "EXPLODE") ;undefine the Explode command (setq echo (getvar "cmdecho")) (setvar "cmdecho" 0) (defun C:EXPLODE (/ blpl echo) (alert "\nYou are ONLY allowed to explode blocks or polylines\n\nContact CAD Manager if you have questions") ;inform the user (prompt "\nSelect a Block or Polyline: ") (setq blpl (ssget '((-4 . "<OR")(0 . "INSERT")(0 . "LWPOLYLINE")(-4 . "OR>")))) (command ".EXPLODE" blpl) ;explode the object (princ) ;finish clean );defun (setvar "cmdecho" echo) ;restore cmdecho You're generous .. I wouldn't let them explode my blocks! 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.