Message 1 of 4
activating a design project fails

Not applicable
01-04-2011
09:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Using Inventor 2009 and C# 2005, I'm getting "ArgumentException occurred" - "The parameter is incorrect" when i attempt to activate a design project. What I'm doing is switching the project for the duration of a batch process and then switching it back to what it was. Funny thing is, it works the first time the program code is ran; i only get the error when running the code again with the same inventor instance. if i restart inventor, i can run the code again once without problems.
the initial switch:
DesignProjectManager dpm = inventorApp.DesignProjectManager; DesignProject activeDesignProject = dpm.ActiveDesignProject; if (!activeDesignProject.FullFileName.Contains("Default.ipj")) { bool found = false; foreach (DesignProject dp in dpm.DesignProjects) if (dp.FullFileName.Contains("Default.ipj")) { found = true; dp.Activate(); // ERROR HERE break; } if (!found) FormInterface.Update("The default project was not found in the Design Project collection.\r\n"); }
the switch back:
if (dpm.ActiveDesignProject != activeDesignProject) activeDesignProject.Activate();
Again, the activations work the first time, but won't work again without restarting Inventor.
Any ideas?