Community
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.
Solved by fieldguy. Go to Solution.
Can't find what you're looking for? Ask the community or share your knowledge.