Hello everyone!
I was able to write a LISP that replaced each node with a block of my choice.
However, now I need to find a way now to replace the blocks with different blocks.
Each point shares the exact same block called "PILE". Different blocks are on different layers and have 11 different colors. I'd like to replace blocks on layer 1 with a block called "1" and blocks on layer 2 with a block called "2" and so on.
I was hoping there would be an easy way to do this in LISP, but I've been unable to get any of my scripts to work.
I've attached a link that helps visualize what my drawing is currently looking like:
http://jooniorstudios.com/images/CAD/script.png
Thank you in advance for your advice!
~Chris Jr.
@chrismathewsjr wrote:.... I need to find a way now to replace the blocks with different blocks.
Each point shares the exact same block called "PILE". Different blocks are on different layers and have 11 different colors. I'd like to replace blocks on layer 1 with a block called "1" and blocks on layer 2 with a block called "2" and so on.
....
This seems to do that [minimally tested]:
(foreach blk (mapcar 'cadr (ssnamex (ssget "_X" '((2 . "PILE")))))
(setq
edata (entget blk)
edata (subst (cons 2 (cdr (assoc 8 edata))) '(2 . "PILE") edata)
;; puts Layer name into Block-name slot
); setq
(entmod edata)
)
Whether there are any other aspects to be dealt with, such as scales and/or rotation, we don't know enough yet to say.