@Jeff_M ,
Thanks for replying,
Unfortunately, I can't share the whole thing...
But, I can try to make a Slim-down...
I guess the one thing I can try is to create a new project from scratch and add the code in...
The main portion, that fails, looks like:
using IAeccDoc = Autodesk.AECC.Interop.UiLand.IAeccDocument;
using IAeccDB = Autodesk.AECC.Interop.Land.IAeccDatabase;
using AeccApp = Autodesk.AECC.Interop.UiLand.AeccApplication;
using IAeccApp = Autodesk.AECC.Interop.UiLand.IAeccApplication;
using IAeccUDPClass = Autodesk.AECC.Interop.Land.AeccUserDefinedPropertyClassifications;
using IAeccUDP = Autodesk.AECC.Interop.Land.AeccUserDefinedProperty;
...
// Modal Command with localized name
public int SummaryTables(String fileName, bool includecosts = false, bool clean = false)
{
...
IAeccDB aeccdb = IAeccDBInstance;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
}
// ***************************************************************************************
[CommandMethod(CMD_GROUP_EDSA, CMD_SUMMARY, "SUMMARY", CommandFlags.Modal)]
public void SummaryTables()
{ // Should be called as : _COGOSUMBYDKS
try
{
SummaryTables(MISSING_PARAMETER_INDICATOR);
}
catch (System.Exception ex)
{
HandleException(ex, CMD_SUMMARY);
}
}
[LispFunction(CMD_SUMMARY, "SUMMARYLspId")]
public int SummaryTableslLsp(ResultBuffer args)
{ // Should be called as : (PARCELSUM "C:/TEMP/XXXCogo.html")
int retVal = 0;
String stringParam1 = MISSING_PARAMETER_INDICATOR;
try
{
if (args != null)
{
Array argsArray = args.AsArray();
if (argsArray.Length > 0)
{ stringParam1 = Convert.ToString(((TypedValue)(argsArray.GetValue(0))).Value); }
}
retVal = SummaryTables(stringParam1);
}
catch (System.Exception ex)
{
HandleException(ex, "_COGOSUMBYDKS(lsp)");
}
return retVal;
}
...
public static AeccApp CurrAeccAppInstance()
{
Autodesk.AECC.Interop.UiLand.AeccApplication retVal = new Autodesk.AECC.Interop.UiLand.AeccApplication();
// This is what fails^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if(retVal != null)
{
retVal.Init((Autodesk.AutoCAD.Interop.AcadApplication)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication);
}
return retVal;
}
public static IAeccDB CurrIAeccDBInstance()
{
IAeccDB retVal = null;
AeccApp currapp = CurrAeccAppInstance();
if (currapp != null)
{
IAeccDoc currdoc = (IAeccDoc)currapp.ActiveDocument;
if (currdoc != null)
{
retVal = (IAeccDB)currdoc.GetType().GetProperty("Database").GetValue(currdoc, null);
}
}
return retVal;
}
// ****************************************************************************
private AeccApp _AeccApp = null;
protected AeccApp AeccAppInstance
{
get
{
if (_AeccApp == null)
{ // https://forums.autodesk.com/t5/civil-3d-customization/aeccxuiland-aeccapplication/td-p/8775478
_AeccApp = CurrAeccAppInstance();
}
return _AeccApp;
}
}
protected IAeccDoc AeccDocInstance
{
get
{
if (AeccAppInstance != null)
{ return (IAeccDoc)AeccAppInstance.ActiveDocument; }
return null;
}
}
private IAeccDB _AeccDB = null;
protected IAeccDB IAeccDBInstance
{
get
{
if (_AeccDB == null)
{
IAeccDoc currdoc = AeccDocInstance;
if (currdoc != null)
{
_AeccDB = (IAeccDB)currdoc.GetType().GetProperty("Database").GetValue(currdoc, null);
}
}
return _AeccDB;
}
}