HRESULT 0x80004005 (E_FAIL) when running iLogic rule on BeforeSave event

HRESULT 0x80004005 (E_FAIL) when running iLogic rule on BeforeSave event

Anonymous
Not applicable
419 Views
1 Reply
Message 1 of 2

HRESULT 0x80004005 (E_FAIL) when running iLogic rule on BeforeSave event

Anonymous
Not applicable

I have a rule that used to work just fine in Inventor 2017 Professionnal that no longer works in Inventor 2019 & Inventor 2020.

 

The rule code is the following:

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("SUPPRESS_INVISIBLE_ITEMS").Activate(True)

I tested this with attached Assembly2.iam file, when hitting the save button I get the following error:

 

Error in rule: Rule1, in document: Assembly2.iam

Erreur non spécifiée (Exception from HRESULT: 0x80004005 (E_FAIL))

 

Stack trace:

System.Runtime.InteropServices.COMException (0x80004005): Erreur non spécifiée (Exception from HRESULT: 0x80004005 (E_FAIL))
   at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
   at Inventor.LevelOfDetailRepresentation.Activate(Boolean SkipDocumentSave)
   at ThisRule.Main()
   at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
   at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

This is an upgrade error from 2017 to 2019, so I would expect to get support from Autodesk.

 

 

0 Likes
420 Views
1 Reply
Reply (1)
Message 2 of 2

bradeneuropeArthur
Mentor
Mentor

Hi,

 

Since the LOD is not available in the assembly you need to add it first.

 

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

Try
	
oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Add("SUPPRESS_INVISIBLE_ITEMS")

Catch 
	

	oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("SUPPRESS_INVISIBLE_ITEMS").Activate(True)
	End Try

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes