Inventor Customization

Active Member
Posts: 10
Registered: ‎02-08-2010
Message 1 of 1 (170 Views)

How to troubleshoot cause of exception from Inventor._Document.Update()?

170 Views, 0 Replies
05-06-2010 04:59 AM

For some drawings, but not all, I get an exception from Inventor._Document.Update() and would appreciate some troubleshooting help.

The exception I get is a COMException with "Catastrophic failure" (E_UNEXPECTED). I would like to get some more details why it fails, but I have no idea how to troubleshoot further.

First some background. I want to programmatically rename a drawing and some files it references.

For instance, I have a drawing "x.idw", containing an assembly "y.iam". The assembly contains a part "z.ipt". So, I have a hierarchy like:

x.idw -> y.iam -> z.ipt

After renaming, I want the names to be:

x2.idw -> y2.iam -> z2.ipt

I run this code in an Inventor Addin (implementing ApplicationAddInServer), so I run this in process and I use the normal inventor API (Apprentice is not involved). I have a button that I press to run my code.

I start with no open documents. Then I programmatically open 1 file at the time with Documents.Open(filename, false); // false = open hidden

In this case with "x.idw -> y.iam -> z.ipt" my code would basically run the following scenario.

ReplaceReferences is a method that iterates file.ReferencedFileDescriptors and calls ReplaceReference with the new name.

_Document doc;

doc = Documents.Open("z.ipt");

doc = Documents.Open("y.iam");
ReplaceReferences(doc, "z.ipt", "z2.ipt");

doc = Documents.Open("x.idw");
ReplaceReferences(doc, "y.ipt", "y2.ipt");
doc.Update(); <== throws exception for some files.

If I leave doc.Update() out, I get a dialog after opening the drawing again that my model needs to be updated. That is why I added the call to doc.Update().

If I swallow the COMException from Update and continue with SaveAs and Close, I can open the document and all references seem to be changed. However, there is a "Red flash" icon on "Sheet1". The red flash icon has a hint that says that the model might need updating, but I have no idea about what to update.

Before my "renaming", the offending drawing doesn't have a red flash, so it seems like I'm causing the red flash to appear in some way.

My questions:
* How can I get more information about why Update() throws an exception? Or are there alternatives that are better than calling Update()?
* What does the "Red flash" icon mean?

Kind Regards,

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community

Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor