Insert BLOCK

Insert BLOCK

Anonymous
Not applicable
251 Views
3 Replies
Message 1 of 4

Insert BLOCK

Anonymous
Not applicable
okee...i am really going nuts here.!!!
What I am trying to do here is create new drawing (draw1.dwg)programatically(VB),Then open an exisiting drawing and copy the BLOCK in it.
And then insert that BLOCK in a a newly created drawing(draw1.dwg).
But when i am trying to use CopyObjects, VB program gives an error saying "Invalid owner Objet"
what is this and how do i fix it??
0 Likes
252 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Here's something to help get you going. If you have any questions, just
holler.

Public Sub Test()

Dim sourceDoc As AcadDocument, targetDoc As AcadDocument
Dim entArray(0) As AcadObject, pt(2) As Double

Set targetDoc = Application.ActiveDocument
Set sourceDoc = Application.Documents.Open("C:\Blocks.dwg")
Set entArray(0) = sourceDoc.Blocks("Test")
sourceDoc.CopyObjects entArray, targetDoc.Blocks
pt(0) = 5: pt(1) = 5: pt(2) = 0
targetDoc.ModelSpace.InsertBlock pt, "Test", 1, 1, 1, 0

End Sub


--
"If you want to be somebody else change your mind"
http://www.acadx.com
http://vbxtender.sourceforge.net
0 Likes
Message 3 of 4

Anonymous
Not applicable
Frank,
that was cool.Thanks for ur help!!

praveen H
India
0 Likes
Message 4 of 4

Anonymous
Not applicable
Hi, I've tried your method and it's great. Is it possible to do the same without open the source file?

Ric
0 Likes