I posted this in the VBA group and got no
responses, so I thought I'd try here since I'm using VB.NET...
So if I open drawings and run -xref>B>* all xrefs bind
properly. I've
opened all xref's anyway and purged, unloaded, audited,
etc. And again, via
Xref Manager or Command Line all xrefs bind just
fine.
However, using:
dwg.sendcommand("-xref" & vbCr &
"Bind" & vbCr & "*" & vbCr)
or the code below, the binding
fails. This drawing has an xref'd border in
paperspace and 4 other
xrefs (two nested, but loaded) in modelspace. These
are pretty big drawings
(for us) - between 3 and 5MB when bound manually.
We are using AutoCAD
2005.
Can anyone offer me any suggestions for clearing this up?
Thanks for any
help!
Public Sub BindXref(ByVal
dwg)
dwg.purgeall()
dwg.save()
Dim blkMyBlock As
AcadBlock
Dim blkName As String
For Each blkMyBlock In
dwg.Blocks
On Error Resume Next
If blkMyBlock.IsXRef Then
If
Err().Number <> 0 Then
GoTo MOVEON1
End
If
dwg.Blocks.Item(blkMyBlock.Name).Bind(False)
End If
MOVEON1:
Next
blkMyBlock
dwg.purgeall()
For Each blkMyBlock In dwg.Blocks
On
Error Resume Next 'GoTo MOVEON
If blkMyBlock.IsXRef Then
If Err().Number
<> 0 Then
GoTo MOVEON2
End
If
dwg.Blocks.Item(blkMyBlock.Name).Bind(False)
End If
MOVEON2:
Next
blkMyBlock
dwg.PurgeAll()
On Error GoTo 0
End
Sub