Sending an API command while Inventor is busy causes crash; how to fix?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm writing a C# application using the Inventor 2016 API to automate the creation of some custom assembly drawings. After making only subtractive changes to an assembly model (removing components) and calling AssemblyDocument.Update2(true), Inventor labors for anywhere from 2-5 minutes performing the model update. Now here's the problem: as soon as Update2 is called, the .NET application is ready to send another command to Inventor, but for those following few minutes during the update operation, Inventor is "unresponsive," showing Windows 7's "spinning blue swirl" (though not truly unresponsive in the Win32 sense, where Task Manager would show it as such). The next command I call after Update2 is AssemblyDocument.SaveAs("path", true), but this crashes Inventor unless I wait those few minutes for it to finish its update.
So far I have tried:
- Looking at System.Diagnostics.Process.Responding. It is always true during the update operation.
- Looking at Inventor.Application.CommandManager.ActiveCommand. This is always the default command. (cf https://forums.autodesk.com/t5/inventor-customization/check-inventor-is-idle/m-p/6017453)
- Using a timer to delay call of the SaveAs method. This works, but is an unacceptably fragile solution.
It seems to me that this must be an issue encountered before, but I'm not really finding any information out there. Anyone with some insight? Thanks!