- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This code runs fine in Inventor 2021 & Inventor 2023 if no part model state is used.
Fails in Inventor 2023 on any part that has a Model State.
Looking for a fix.
==============================================
'Run in any assembly (iam) with a part (ipt) that has an active Model State
'Fails in Inventor 2023 if a part (ipt) has an active Model State
'Fails on line "Dim refDoc As PartDocument = occ.Definition.Document"
'Error code: Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
'Runs fine in Inventor 2021, Runs fine in Inventor 2023 if all parts (ipt) do NOT have an active Model State
'Code is meant to cycle thru all parts and turn On/Off visibility based on File Name. Runs fine in Inventor 2021 and earlier.
Dim assemblyDef As AssemblyComponentDefinition = ThisDoc.Document.ComponentDefinition
Dim occ As Inventor.ComponentOccurrence
For Each occ In assemblyDef.Occurrences.AllLeafOccurrences
Dim refDoc As PartDocument = occ.Definition.Document
'MessageBox.Show("Full FileName " & refDoc.FullFileName, "TEST")
Next
Solved! Go to Solution.