Insert block from memory

Insert block from memory

Anonymous
Not applicable
299 Views
2 Replies
Message 1 of 3

Insert block from memory

Anonymous
Not applicable
Hi!
I have a VBA program that insert many copy of a block. I would like to know how I can check if the block is already in the drawing and if it is use the same block.

if blockxxx is in memory
insert from memory
else
insert from the server
endif

Right now my program takes 30 seconds to execute, I have 395 "duplicate definition of block _archtik ignored"

Thx!
0 Likes
300 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
You check AcadDocument.Blocks collection to see if the block definition is
already in drawing or not:

Dim blk As AcadBlock
Dim bolExist As Boolean
For Each blk In ThisDrawing.Blocks
If UCase(blk.Name)=Ucase(theBlockName) THEN
bolExist=True
Exit For
End
Next

If bolExist Then
''Do insertion by passing BlockName
ThisDrawing.ModelSpance.InsertBlock theBlockName,....
Else
''Do insertion by passing full block file name
ThisDrawing.ModelSpace.InsertBlock "\\TheServer\BlockLibrary\" &
theBlockName & ".dwg",....
End If

wrote in message news:5192143@discussion.autodesk.com...
Hi!
I have a VBA program that insert many copy of a block. I would like to know
how I can check if the block is already in the drawing and if it is use the
same block.

if blockxxx is in memory
insert from memory
else
insert from the server
endif

Right now my program takes 30 seconds to execute, I have 395 "duplicate
definition of block _archtik ignored"

Thx!
0 Likes
Message 3 of 3

Anonymous
Not applicable
Thx Norman, I will give it a try!

Pierre D.
0 Likes