Message 1 of 4
xRef coming in as unreferenced
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have the following section of code that attaches an xref but when it does it the xref says it is unreferenced. What am I doing wrong?
Thanks in advance.
Dim myDWG As Document = DocumentManager.MdiActiveDocument
Using myTrans As Transaction = myDWG.TransactionManager.StartTransaction
**There is other code here that works just fine but removed for clarity.***
Dim strFilePath As String = "Y:\_Projects\Active\2010\01201006.02\01201006.02.QC\" & strRedName_Layout & ".dwg"
Dim dwgEditor = myDWG.Editor
strRedName_Layout = "test"
Try
Using lock As DocumentLock = myDWG.LockDocument
Dim xrefObject As ObjectId = DocumentManager.MdiActiveDocument.Database.AttachXref(strfilepath, strRedName_Layout)
Dim blkTable As BlockTable = myTrans.GetObject(myDb.BlockTableId, OpenMode.ForRead, False)
Dim modelSpace As BlockTableRecord = myTrans.GetObject(myDb.CurrentSpaceId, OpenMode.ForWrite)
Dim blkTableRec As BlockTableRecord = CType(myTrans.GetObject(xrefObject, OpenMode.ForWrite), BlockTableRecord)
Dim blkRef As BlockReference = New BlockReference(New Point3d(0, 0, 0), xrefObject)
modelSpace.AppendEntity(blkRef)
myTrans.AddNewlyCreatedDBObject(blkRef, True)
End Using
Catch ex As Exception
MsgBox("ERROR " * Err.Description)
End Try
myTrans.Commit()
End Using