skipsophrenic Posted October 6, 2008 Posted October 6, 2008 Hi all, Is it possible to insert multiple blocks into the drawing all a once, or is it a case of 1 by 1? Basically what i'm doing at the moment is going Insert>Block>select block>isert point "0,0">Scale "1">Explode>OK. Am having to do this for over 200 blocks, so as you can guess VERY time consuming. Thanks in advance. EDIT: Just did a recount of No. of blocks to insert. . . 1566! Help pls. Quote
Strix Posted October 6, 2008 Posted October 6, 2008 how about insert one then ARRAY? PS - What the heck are you exploding them for? Quote
skipsophrenic Posted October 6, 2008 Author Posted October 6, 2008 how about insert one then ARRAY? PS - What the heck are you exploding them for? Cant array them because they are all different blocks of different peices, and as for exploding, that's what i've been asked for. (Odd i know) Can't post the drawing due to copyright law sorry. Quote
Strix Posted October 6, 2008 Posted October 6, 2008 the best I can suggest is to write a button macro so you don't have to enter the scale etc for each one, they just become click and dump I bet somebody with a bit of nouse would be able to write you a lisp to splat them all in in one go are they all in the same location? Quote
skipsophrenic Posted October 6, 2008 Author Posted October 6, 2008 yeah, all their base point's are at 0,0 in world UCS Quote
Strix Posted October 6, 2008 Posted October 6, 2008 when I said 'location' I meant file path :wink: mind you, if they're all insertion point 0,0, that could be a bit of a nuisance trying to insert with a button macro - back to the drawing board Do you want your thread moving to the LISP section? Quote
skipsophrenic Posted October 6, 2008 Author Posted October 6, 2008 when I said 'location' I meant file path :wink: mind you, if they're all insertion point 0,0, that could be a bit of a nuisance trying to insert with a button macro - back to the drawing board Do you want your thread moving to the LISP section? Yep they're all in the same location directory, An why i didn't think to ask this in the lisp forum i don't know, i must be havin brainmelt syndrom again, so yes pls can you move this thread to the lisp forum. Quote
Strix Posted October 6, 2008 Posted October 6, 2008 there you go - shifted have a look through some old threads here and see if there's something appropriate for your application too what sort of arrangement are all these blocks going into? Are you creating some sort of library/documentation or is it a drawing? Quote
skipsophrenic Posted October 6, 2008 Author Posted October 6, 2008 All the blocks are going into a drawing, Did do a search earlier with the term "Inserting Multiple Blocks" but didn't get anywhere. i think my brains gone on holiday and left me behind to struggle on! LOL Quote
Strix Posted October 6, 2008 Posted October 6, 2008 so even if you splat them all in in one go, you still need to move them to their location? is this faffing actually saving you anything then? why are they all going at 0,0? (the explode had me completely foxed) I'll have a quick look to see if I can find something useful Quote
skipsophrenic Posted October 6, 2008 Author Posted October 6, 2008 so even if you splat them all in in one go, you still need to move them to their location? is this faffing actually saving you anything then? why are they all going at 0,0? (the explode had me completely foxed) I'll have a quick look to see if I can find something useful The BASE POINTS are all at 0,0 but they are filling up a drawing area of 456000,394000 with each block representing a small portion of whole drawing. Quote
jonesy Posted October 6, 2008 Posted October 6, 2008 Would it be quicker to insert all the blocks first then select all, and expolde? I know its still going to take ages to insert, but doing it this way is one less step for you Quote
skipsophrenic Posted October 6, 2008 Author Posted October 6, 2008 that's the way i've started to go, but with so many blocks to insert, I think i'll still be at this at the end of the week. oh well keeps the bills paid. Quote
skipsophrenic Posted October 6, 2008 Author Posted October 6, 2008 After a while i realied i'd duplicated some of the inserts and did the overkill commands and now i'm getting this happen as well. Command: overkill Initializing... Select objects: all 465540 found Select objects: ; error: An error has occurred inside the *error* functionFunction cancelled any ideas? Quote
Strix Posted October 6, 2008 Posted October 6, 2008 start over again? Go back to the twerp who suggested exploding the damned things and do it the sensible way? won't OVERKILL work properly then? Quote
ASMI Posted October 6, 2008 Posted October 6, 2008 You can use something like this code (simplified but works): (defun c:test(/ blLst) ; define list of blocks (setq blLst '("Block1" "Block2" "Block3")) ; foreach block name in list (foreach bl blLst ; if block found in drawing database (if(tblsearch "BLOCK" bl) ; insert block in point 0,0 with scale 1 and rotation 0 (command "_.-insert" bl "0,0" "1" "0") ; if block is not found display alert window (alert(strcat "\nBlock '" bl "' not found!")) ); end if );end foreach ; silent exit (without value of last expression) (princ) ); end of c:test Command: overkillInitializing... Select objects: all 465540 found Select objects: ; error: An error has occurred inside the *error* functionFunction cancelled any ideas? Some Express Tools lisps contains a bugs, some of it don't corrected in many years. If you send to me your drawing, I can to catch it. If do not want, let remains as is, let Autodesk corrects the bugs. Quote
skipsophrenic Posted October 6, 2008 Author Posted October 6, 2008 Asmi, I got to admit that I don't know much about lisp, so when I run this do i need to tell AutoCAD the naqme of each block, or just point it to where they're all saved? (Sorry forgot to mention all the blocks are saved as their own dwg's.) EDIT: Strix, nope all overkill seems to do is turn the computer into a very nice expensive doorstop untill i exit acad with the taskmanager - and that takes it's time too. Quote
ASMI Posted October 7, 2008 Posted October 7, 2008 I got to admit that I don't knowmuch about lisp, so when I run this do i need to tell AutoCAD the naqme of each block, or just point it to where they're all saved? (Sorry forgot to mention all the blocks are saved as their own dwg's.) Ok. Now you can select folder with block drawings: (defun c:test(/ blLst diFol) (vl-load-com) (defun BrowseFolder(Message / ShlObj Folder FldObj OutVal) (setq ShlObj (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application") Folder (vlax-invoke-method ShlObj 'BrowseForFolder 0 Message 0) ); end setq (vlax-release-object ShlObj) (if Folder (progn (setq FldObj (vlax-get-property Folder 'Self) OutVal (vlax-get-property FldObj 'Path) ) (vlax-release-object Folder) (vlax-release-object FldObj) OutVal ) ) ); end of BrowseFolder ; if folder selected and is drawings inside (if(and (setq diFol(BrowseFolder "Select folder to insert blocks")) (setq blLst(vl-directory-files diFol "*.dwg" 1)) ); end and ; swich off echo uutput (setvar "CMDECHO" 0) ; foreach block name in list (foreach bl blLst ; if block found in drawing database ; if block not found in drawing, set block name as full path (if(not(tblsearch "BLOCK" bl)) (setq bl(strcat diFol "\\" bl)) ); end if ; insert block in point 0,0 with scale 1 and rotation 0 (command "_.-insert" bl "0,0" "1" "" "0") );end foreach ; swich on echo output (setvar "CMDECHO" 0) ; if nothing files found print error message (princ "\n<!> Nothing *.dwg files found <!> ") ); end if ; silent exit (without value of last expression) (princ) ); end of c:test Quote
skipsophrenic Posted October 8, 2008 Author Posted October 8, 2008 Ok. Now you can select folder with block drawings: (defun c:test(/ blLst diFol) (vl-load-com) (defun BrowseFolder(Message / ShlObj Folder FldObj OutVal) (setq ShlObj (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application") Folder (vlax-invoke-method ShlObj 'BrowseForFolder 0 Message 0) ); end setq (vlax-release-object ShlObj) (if Folder (progn (setq FldObj (vlax-get-property Folder 'Self) OutVal (vlax-get-property FldObj 'Path) ) (vlax-release-object Folder) (vlax-release-object FldObj) OutVal ) ) ); end of BrowseFolder ; if folder selected and is drawings inside (if(and (setq diFol(BrowseFolder "Select folder to insert blocks")) (setq blLst(vl-directory-files diFol "*.dwg" 1)) ); end and ; swich off echo uutput (setvar "CMDECHO" 0) ; foreach block name in list (foreach bl blLst ; if block found in drawing database ; if block not found in drawing, set block name as full path (if(not(tblsearch "BLOCK" bl)) (setq bl(strcat diFol "\\" bl)) ); end if ; insert block in point 0,0 with scale 1 and rotation 0 (command "_.-insert" bl "0,0" "1" "" "0") );end foreach ; swich on echo output (setvar "CMDECHO" 0) ; if nothing files found print error message (princ "\n<!> Nothing *.dwg files found <!> ") ); end if ; silent exit (without value of last expression) (princ) ); end of c:test ASMI [CHECKING TEXT test.lsp loading...] . ; error: too many arguments: (IF (AND ( ... ) ( ... )) (SETVAR "CMDECHO" 0) (FOREACH BL BLLST ( ... ) ... ) ... ) ; Check done. 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.