fabriciorby Posted March 15, 2013 Posted March 15, 2013 I have a lsp that works inserting blocks in the drawing. To 'load' this blocks, I use to click and drag the .dwg file into the current drawing. By doing this I can import the blocks and layers too. Is there a way to 'load' these blocks and layers using lisp? Maybe a lisp to insert this .dwg in the current drawing? Quote
Tharwat Posted March 15, 2013 Posted March 15, 2013 Use the insert command with the full path of the drawing and you 'd have them all within the current drawing . (command "_.-insert" "the full path of drawing" pause nil) Quote
fabriciorby Posted March 15, 2013 Author Posted March 15, 2013 Thank you guys, GP_ and Tharwat! and Lee too, of course haha Quote
pBe Posted March 15, 2013 Posted March 15, 2013 Sans lisp codes, Explore the power of Design Center[Ctrl+2] and Tool Palettes [Ctrl 3] Quote
fabriciorby Posted March 15, 2013 Author Posted March 15, 2013 Sans lisp codes, Explore the power of Design Center[Ctrl+2] and Tool Palettes [Ctrl 3] But with Tool Palette I can add one by one only, right? Quote
pBe Posted March 15, 2013 Posted March 15, 2013 But with Tool Palette I can add one by one only, right? While Design center is active, select your block library [folder[] right click and Create Tool Palette of blocks or even on a single file AND even on an open drawing. Try it and see if that works for you. Quote
fabriciorby Posted March 15, 2013 Author Posted March 15, 2013 While Design center is active, select your block library [folder[] right click and Create Tool Palette of blocks or even on a single file AND even on an open drawing. Try it and see if that works for you. I get the full Palette but it doesn't load the blocks in the new drawing... :/ Quote
pBe Posted March 16, 2013 Posted March 16, 2013 I get the full Palette but it doesn't load the blocks in the new drawing... :/ Of course not. The block tool palettes are there so you can have easy access to the blocks, its not physically on the drawing session but a link [pick at the ready]. It eliminates browsing for folder when using "insert". Perhaps you are referring to Templates. Options File Template setting Default template File name ofr QNEW Starting a new drawing with tons of Blocks all over the place doesn't appeal to me. Layers/Line-types/MleaderStyles on template is ok. I would suggest you play around with tool palettes and you will see its not just limited to Blocks. You'll be surprise how powerful that tool is. HTH Quote
fabriciorby Posted March 16, 2013 Author Posted March 16, 2013 Of course not. The block tool palettes are there so you can have easy access to the blocks, its not physically on the drawing session but a link [pick at the ready]. It eliminates browsing for folder when using "insert". Perhaps you are referring to Templates. Options File Template setting Default template File name ofr QNEW Starting a new drawing with tons of Blocks all over the place doesn't appeal to me. Layers/Line-types/MleaderStyles on template is ok. I would suggest you play around with tool palettes and you will see its not just limited to Blocks. You'll be surprise how powerful that tool is. HTH haha, it's because I use almost all of these tons of blocks in the drawing. I made a lisp that helps to insert blocks (position, rotation and stuff) but if someone run the lisp without the blocks loaded properly it gets an error. So it's needed to 'load' all the blocks first. I don't think template can help me in this case, I gonna check this on Monday. Thank you Quote
Lee Mac Posted March 16, 2013 Posted March 16, 2013 I made a lisp that helps to insert blocks (position, rotation and stuff) but if someone run the lisp without the blocks loaded properly it gets an error. So it's needed to 'load' all the blocks first. If you ensure the necessary blocks reside in an AutoCAD Support Path (perhaps in a network support path common to all users), your program will be able to locate and insert the blocks when required (depending on how your program is written). Quote
fabriciorby Posted March 16, 2013 Author Posted March 16, 2013 If you ensure the necessary blocks reside in an AutoCAD Support Path (perhaps in a network support path common to all users), your program will be able to locate and insert the blocks when required (depending on how your program is written). How to do that, hmmmmmmmmm It seems to be a nice solution Quote
Lee Mac Posted March 16, 2013 Posted March 16, 2013 How to do that, hmmmmmmmmmIt seems to be a nice solution How is your program creating the block references - INSERT command / entmake[x] / vla-insertblock? Are the blocks in an AutoCAD Support Path? Quote
fabriciorby Posted March 18, 2013 Author Posted March 18, 2013 How is your program creating the block references - INSERT command / entmake[x] / vla-insertblock?Are the blocks in an AutoCAD Support Path? Yes, the blocks are in an AutoCAD Support Path. But they are all in one big dwg It's just (command "_insert" "blockname" pt1 "" ang) Quote
Lee Mac Posted March 18, 2013 Posted March 18, 2013 Yes, the blocks are in an AutoCAD Support Path. But they are all in one big dwg Run this in your 'big dwg' to export each block to a separate file: (defun c:blk2dwg ( / def dir dwg ) (setq dir (getvar 'dwgprefix)) (while (setq def (tblnext "BLOCK" (null def))) (if (zerop (logand 125 (cdr (assoc 70 def)))) (if (not (findfile (setq dwg (strcat dir (cdr (assoc 2 def)) ".dwg")))) (command "_.-wblock" dwg "=") ) ) ) (princ) ) Quote
fabriciorby Posted March 18, 2013 Author Posted March 18, 2013 Run this in your 'big dwg' to export each block to a separate file: (defun c:blk2dwg ( / def dir dwg ) (setq dir (getvar 'dwgprefix)) (while (setq def (tblnext "BLOCK" (null def))) (if (zerop (logand 125 (cdr (assoc 70 def)))) (if (not (findfile (setq dwg (strcat dir (cdr (assoc 2 def)) ".dwg")))) (command "_.-wblock" dwg "=") ) ) ) (princ) ) wtf You're awesome! Thank you, Lee 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.