Insert BLOCK

Insert BLOCK

Anonymous
不适用
254 次查看
3 条回复
1 条消息(共 4 条)

Insert BLOCK

Anonymous
不适用
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 个赞
255 次查看
3 条回复
回复 (3)
2 条消息(共 4 条)

Anonymous
不适用
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 个赞
3 条消息(共 4 条)

Anonymous
不适用
Frank,
that was cool.Thanks for ur help!!

praveen H
India
0 个赞
4 条消息(共 4 条)

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

Ric
0 个赞