Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have this code that works perfectly, but as soon as I suppress an assembly the rule will no longer work and I get an error. "Error in rule: Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))"
Works fine with suppressed parts.
Any ideas?
Sub Main() Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument Call Iterate(oAsmDoc.ComponentDefinition.Occurrences, 1) End Sub Private Sub Iterate(Occurrences As ComponentOccurrences, Level As Integer) 'Iterate through Assembly Dim oOcc As ComponentOccurrence For Each oOcc In Occurrences 'Find Parts in Assembly Dim Part As String Part = oOcc.Name 'Set parameter Try Parameter(Part, "ConExL")=ConExL Catch End Try Try Parameter(Part, "TotalBedLength")=TotalBedLength Catch End Try Try Parameter(Part, "Join")=Join Catch End Try 'Run through the sub assemblies If oOcc.DefinitionDocumentType = kAssemblyDocumentObject Then Call Iterate(oOcc.SubOccurrences, Level + 1) InventorVb.DocumentUpdate() End If Next End Sub
Inventor 2018

Solved! Go to Solution.