.NET

Reply
*pkirill
Message 1 of 1 (97 Views)

Problems with binding xrefs - Code Review Requested...

97 Views, 0 Replies
08-09-2005 08:08 AM

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
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.