- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a very wierd issue that i have been battling with.
I currently had a C# method that i was using for Plotting. the method works fine when i call it from a CommandMethod (off of the base class)but when i try calling it from a usercontrol i get an exception of NullObjectID. it crashes on
"Layout layout = Tx.GetObject(layoutMgr.GetLayoutId(layoutMgr.CurrentLayout), OpenMode.ForWrite) as Layout;"
i have used user contols and PalleteSets and they both crash out. HELP
public void SimplePlot(string Pc3PrinterName)
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
using (Transaction Tx = doc.Database.TransactionManager.StartTransaction())
{
PlotSettingsValidator psvc = PlotSettingsValidator.Current;
LayoutManager layoutMgr = LayoutManager.Current;
Layout layout = Tx.GetObject(layoutMgr.GetLayoutId(layoutMgr.CurrentLayout), OpenMode.ForWrite) as Layout;
psvc.RefreshLists(layout);
Tx.Commit();
}
...
}
Solved! Go to Solution.