Replacing blocks.

Is it possible to replace a single instance of a block with another one without having to redefine all the insertions of the block? As in you have a drawing with say 200 copies of a block moved and rotated into place and are then told that a few need to be a similer but different part that is a 2nd block? Short of having to delete the wrong ones and re insert, move and rotate.

Reply to
Depresion
Loading thread data ...

Try this.....the block that you want to use as the replacement block must exist in the drawing's block table first.

(defun c:chgblk (/ oldblk newblk ss idx obj) (vl-load-com) (and (not (eq "" (setq oldblk (getstring "\nBlock name to select: ")))) (not (eq "" (setq newblk (getstring "\nBlock name to replace with: ")))) (tblsearch "block" newblk) (setq ss (ssget (list '(0 . "INSERT") (cons 2 oldblk)))) (setq idx -1) (while (setq obj (ssname ss (setq idx (1+ idx)))) (setq obj (vlax-ename->vla-object obj)) (vla-put-name obj newblk) ) ) (princ) )

Reply to
Jeff

Thanks, exactly what I needed.

Reply to
Depresion

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.