CAD/CAM discussion forum > CAD Tutorial & Tips > autocad vba insert block from file

autocad vba insert block from file

    
  Subscribe Topic

Rank: 1

sammyizimmy

Newbie

posts: 0

Registered: 2011-10-5

Message 1 of 2

 autocad vba insert block from file
01-01-1970 08:00 . am   |   View his/her posts only
Can anyone tell me how to insert a block from a file (eg. C:'block.dwg)
into the current autocad drawing using vba?

Rank: 1

OldForumPost

Newbie

posts: 0

Registered: 2012-1-14

Message 2 of 2

18-12-2011 04:01 . am   |   View his/her posts only
Hello
This code inserts a block into your drawing from a file on disk. The block is inserted at 0,0 and then erased. After that you can insert as many of the blocks as you want, anywhere you want

John

Dim insertionPoint(0 To 2) As Double
Dim blockObj As ZwcadBlock
Dim blockRefObj As ZwcadBlockReference
Dim varAttributes As Variant
UserForm1.Hide
insertionPoint(0) = 0
insertionPoint(1) = 0
insertionPoint(2) = 0
fn$ = "E:'John'ZWCADVBA'PTOffset'PT250.dwg"
Set blockRefObj = ThisDocument.ModelSpace.InsertBlock(insertionPoint, fn$, 1#, 1#, 1#, 0)
blockRefObj.Delete
.
.
.
See also
X