LISP? What the heck is that? Ahh, my Revit friends, LISP was the force to be reckoned since the early days of AutoCAD. Before FAS files, VBA, .Net, etc., the every day user of AutoCAD had but one programming language to take their skills to the next level.
Anyway, enough reflection, I was just cleaning out some directories and found a program I used quite often and suprisingly there isn't a version by Autodesk itself (as far as I know). The program below will simply swap out one block instance for another. It isn't very smart, if your block has attributes they probably will get hosed. If your new block is dynamic, the program will just use the default insert instance of the new block. Regardless, the program is helpful if you use a lot of generic blocks in AutoCAD. The program is FREE and therefore unsupported. I'm kinda hoping types like Lee Ambrosius will take the idea and do it right for the good of acadkind. ;)
(defun c:SWAPBLK (/ SELECTIONSET COUNT NBLK BLOCK ELIST)
(princ "\n SWAPBLK")
(setvar "cmdecho" 0)
(setvar "osmode" 0)
(prompt "\nSelect blocks to be swapped to another:")
(setq SELECTIONSET (ssget) COUNT 0)
(setq NBLK (getstring "\nName of swapping block:"))
(repeat (sslength SELECTIONSET)
(setq BLOCK (ssname SELECTIONSET COUNT))
(setq ELIST (entget BLOCK))
(setq ELIST (subst (cons 2 NBLK)(assoc 2 ELIST) ELIST))
(entmod ELIST)
(entupd BLOCK)
(setq COUNT (+ COUNT 1))
)
(princ)
)
(princ "\nSWAPBLK loaded.")
(princ)
3 comments:
works a treats
thanks.
thanks for that
This app rocks! Thanks for getting me out of a jam.
Post a Comment