Code Red > .NET
Sync (refresh) a Sheet Set
pBe:
I found this on Autocad 2016 online help
Updates the sheet view components in the sheet set of the provided AcadDatabase object.
Syntax
Sync( pXDb As IAcadDatabase) As Object
I'm attempting to "refresh" the sheet view programmatically
--- Code - C#: ---Document acDoc = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument;Database acadDatabase = acDoc.Database; AcSmSheetSetMgr mgr = new AcSmSheetSetMgr(); AcSmDatabase db = new AcSmDatabase(); db.LockDb(db); AcSmSheetSet ss = db.GetSheetSet(); .......... db.UnlockDb(db, true); ss.Sync(acadDatabase); mgr.Close(db);
The above doesn't seem to work
The error shows
CS1503 Argument 1: cannot convert from 'Autodesk.AutoCAD.DatabaseServices.Database' to 'AXDBLib.AcadDatabase'
Question: How do i get to AXDBLib.AcadDatabase or convert the variable acadDatabase to its proper form?
Thank you in advance
pBe
Jeff_M:
object acadDatabase = acDoc.Database.AcadDatabase;
pBe:
I'll give it a try Jeff
Thanks
EDIT:
--- Code - C#: --- [CommandMethod("SheetViewWrite")] using AXDBLib; //<----- this public void SheetViewWrite() { Document acDoc = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument; // object acadDatabase = acDoc.Database.AcadDatabase; AcadDatabase acadDatabase = new AcadDatabase(); //<----- lets see if this works string ssFilePath = userInput("\nEnter Sheet Set Name: "); Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; AcSmSheetSetMgr mgr = new AcSmSheetSetMgr(); AcSmDatabase db = new AcSmDatabase(); try { db = mgr.OpenDatabase(ssFilePath, true); } catch (System.Exception ex) { ed.WriteMessage(ex.ToString()); return; } AcSmSheetSet ss = db.GetSheetSet(); ss.Sync(acadDatabase); /// <--- Here mgr.Close(db); }
Cant seem to recognize the object... Wonder what i'm missing? a reference file perhaps?
EDIT 2: Lets see if the above works..... updating
Sheet set NOT "refreshing" and now gives an error Error HRESULT E_FAIL has been returned from a call to a COM component.
at ACSMCOMPONENTS20Lib.IAcSmSheetSet.Sync(AcadDatabase pXDb)
pBe:
Hang on...
Syntax
Sync( pXDb As IAcadDatabase) As Object
IAcadDatabase <---- But its looking for 'AXDBLib.AcadDatabase' ?
I don't get it, the I means Interface or instance ?
Jeff_M:
Did you try this?:
AcadDatabase acadDatabase = acDoc.Database.AcadDatabase;
Navigation
[0] Message Index
[#] Next page
Go to full version