- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi guys..
I use this code for open in memory a dwg and attach an xref to it and save the dwg.
when I open the dwg with Autocad I can view the attached xref in the xref palette, but I can't view it in the drawing.
what am I doing wrong?
Dim xrefDb As Database = New Database(False, True)
xrefDb.ReadDwgFile(Item.ToString, FileShare.ReadWrite, False, "")
Using trx As Transaction = xrefDb.TransactionManager.StartTransaction()
Dim xrefBt As BlockTable = xrefDb.BlockTableId.GetObject(OpenMode.ForRead)
Dim btrMs As BlockTableRecord = xrefBt(BlockTableRecord.PaperSpace).GetObject(OpenMode.ForWrite)
Dim xrefObjId As ObjectId = xrefDb.AttachXref(NomeFileCart, Path.GetFileNameWithoutExtension(NomeFileCart))
Dim bref As New BlockReference(Point3d.Origin, xrefObjId)
btrMs.AppendEntity(bref)
trx.AddNewlyCreatedDBObject(bref, True)
xrefDb.CloseInput(True)
xrefDb.SaveAs(Item.ToString, DwgVersion.Current)
trx.Commit()
End Using
xrefDb.SaveAs(Item.ToString, DwgVersion.AC1032)
Solved! Go to Solution.
Link copied