Solved! Go to Solution.
Hi,
For such a simple task, it would be far easier to start from scratch than try and break into the Express Tools code and modify it.
This might work for you. First change the UCS to World. Use the Wblock command to select the instances of the block you want to replace and write these to the newblock drawing (choose the option to erase the items from the drawing). Open the newblock drawing and run the Express tool to replace the blocks. Use the rename command to rename the blocks. Save and close the newblock drawing. Insert the newblock drawing back into your original drawing.
Thank you for your suggestion, but for me seems complicate, I'm working on a lisp routine which select a source blocks and the others to replace.
if you want you can find the code below
(defun c:mb1 (/ *error* ent ss ssent id) (defun *error* (msg) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **")) ) (setvar 'nomutt 0) (princ) ) (while (not (and (setq ent (car (entsel "\nSelect source block: "))) (eq "INSERT" (cdr (assoc 0 (setq ent (entget ent))))) ) ) (prompt "\nPlease select a block!!") ) (redraw (cdr (car ent)) 3) (prompt "\nSelect blocks to replace: ") (setvar 'nomutt 1) (repeat (setq id (sslength (setq ss (ssget '((0 . "insert")))))) (setq ssent (entget (ssname ss (setq id (1- id))))) (entmod (subst (assoc 2 ent)(assoc 2 ssent) ssent)) (entupd ssent) ) (setvar 'nomutt 0) (redraw (cdr (car ent)) 4) (princ) )
Since the code you are asking us to review is LISP and obtained verbatim from a posting by a member of CADTUtor.net; I suggest that you ...
1) Join the discussion at CADTutor and seek clarification to your problems using THEIR code on this post --> CADTUtor.net
2) If you need help understanding LISP please ask your LISP questions in the Autodesk Forum for LISP programming ... this is the VB forum
Thank you very much for your code, I'll try to modify more in order to avoid the block name inserting, perhaps selecting source and destination blocks on screen.
Thank you again