AQucsaiJr Posted June 30, 2009 Posted June 30, 2009 I realize there is a MergeLayer command, I would like to know if anyone knows of a MergeBlock command? I convert drawings from Microstations to ACAD often, and when I do, they convert over with the "cells" that were placed in the drawings by the Microstations tech. However, somwhere within the convertion process, ACAD renames some of these "cells" within the converted ACAD drawing. So I basically get, for instance, 10 "Square" blocks, which are all exactally the same, labled: Square, Square01, Square02, Square03... I use the block replace from the Express tools right now, and it works fine, but I would like to know if there is an easier way as I ussually have 20+ blocks like this in each drawing and the Block Replace can only replace one at a time, as far as I know. Thanks for any help. Quote
Commandobill Posted June 30, 2009 Posted June 30, 2009 Thats odd, I've never had an issue like that and i export from microstation on occasion. But anyways do you have an example? Quote
Commandobill Posted June 30, 2009 Posted June 30, 2009 Here is an example. Not exactly pretty but it definately works.. atleast for me ;|************************************************************************ ************************************************************************** *********************A Simple Block Replace Function********************** ******************************By: ZRABOIN********************************* ************************************************************************** ************************************************************************|; (defun c:bsw ( / rblk nblk) (if (and (setq rblk (car (entsel "\nSelect a block with the block name you want to replace: "))) (setq nblk (car (entsel "\nSelect the block you would like to replace it with: "))) (= (cdr (assoc 0 (setq rblk (entget rblk)))) "INSERT") (= (cdr (assoc 0 (setq nblk (entget nblk)))) "INSERT")) (progn (setq rblk (reverse (vl-string->list (cdr (assoc 2 rblk))))) (while (and (> (car rblk) 48) (< (car rblk) 57)) (setq rblk (cdr rblk))) (mapcar '(lambda (z) (vla-put-name (vlax-ename->vla-object (cadr z)) (cdr (assoc 2 nblk)))) (ssnamex (ssget "X" (list (cons 2 (strcat (vl-list->string (reverse rblk)) "*"))))))) (princ "\nBlock not selected! Exiting program.")) (princ) ) Quote
AQucsaiJr Posted June 30, 2009 Author Posted June 30, 2009 This works, but I am looking for something more like the Merge Layer command, where I can choose a list of available blocks to be replaced by one block. I would prefer a list, because as you can see in the provided drawing, there are many blocks that all need to be replaced by just one block. This is one of 40 drawings I have with this same problem. I would love to be able to find a LISP that could make this easier than opening each drawing and using the Block Replace Express tool on each block. 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.