microwave2009
Industrial
- Jul 28, 2009
- 1
My intention is insert a block "B2" from a external drawing test.dwg to current drawing. The problem is the whole drawing test.dwg was inserted in the current drawing. I know I am confused with "add a reference" and "add a block" but I don't know how to solve it. Seek help. Here is my code:
Sub InsertExternalBlock()
Dim InsertPoint(0 To 2) As Double
Dim insertEXTBlock As AcadExternalReference
Dim PathName As String
'Insert point
InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
'External drawing path which contains the blocks I want to insert
PathName = "C:\test.dwg"
'Add block to the drawing
Set insertEXTBlock = ThisDrawing.ModelSpace.AttachExternalReference(PathName, "B2", InsertPoint, 1, 1, 1, 0, False)
ThisDrawing.Application.ZoomAll
End Sub
Sub InsertExternalBlock()
Dim InsertPoint(0 To 2) As Double
Dim insertEXTBlock As AcadExternalReference
Dim PathName As String
'Insert point
InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
'External drawing path which contains the blocks I want to insert
PathName = "C:\test.dwg"
'Add block to the drawing
Set insertEXTBlock = ThisDrawing.ModelSpace.AttachExternalReference(PathName, "B2", InsertPoint, 1, 1, 1, 0, False)
ThisDrawing.Application.ZoomAll
End Sub