asos2000 Posted December 17, 2009 Posted December 17, 2009 Some times there is a file has a lot of block but not inserted. but before making a purge i want to see all blocks. So I am searching for a lisp to insert all blocks. like the attached file. Quote
tzframpton Posted December 17, 2009 Posted December 17, 2009 Just put all blocks into ONE BLOCK inside a single DWG file. Then use Tool Palettes or Design Center to bring in that one block and all the others nested inside will come with it, inserting them all at once into your current drawing. Quote
rkmcswain Posted December 17, 2009 Posted December 17, 2009 Here is a quick and dirty way to insert all block definitions in the current drawing. (setq *acad* (vla-get-ActiveDocument (vlax-get-acad-object))) (setq *ms* (vla-get-ModelSpace *acad*)) (vlax-for item (vla-get-Blocks *acad*) (setq name (vla-get-Name item)) (if (not (eq "*" (substr name 1 1))) (vlax-invoke-method *ms* 'InsertBlock (vlax-3d-point (list 0.0 0.0 0.0)) (vla-get-Name item) 1.0 1.0 1.0 0.0 ) ) ) 1 Quote
asos2000 Posted December 17, 2009 Author Posted December 17, 2009 Thanx This is what I am looking for. I made some change for insertion point. (DEFUN C:BLKINS ()(setq *acad* (vla-get-ActiveDocument (vlax-get-acad-object))) (setq *ms* (vla-get-ModelSpace *acad*)) (vlax-for item (vla-get-Blocks *acad*) (setq name (vla-get-Name item)) (if (not (eq "*" (substr name 1 1))) (vlax-invoke-method *ms* 'InsertBlock (vlax-3d-point (getpoint "Pick Point")) (vla-get-Name item) 1.0 1.0 1.0 0.0 ) ) ) ) but I have to pick point for each block. How to use the same point for all blocks Quote
Lee Mac Posted December 17, 2009 Posted December 17, 2009 Try this: (DEFUN C:BLKINS (/ pt name) (vl-load-com) (setq *acad* (vla-get-ActiveDocument (vlax-get-acad-object))) (setq *ms* (vla-get-ModelSpace *acad*)) (vlax-for item (vla-get-Blocks *acad*) (if (and (not (eq "*" (substr (setq name (vla-get-Name item)) 1 1))) (setq pt (getpoint "\nSelect Point for Block: "))) (vlax-invoke-method *ms* 'InsertBlock (vlax-3d-point pt) name 1.0 1.0 1.0 0.0))) (princ)) EDIT: Sorry, didn't read your last bit Quote
Lee Mac Posted December 17, 2009 Posted December 17, 2009 Try this instead: (DEFUN C:BLKINS (/ blks pt name) (vl-load-com) (setq *acad* (vla-get-ActiveDocument (vlax-get-acad-object))) (setq *ms* (vla-get-ModelSpace *acad*)) (if (and (not (zerop (- (vla-get-count (setq blks (vla-get-blocks *acad*))) 1 (length (layoutlist))))) (setq pt (getpoint "\nSelect Point for Block: "))) (vlax-for item blks (if (not (eq "*" (substr (setq name (vla-get-Name item)) 1 1))) (vlax-invoke-method *ms* 'InsertBlock (vlax-3d-point pt) name 1.0 1.0 1.0 0.0)))) (princ)) Quote
gilsoto13 Posted December 17, 2009 Posted December 17, 2009 I would extract them to individual drawings to a specified sirectory using wba.lsp and then I would use Bi (Blkimport.lsp) to insert all those extracted blocks to the current drawing using a gap of 5.0 units between them... you can change the gap inside the lisp. wba.lsp BI.lsp Quote
asos2000 Posted December 17, 2009 Author Posted December 17, 2009 Thanx RKMCSWAIN Thanx LEE There is a question could the lisp calculate the block width then insert the next block in previous insertion point plus block width. Quote
Lee Mac Posted December 17, 2009 Posted December 17, 2009 It would have to insert the block, use the boundingbox, then move the block accordingly... Quote
wizman Posted December 18, 2009 Posted December 18, 2009 Just offering this one, if your purpose is for inspection, give a try also on autocad design center. Type ADC then go to 'open drawings' tab then pick on the 'blocks'. You'll see all the thumbnails in one window. And when you click on one thumbnail, a larger thumbnail is shown below which you can stretch further up so it can be seen having a larger view of the block without even inserting. Quote
TechDrawJoris Posted June 28, 2013 Posted June 28, 2013 Hai, is it possible to addapt the lisp command code to create a lisp to insert all blocks with name start with "PL Pan" ? i don't know anything from the code but i used it and its verry practical thanks already! :-D Quote
Dave Simmons Posted December 20, 2023 Posted December 20, 2023 On 12/17/2009 at 8:54 AM, Lee Mac said: @Lee Mac I know this is a very very very old thread and lsp routine. However, is there a way to provide a offset to each block or a table where they could be offset X-dist and Y-dist. Let's say max of 50 blocks Y and a specific distance of 6" and however many it columns in X it took... there are about 640 blocks in this drawing I want to review. Right now it inserts them all at same insertion point On 12/17/2009 at 8:54 AM, Lee Mac said: (DEFUN C:BLKINS (/ blks pt name) (vl-load-com) (setq *acad* (vla-get-ActiveDocument (vlax-get-acad-object))) (setq *ms* (vla-get-ModelSpace *acad*)) (if (and (not (zerop (- (vla-get-count (setq blks (vla-get-blocks *acad*))) 1 (length (layoutlist))))) (setq pt (getpoint "\nSelect Point for Block: "))) (vlax-for item blks (if (not (eq "*" (substr (setq name (vla-get-Name item)) 1 1))) (vlax-invoke-method *ms* 'InsertBlock (vlax-3d-point pt) name 1.0 1.0 1.0 0.0)))) (princ)) Quote
BIGAL Posted December 20, 2023 Posted December 20, 2023 Not sure what your asking for, very old post, a couple of suggestions can do max X columns or max Y rows, take total number of blocks get sqrt this will make a X & Y, rows & columns equal of blocks. Quote
Andreas69 Posted March 21 Posted March 21 This was useful for me: (DEFUN C:BBB (/ blks pt name distance) (vl-load-com) (setq *acad* (vla-get-ActiveDocument (vlax-get-acad-object))) (setq *ms* (vla-get-ModelSpace *acad*)) (if (and (not (zerop (- (vla-get-count (setq blks (vla-get-blocks *acad*))) 1 (length (layoutlist))))) (setq pt (getpoint "\nSelect Point for Block: "))) (progn (setq distance (getreal "\nEnter the distance between blocks: ")) (vlax-for item blks (if (not (eq "*" (substr (setq name (vla-get-Name item)) 1 1))) (progn (vlax-invoke-method *ms* 'InsertBlock (vlax-3d-point pt) name 1.0 1.0 1.0 0.0) (setq pt (mapcar '+ pt (list distance 0.0 0.0)))))))) (princ)) 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.