Hi,
I am trying to save document in Engineering base by external application using Aucotec.Engineering.Interop and getting the Unable to cast exception.
Below is my code and also attached the error screenshot please refer to attachment and help me to solve the issue.
Thank you in advance
static void Main(string[] args)
{
Application application = new Application();
if (application == null)
{
Console.WriteLine("Engineering base client is not running !!"
;
Console.ReadKey();
return;
}
var currectObj =
application.Selection.Item(1);
if (currectObj != null)
{
var path = "pd2pid.xml";
var documnetEBML = currectObj.NewChild(
AucObjectKind.aucObjDocument, AucType.aucDocumentBlob);
documnetEBML.
Attributes.Add(AucAttribute.aucAttrDesignation, Path.GetFileName(path));
IAucExternalDocument ex = (IAucExternalDocument)(documnetEBML);
ex.AttachFile(path);
ex.Store();
documnetEBML.Store();
}
}
Regards,
Pushpendra Kumar
Haldor Topsoe