Blog posts
Bio
by Clint Brown
I wanted to look at some common error messages in Inventor’s iLogic, and offer some advice on how to get around them.
There are 2 common errors that seem to crop up every now and then, and I thought I would offer some guidance on what the common causes are, and how you can do some basic de-bugging on iLogic.
Error Message One, looks like this “Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))”
This one is a bit of a red herring, as the error message is for an “unspecified error”. From my experience of this error, and from the Customer files I have looked at over the years, the most common causes are actually quite simple to fix.
In most cases I have seen this message pops up during a “File Save”, “File Save As”, a DXF Export (or other file conversion type).
There are a few things to look out for:
- Have you saved the file you are currently working on? Often the code will look at the current file name or file location before saving the file as a different file format etc. If the file has not been saved, it will not have a file name or save location.
- Do you have permission to write the file to the location specified in the code? Often iLogic code will contain a save path, you need to ensure that EVERY user that is using this code has permission to write to the save location
- Does the save path exist? Some code will specify a location for the files to be saved in, if the physical folders do not exist, you will
Error Message Two, looks like this “The active Level of Detail in YourAssembly.iam is not a custom Level of Detail”
This is a pretty easy one to solve too. This error message is a bit friendlier, as it is actually telling us what is wrong. It is being flagged up because the Level of Detail is set to Master. Master Levels of Detail (in most instances) cannot be changed though iLogic, the best practice is to create a Custom Level of Detail called “iLogic” and to set your model to this LOD before running any rules. This will avoid the error message.
From memory, I seem to remember that Inventor 2012 would also throw a .NET error (Unhandled Exception) if you tried to change the model when the LOD was set to “MASTER” the same workflow above applies.
Comments
3 comments
Sometimes rules in sub assemblies/parts fires unintentionally on save from the top assy. Is there a way to ad the rules to check wether they are read only and in that case don't fire the rule?
Hi David. Sounds like you have event triggers turned on. That makes things more difficult. What I do is "suppress" any rule that you do not want running automatically, you can alway run it manually or from another rule. I hope this helps you.
Hi Mr Brown,
I have a rule that measures the flat pattern extents and publish them in the description. You're right that I have this rule as an event trigger "before save" and it gives an error upon saving a read only file (ie not checked out from vault).
So a quickfix would be either let the rule check wether the files is read only and skip a part of the rule or trigger a rule if the file is readable? I was working on something like this to have it jump to end if It's read only.
Imports System.IO
Dim Filepath As String = "c:\\myFile.txt"
If (File.GetAttributes(Filepath)) Then
If (FileAttributes.ReadOnly = FileAttributes.ReadOnly) Then Goto End
End If
End If
'Go to flat pattern and measure & write to custom properties
Length = SheetMetal.FlatExtentsLength
Width = SheetMetal.FlatExtentsWidth
'Go back to folded view and update document
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
Dim oSMDef As SheetMetalComponentDefinition
oSMDef = oDoc.ComponentDefinition
oSMDef.FlatPattern.ExitEdit
InventorVb.DocumentUpdate()
End
Please sign in to leave a comment.