Mark,
Don't have much spare time, but ..
this
[CommandMethod("AsdkCmd1")]
static public void test()
{
Database controlDB = new Database();
PlotSettings pSet = new PlotSettings(true);
PlotInfo pInf = new PlotInfo();
PlotSettingsValidator pValid = PlotSettingsValidator.Current;
string plotControlDWG = @"c:\Scripter.dwg";
string pgSetupName = "CT1-A3MOD";
controlDB.ReadDwgFile(plotControlDWG, System.IO.FileShare.Read, false, string.Empty);
Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = controlDB.TransactionManager;
//controlDB.CloseInput(true);
using (Transaction trans = tm.StartTransaction())
{
DBDictionary dic = (DBDictionary)trans.GetObject(controlDB.PlotSettingsDictionaryId, OpenMode.ForRead);
foreach (DBDictionaryEntry dicEnt in dic)
{
if (dicEnt.Key == pgSetupName)
{
pSet = (PlotSettings)trans.GetObject(dicEnt.Value, OpenMode.ForRead, false);
}
}
trans.Commit();
}
pInf.Layout = LayoutManager.Current.GetLayoutId("Model");
pInf.OverrideSettings = pSet;
}
produces a different exception at this line ;
pSet = (PlotSettings)trans.GetObject(dicEnt.Value, OpenMode.ForRead, false);
************** Exception Text **************
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Autodesk.AutoCAD.Runtime.Exception: eDwgObjectImproperlyRead
at Autodesk.AutoCAD.DatabaseServices.TransactionManager.GetObjectInternal(AcDbTransactionManager* pTM, ObjectId id, OpenMode mode, Boolean openErased, Boolean forceOpenOnLockedLayer)
at Autodesk.AutoCAD.DatabaseServices.Transaction.GetObject(ObjectId id, OpenMode mode, Boolean openErased)
at ClassLibrary.kdubTestClass.test() in K:\Visual Studio 2005 Projects\_CAD\CsMgdAcad-TestPlotConfig_01\CsMgdAcad-TestPlotConfig_01\Class.cs:line 105
--- End of inner exception stack trace ---
perhaps something can be done with pSet.CopyFrom( ... ) .. but thats a W.A.G.
I'll play some more if I get a chance.
/// kwb