nicolas Posted February 22, 2012 Posted February 22, 2012 Hi, I know this is a common topic and I have found number of them on the net but I am still looking forward to a clear-cut lisp procedure to inserting a block from another drawing into the current drawing. Having the source file containing multiple blocks in the search paths has not helped. It seemed there must be a solution as this is an established practice in use in DC and Palette. The reason for the lisp instead of DC/Palette is that I can automatically insert 4 blocks at specified coordinates and this will greatly accelerate my work. Regards, Nicolas Quote
ReMark Posted February 22, 2012 Posted February 22, 2012 All four (separate) blocks are contained in one drawing not multiple drawings right? And you know the name of each block. Will the blocks you have to insert change from drawing to drawing? And you know the specific coordinates beforehand that the blocks will be inserted at? Will these coordinates change from drawing to drawing? Will the scale of the blocks be the same or different? Will this change from drawing to drawing? One must account for all the variables. Quote
Tharwat Posted February 22, 2012 Posted February 22, 2012 try this code to insert the needed drawing and it would be erased after that to have all its blocks into the current open drawing . (defun c:Test (/ filename) (vl-load-com) ;;; Tharwat 22. Feb. 2012 ;;; (setq filename [color=blue][b]"C:\\Users\\Drawing1.dwg"[/b][/color]) ;; <<<-- put your complete drawing file name with its directory (vl-cmdf "_.-insert" filename '(0. 0. 0.) "" "" "") (vl-cmdf "_.erase" (entlast) "") (if (tblsearch "BLOCK" (setq filename (vl-filename-base filename)) ) (vl-cmdf "_.-purge" "Blocks" filename "_N") ) (princ) ) Quote
nicolas Posted February 22, 2012 Author Posted February 22, 2012 Remark, Thanks. The block library contains hundreds of blocks. The lisp program will insert four of them in model space in numerous drawings (I know the names, the destination coordinates, scale 1 in x and y directions, rotation = 0, as is) and 2 additional ones in paper space at specific coordinates but exploded state (because they contain a view port). Tharwat, thanks for the code but I need but some of the blocks and not all the blocks/or a drawing in another drawing. The filename variable contain the path and filename but what about the specific blocks and how to insert them at specific locations??? in model/paper space with scale 1 and the one in paper space in exploded state. Thanks in advanced, Regards, Nicolas. Quote
Tharwat Posted February 22, 2012 Posted February 22, 2012 After inserting the drawing , its blocks would be all available in hand , so with a few lines of codes you could insert the needed blocks to the destination that you want . e.g in use of entmakex function to insert any block that existed in current drawing . (entmakex (list (cons 0 "INSERT") (cons 2 BlockNme) ; Block Name (cons 10 pt) ; Insertion Point '(41 . 1.0) '(42 . 1.0) '(43 . 1.0) ) ) Quote
Lee Mac Posted February 22, 2012 Posted February 22, 2012 Maybe one of these will help: http://lee-mac.com/copyblockfromdrawing.html http://lee-mac.com/steal.html Quote
nicolas Posted February 23, 2012 Author Posted February 23, 2012 Thanks to all. Will try the different avenues proposed this afternoon. Quote
Flacon Posted October 31, 2022 Posted October 31, 2022 On 2/22/2012 at 12:23 PM, Lee Mac said: Maybe one of these will help: http://lee-mac.com/copyblockfromdrawing.html http://lee-mac.com/steal.html Hi Lee im working on your copyblockfromdrawing lisp, however, I need a modification if possible. I am trying to add a block from another drawing everytime a macro button is clicked. The current code you have made only allows for distinct blocks to be added. I am basically setting up a macro button accessible from the autocad toolbar that allows users to add symbols to a drawing, as many times as they wish. Quote
tombu Posted November 1, 2022 Posted November 1, 2022 (edited) 20 hours ago, Flacon said: Hi Lee im working on your copyblockfromdrawing lisp, however, I need a modification if possible. I am trying to add a block from another drawing everytime a macro button is clicked. The current code you have made only allows for distinct blocks to be added. I am basically setting up a macro button accessible from the autocad toolbar that allows users to add symbols to a drawing, as many times as they wish. As someone who uses Lee Mac's StealV1-8.lsp in many macros you should start the macro with a call to steal the block to make sure it's in the drawing then use -insert followed by block name letting the user pick location and scale afterwards. You could also use the -INSERTCONTENT command in a macro to directly insert a block from another drawing. Edited November 1, 2022 by tombu Added link for -INSERTCONTENT Quote
Lee Mac Posted November 1, 2022 Posted November 1, 2022 On 10/31/2022 at 3:33 PM, Flacon said: Hi Lee im working on your copyblockfromdrawing lisp, however, I need a modification if possible. I am trying to add a block from another drawing everytime a macro button is clicked. The current code you have made only allows for distinct blocks to be added. I am basically setting up a macro button accessible from the autocad toolbar that allows users to add symbols to a drawing, as many times as they wish. Have you considered simply using Tool Palettes? 1 Quote
BIGAL Posted November 2, 2022 Posted November 2, 2022 If your copying this block often why not wblock it out and save in a support path can then insert when ever required. Like Lee Tool palettes or for me a custom menu with blocks displayed. 1 Quote
tombu Posted November 2, 2022 Posted November 2, 2022 I have an MUTCD.dwg that has about 100 standard MUTCD street signs as blocks. This macro ^C^C^P(command "adcnavigate" "G:/ENGDESGN/BeaufordT/Blocks/MUTCD.dwg") or ^C^Cadcnavigate G:/ENGDESGN/BeaufordT/Blocks/MUTCD.dwg; open the MUTCD.dwg in Design Center so I can view clear images (I didn't have to create) of all the signs with their names in an alphabetized list of the block names. Makes inserting or updating those blocks easy in case you wanted another option! Quote
BIGAL Posted November 3, 2022 Posted November 3, 2022 Tombu you would like this, 100's of signs at your fingertips and its a TTF. So can use in say Word and Excel also. Now the bad news I can not find the company that made them "AUS Fonts" if you find them let me know. 1 Quote
SLW210 Posted November 3, 2022 Posted November 3, 2022 I use Design Center as well. Very quick and easy, IMO. 1 Quote
tombu Posted November 3, 2022 Posted November 3, 2022 5 hours ago, BIGAL said: Tombu you would like this, 100's of signs at your fingertips and its a TTF. So can use in say Word and Excel also. Now the bad news I can not find the company that made them "AUS Fonts" if you find them let me know. I've attached the sign block drawing I use from Florida Dept. of Transportation. I'd like to see the one you have to see if I'm missing any. I might be able to find those fonts. If you have an image displaying text in an unknown font paste it into https://www.fontsquirrel.com/matcherator?token=ohd8q2l7ylb75dti to identify it. 164223165_mutcd-StandardFonts.zip 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.