B little Posted April 17, 2012 Posted April 17, 2012 I have a previously converted Microstation drawing in Autocad 2011. In the conversion all blocks were given unique names. I would like to edit similar blocks globally. Many of the Microstation blocks look like the standard blocks I use. Does a Lisp routine exist that can select similar Microstation blocks and give them a single name? Quote
MSasu Posted April 17, 2012 Posted April 17, 2012 This may be one solution; call the PURGE command after to get rid of replaced blocks definitions. ;;; Replace Selected Blocks (17-IV-2012) (defun c:RSB( / blockSource blockTarget nameBlock entBlock assocBlock ) (prompt "\nSelect source block: ") (if (setq blockSource (ssget "_:S:E" '((0 . "INSERT")))) (progn (setq nameBlock (assoc 2 (entget (setq entBlock (ssname blockSource 0))))) (redraw entBlock 3) (prompt "\nSelect blocks to be replaced (press Enter to exit): ") (while (setq blockTarget (ssget "_:S:E" '((0 . "INSERT")))) (setq assocBlock (entget (ssname blockTarget 0))) (entmod (subst nameBlock (assoc 2 assocBlock) assocBlock)) ) (redraw entBlock 4) ) ) (princ) ) There is no validation of source / target blocks similarity (that will be extremely difficult to do programmatically). Please use it with great care! 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.