ILogic Errors

ILogic Errors

Stansteel
Enthusiast Enthusiast
1,801 Views
2 Replies
Message 1 of 3

ILogic Errors

Stansteel
Enthusiast
Enthusiast

Hello,

I have a few iLogic rules that are globally set to the "Before Save" trigger - some on parts and some on assemblies.  I'm having an issue where Inventor wants to save these documents, but tries and fails to run the iLogic.  I don't want it to even try in this scenario.

 

For example, if I'm working in a drawing (exclusively), Inventor may want to save an assembly - which triggers the "Before save" rule.  This is fine if the assembly is checked out of the vault and able to save.  However, if the assembly file is not checked out and/or locked, I get an "Error in rule: Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))".

 

In addition to this error, I also get a message from the "Assembly Bonus Tool" which reads "Please open/activate an assembly document to run this command".  I'm assuming this is because my iLogic rule includes the "Sort" command which sorts the browser list while working in an assembly - but it can't because I really don't have that document "open".

 

What I need is a way to NOT run these rules when I don't have the document active.  I've attached my rule for my assembly - would someone be able analyze my code and help?

 

Thanks,

 

Nate

0 Likes
Accepted solutions (1)
1,802 Views
2 Replies
Replies (2)
Message 2 of 3

dean.morrison
Advocate
Advocate
Accepted solution

Hi,

 

If you put an if statement at the top of your rule to check if the activedocument is an assembly, and only run the rule if so.

 

This should mean that it wont run the rule while you work in the drawing.

If ThisApplication.ActiveDocument.DocumentType = kAssemblyDocumentObject Then

Hope that helps.

 

Dean.

0 Likes
Message 3 of 3

Stansteel
Enthusiast
Enthusiast

That did it.  I knew it would be easy.  Thank you.

0 Likes