Hi Guys,
I have a problem with a c# .net 2.0 AddIn I am writing for Inventor 2008. In a nutshell the AddIn needs to monitor files as they open, check/update their iProprerties then perform a save. However, since installing SP3 (also SP2 has the problem) when I issue a save from within the OnNewView Event, Inventor locks up then eventually crashes. This has previously been ok in Inventor 11 and Inventor 2008 SP0. I can reproduce the error with the code below:
void AppEvents_OnNewView(View ViewObject, EventTimingEnum BeforeOrAfter, NameValueMap Context, out HandlingCodeEnum HandlingCode)
{
try
{
if (BeforeOrAfter == EventTimingEnum.kAfter)
{
//Add a new iProperty
ViewObject.Document.PropertySets["{D5CDD505-2E9C-101B-9397-08002B2CF9AE}"].Add("Test2", "TestVal", null);
//Save the file
ViewObject.Document.Save();
}
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.ToString());
}
finally
{
HandlingCode = HandlingCodeEnum.kEventHandled;
}
}
No error is raised in the error trap and control is correctly handed back to Inventor which then locks up and crashes. If I run the code above but comment out the Save() it never crashes.
Whilst it seems strange to perform a save during the opening of a document it is essential the AddIn works this way.
Any ideas why this happens???
Many thanks,
Adrian.
Can't find what you're looking for? Ask the community or share your knowledge.