kjb59 Posted July 9, 2010 Posted July 9, 2010 I have been working with dynamic blocks for a year now. I am new to LISP programming. I found this code from vbcad from tek-tips and i seem to recognize a few things from my experience working in MATLAB. Since ACAD 2010 is still missing support This routine is supposed to replace dynamic blocks with another block. The user select the block, and the predefined replacement block is inserted into it's place. However, when I use the routine and select a block, it will not allow me to select blocks, either regular or dynamic returning "0 blocks selected". The function then proceeds to return "No replaceable blocks selected." It will also set the visibility, but that is neither here nor there if I cannot select the block I want to replace. Any ideas on how to make a dynamic block replaceable or am I missing something here. rec.dwg will be the block that will be inserted. test is the dwg i am trying to replace the block in. -KGB test.dwg rec.dwg dyntemp.lsp Quote
Lt Dan's legs Posted July 9, 2010 Posted July 9, 2010 found here http://forums.autodesk.com/t5/AutoCAD-Express-Tools/Block-Replace-possible-wishlist-item/m-p/361602 defun c:TEST (/ ENT1 BL1 NWNM OLD ODNM) ;;LOOKS LIKE robkimross WROTE IT IN 06-09-2005 (prompt "Select blocks to replace: ") (and (setq ENT1 (ssget "_:S" '((0 . "INSERT")))) (setq NEWBL "[color=darkred][b]NAME OF BLOCK WHICH TAKES THE PLACE OF OLD BLOCK[/b][/color]") (not (command "insert" NEWBL nil)) (setq N (sslength ENT1)) (setq I 0) (repeat N (setq BL1 (entget (ssname ENT1 I))) (setq NWNM (cons 2 NEWBL)) (setq OLD (assoc 2 BL1)) (setq ODNM (cdr OLD)) (entmod (subst NWNM OLD BL1)) (setq I (1+ I)) ) ;_ repeat ) ;_ and (prin1) ) ;_ defun] 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.