Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have been trying to detach the Xrefs in a list of drawings and had no success. I open each one then I use this code. It does hit the db.detachXref(oid) line. No errors but does not detach it.
doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
ed = doc.Editor
db = doc.Database
Using lk As DocumentLock = doc.LockDocument()
Using tr As Transaction = db.TransactionManager.StartTransaction()
Dim bt As BlockTable = TryCast(tr.GetObject(db.BlockTableId, OpenMode.ForRead), BlockTable)
For Each oid As ObjectId In bt
Dim btr As BlockTableRecord = CType(tr.GetObject(oid, OpenMode.ForRead), BlockTableRecord)
If btr.IsFromExternalReference Then
db.DetachXref(oid)
End If
Next
End Using
End Using
Solved! Go to Solution.