Search the Community
Showing results for tags 'block name'.
-
Hi guys, I've been trying to figure out a way to insert a new block in a project that already has one with the same name. I would like to have something asking me if I want to keep the old one or replace/overwrite with the new one. Keeping the placement of the old block in the project. I know that AutoCAD keeps the old version on a block if it has the same name as the new one, having to remove all instance of the block and purge all. Why wouldn't AutoCAD asked me ; [There is a block with the same name in your project, Would you like to; Overwrite, Rename, Cancel] Just like in file explorer on desktop. Anyway, maybe I'm asking to much let me know guys if you have a suggestion, either a LISP or a command that I'm not aware of yet in AutoCAD.. Thanks
- 1 reply
-
- block name
- overwrite
-
(and 1 more)
Tagged with:
-
get single block name and use a filter on the name for using inserting another block
patjeacad posted a topic in AutoLISP, Visual LISP & DCL
hello everyone, what I would like to program in lisp is the following: in the drawing I have a block (bolt) of which I want to use the name to enter another block (nut). I test for insert 0 and test for the name of the block. Because there are many lengths of, for example, an M8 bolt, the name of the block must be filtered, otherwise the correct block (nut) will not be automatically selected and placed in the drawing. see attached lisp file, with comments. (DEFUN c:nutinsert (/ A B D ) (PROGN (SETQ A (ENTSEL "\nSelect Block: ")) (IF A (PROGN ; (SETQ B (CDR (ASSOC 0 (ENTGET (CAR A))))) (IF (NOT (= B "INSERT")) (ALERT "\nselectinset is not a Block.") ) (IF (= B "INSERT") (PROGN (SETQ D (CDR (ASSOC 2 (ENTGET (CAR A))))) ;get blockname ;following are examples of bolt names, the list is much longer. I only need (IF (OR (= D "NEN1555-M08x070E") ;M8 (OR (= D "NEN1555-M06x040E")) ;M6 (OR (= D "NEN1555-M10x090E")) ;M10 (OR (= D "NEN1555-M16x100E")) ;M16 (OR (= D "NEN1568-M03x050E")) ;M3 (OR (= D "NEN1568-M08x120E")) ;M8 (OR (= D "NEN1568-M06x060E")) ;M6 (= D "NEN1555-M12x050E")) ;M12 ;I need a filter only M8 OR M6 OR M10 ECT, of the blockname. (PROGN (Setvar "Cmdecho" 0) (SETQ OLDLAYER (GETVAR "CLAYER")) (SETQ LAY (IF (NOT (TBLSEARCH "LAYER" "03_GEOMETRIE_050")) (COMMAND "LAYER" "M" "03_GEOMETRIE_050" "C" "7" "" "L" "CONTINUOUS" "" "")) ) (COMMAND "LAYER" "S" "03_GEOMETRIE_050" "") (SETQ Y (getpoint "\nGeef Invoegpunt : ")) (Command "-Insert" "NEN1560-M008-E";the BLOCK name is based on M8. ;it has to be flexible, M3 M4 M5 M6 M8 M10 ECT. Y "" "" Pause) (SETVAR "CLAYER" OLDLAYER) (PRINC) ) ) ) ) ) ) ) ) (PRINC)