Catastrophic Failure iLogic Error When Opening Top Level Assembly

Catastrophic Failure iLogic Error When Opening Top Level Assembly

kwalker1
Enthusiast Enthusiast
1,218 Views
5 Replies
Message 1 of 6

Catastrophic Failure iLogic Error When Opening Top Level Assembly

kwalker1
Enthusiast
Enthusiast

Hi All,

 

I have a problem where the top level assembly (the General Arrangement assembly) is encountering an iLogic error despite the iLogic code running fine in its sub-assemblies.

 

I have attached a small simplified example of a model with the error.
Details of the model set-up and the issue are outlined below.

 

 

1. Model Structure
My model is driven from a single spreadsheet (which I have recently converted to a macro enabled spreadsheet) and is then linked to a single empty part file called PARAMETERS. This gives a single link between inventor and excel.


All the parts and assemblies are then linked back to the PARAMETERS part file rather than the spreadsheet.

 

 

2. Triggered iLogics
Within the sub-assemblies, I have three iLogic codes written and triggered in the following order:


1) Setting Level Of Detail
Code to set a custom level of detail called “Automated Model”. This is to enable the iLogic Rules code to run without error because a custom level of detail is required for the code.


2) Trigger For iLogic Rules
Code which looks at the last save date and time stamp within the spreadsheet then compare it against the EXCEL_SAVE_DATE iproperty. If the dates do not match, it then triggers the iLogic Rules code to run.
This is to prevent large amounts of code from needlessly running every time the model is opened.


3) iLogic Rules
Code to activate / suppress certain components depending on the spreadsheet selections.
At the end of the code, the EXCEL_SAVE_DATE iproperty is updated to match the last save date and time stamp within the spreadsheet.

 

Both the Setting Level Of Detail and Trigger For iLogic Rules are set to trigger After Open Document.
The Trigger For iLogic Rules is also set to trigger on Any Model Parameter Change.

 

 

3. Issue Encountered
The top level assembly (the GENERAL ARRANGEMENT assembly) is encountering the following error dialogue box.

 

iLogic Event-Driven Rule

Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

 

It appears that there may be a conflict between sub-assemblies because the error seems to occur if multiple sub-assemblies are triggered to run.

 

For example, if I remove the triggers in the attached FOUNDATIONS sub-assembly then open the GENERAL ARRANGEMENT assembly, the errors no longer occur.

 

If I place the Trigger For iLogic Rules code in a Try / Catch, this prevents the error from occurring when opening the model but the same error still appears if the Bill Of Materials dialogue box is opened in the GENERAL ARRANGEMENT assembly.

 

I have done many searches on this error which has returned varying suggestions on what causes it but none that I have found to help resolve it with my model.


If anyone can shed more light on what is causing the error and/or suggest a possible solution, then it would be greatly appreciated.

 

Regards,

Kurt.

0 Likes
1,219 Views
5 Replies
Replies (5)
Message 2 of 6

kwalker1
Enthusiast
Enthusiast

Sorry. I forgot to state what the actual code is.

The ilogic codes in the model are as follows and are located in each of the sub-assemblies.

 

1) Setting Level Of Detail

 

Try
'SETTING LEVEL OF DETAIL
Dim doc as AssemblyDocument = ThisDoc.Document
Dim oLOD As LevelOfDetailRepresentation
Dim oAsmCompDef As ComponentDefinition
oAsmCompDef = doc.ComponentDefinition
oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("Automated Model")
oLOD.Activate(True)
Catch
'END CODE TO PREVENT A BENIGN ERROR DIALOGUE BOX APPEARING WHEN OPENING BILL OF MATERIALS
End Try

 

2) Trigger For iLogic Rules

 

If iProperties.Value("Custom", "EXCEL_SAVE_DATE")<>GoExcel.CellValue("../iLogic Trigger Test\SPREADSHEET.xlsm", "Sheet1", "F1") Then
iLogicVb.RunRule("iLogic Rules")
End If

 

3) iLogic Rules

 

If Parameter("COLUMN_2_REQUIREMENT") = 0 Then
Component.IsActive("COLUMN 2:1") = False
ElseIf Parameter("COLUMN_2_REQUIREMENT") = 1 Then
Component.IsActive("COLUMN 2:1") = True
End If

iProperties.Value("Custom", "EXCEL_SAVE_DATE")=GoExcel.CellValue("../iLogic Trigger Test\SPREADSHEET.xlsm", "Sheet1", "F1")
0 Likes
Message 3 of 6

chrisjspower
Enthusiast
Enthusiast

I have been struggling with this exact issue, did you ever discover a solution? I have resolved to backup, and delete components, rules and triggers from the copy to try and determine the cause. The error message prevents me from doing anything in the Top assembly. So frustrating!

0 Likes
Message 4 of 6

HermJan.Otterman
Advisor
Advisor

maybe try stop using the .... LOD's, they realy give you problems!

also put your values not in an excel file but in a part and link that to you components. it will be quicker and more stable

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes
Message 5 of 6

chrisjspower
Enthusiast
Enthusiast

When I first started using inventor I thought excel was the way to go. Sure, for some things, but as your models become more complex with more parts it becomes increasingly unreliable. Many wasted hours of work dealing with LODs which are much the same. Too difficult and unreliable so I tend to kick them to the curb.

 

I am slowly deleting and rebuilding the components of my model. As soon as I uncover the solution to my particular problem I will repost here and on a new thread for anyone who has this issue in future.

0 Likes
Message 6 of 6

kwalker1
Enthusiast
Enthusiast

Hi chrisjspower,

The Level of Details are not the problem and are unavoidable if you need to suppress components.

From what I have found, the issue is in regards to multiple sub-assemblies containing iLogic code which refers directly back to the same spreadsheet.

 

To resolve the issue, have all your spreadsheet parameters link to a single empty part file then have your iLogic code refer back to these inventor part file parameters rather than directly back to the spreadsheet.

This essentially creates a single link between inventor and excel with the added benefit of increased model stability and more efficient model loading times.

 

For example, in my sample model above I had the sub-assemblies referring directly back to the spreadsheet for the last save date and time stamp.

By creating a Spreadsheet Last Save Date (SLSD) parameter in the list on Sheet 1 of the excel file, I was able to bring this date into the PARAMETERS part file. Having the iLogic code in multiple sub-assemblies refer back to the inventor PARAMETERS part file rather than the spreadsheet resolved the issue.

Refer to the newly attached sample model.

 

Revised Trigger For iLogic Rules Code:

If iProperties.Value("Custom", "EXCEL_SAVE_DATE") <> Parameter("SLSD") Then
iLogicVb.RunRule("iLogic Rules")
End If

Revised iLogic Rules Code:

If Parameter("COLUMN_2_REQUIREMENT") = 0 Then
Component.IsActive("COLUMN 2:1") = False
ElseIf Parameter("COLUMN_2_REQUIREMENT") = 1 Then
Component.IsActive("COLUMN 2:1") = True
End If

'UPDATE 3D MODEL & ZOOM ALL TO FIT WINDOW
'[
iLogicVb.UpdateWhenDone = True
ThisApplication.ActiveView.Fit
']

iProperties.Value("Custom", "EXCEL_SAVE_DATE") = Parameter("SLSD")

Hope this helps.

Cheers,

Kurt.

0 Likes