Jump to content

Insert Multiple blocks into drawing?


skipsophrenic

Recommended Posts

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.

Link to comment
Share on other sites

  • Replies 54
  • Created
  • Last Reply

Top Posters In This Topic

  • skipsophrenic

    13

  • Lee Mac

    8

  • Strix

    7

  • EBROWN

    5

Top Posters In This Topic

Posted Images

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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, :oops: so yes pls can you move this thread to the lisp forum.

Link to comment
Share on other sites

there you go - shifted :thumbsup:

 

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?

Link to comment
Share on other sites

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!:shock:

 

LOL

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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. :cry:

 

oh well keeps the bills paid.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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: overkill

Initializing...

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.)

 

 

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...