Get block bounding box (external dwg )

Get block bounding box (external dwg )

svucic
Advocate Advocate
1,386 Views
2 Replies
Message 1 of 3

Get block bounding box (external dwg )

svucic
Advocate
Advocate

Hi everyone,

 

I have a lot of blocks, each as separate dwg. I need tho know the with and height of the block before insertion. I was looking at Lee Macs program in this thread, but it is only if the block is defined in the current drawing.

 

Is there a way to do this? If nothing else is possible, could I maybe define all the blocks in the current drawing without inserting them?

 

Thank you!

0 Likes
Accepted solutions (1)
1,387 Views
2 Replies
Replies (2)
Message 2 of 3

Kent1Cooper
Consultant
Consultant
Accepted solution

You can certainly bring in Block definitions without completing the Insertions of those Blocks.  If they're in a folder location that's in the Support File Search Path list in Options:

 

(foreach blkname '("BlockA" "BlockB" "BlockC" "BlockD")

  (command "_.insert" blkname) (command)

)

 

The (command) function with no arguments cancels the Insert command at the point where it's asking for an insertion point, but the Block definition will already be loaded in.

 

If applicable, you might want to have it first use (tblsearch) to check whether there's a Block by each name already in the drawing, because if there is, there will be a question to be answered about whether to replace it.  When it finds one that's already there, you could either have it not do the Insert at all, or include the answer to that prompt.

 

The only other thing I can think of would be to Open each drawing and get its size from the EXTMIN and EXTMAX System Variables in each.  That, at least, would not involve bringing a lot of Block definitions into the current drawing that you might not use, but I think it would require a Script approach rather than an AutoLisp approach.

Kent Cooper, AIA
Message 3 of 3

svucic
Advocate
Advocate

That is great. I don't have to load all blocks at start, I can load each block when I need it.

 

Thanks Kent, you have always been a great help.

0 Likes