Message 1 of 10
What's wrong with this code

Not applicable
01-15-2001
07:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm trying to nest a xref in a block. The code I wrote adds a line first, it
inserts a xref in the drawing but it does not nest it in the block. What do
I do wrong?
Thanks in advance,
Jan Appelman
LENGKEEK architecten en ingenieurs
Public Sub Nest_ExternalReference()
Dim InsertPoint(0 To 2) As Double
Dim PathName As String
' Define external reference to be inserted
InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
PathName = "p:\project\wijnreno\wrlogo.dwg"
' add block with nema "strStempel" to blockscollection
Dim objBlk As AcadBlock
Set objBlk = ThisDrawing.Blocks.Add(InsertPoint, "strStempel")
' add line to block
Dim entline As AcadLine
Dim stp(0 To 2) As Double
Dim eip(0 To 2) As Double
stp(0) = 0: stp(1) = 0: stp(2) = 0
eip(0) = 5: eip(1) = 5: eip(2) = 0
Set entline = objBlk.AddLine(stp, eip)
' add xref to block
Dim xrefLogo As AcadExternalReference
Set xrefLogo = objBlk.AttachExternalReference(PathName, "logo",
InsertPoint, 1#, 1#, 1#, 0, True)
' insert block
Dim blockRef As AcadBlockReference
Set blockRef = ThisDrawing.ModelSpace.InsertBlock(InsertPoint,
"strStempel", 1#, 1#, 1#, 0)
' Zoom all
ThisDrawing.Application.ZoomAll
End Sub
I'm trying to nest a xref in a block. The code I wrote adds a line first, it
inserts a xref in the drawing but it does not nest it in the block. What do
I do wrong?
Thanks in advance,
Jan Appelman
LENGKEEK architecten en ingenieurs
Public Sub Nest_ExternalReference()
Dim InsertPoint(0 To 2) As Double
Dim PathName As String
' Define external reference to be inserted
InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
PathName = "p:\project\wijnreno\wrlogo.dwg"
' add block with nema "strStempel" to blockscollection
Dim objBlk As AcadBlock
Set objBlk = ThisDrawing.Blocks.Add(InsertPoint, "strStempel")
' add line to block
Dim entline As AcadLine
Dim stp(0 To 2) As Double
Dim eip(0 To 2) As Double
stp(0) = 0: stp(1) = 0: stp(2) = 0
eip(0) = 5: eip(1) = 5: eip(2) = 0
Set entline = objBlk.AddLine(stp, eip)
' add xref to block
Dim xrefLogo As AcadExternalReference
Set xrefLogo = objBlk.AttachExternalReference(PathName, "logo",
InsertPoint, 1#, 1#, 1#, 0, True)
' insert block
Dim blockRef As AcadBlockReference
Set blockRef = ThisDrawing.ModelSpace.InsertBlock(InsertPoint,
"strStempel", 1#, 1#, 1#, 0)
' Zoom all
ThisDrawing.Application.ZoomAll
End Sub