Message 1 of 3
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)) from iLogic code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a snippet of code that I found to help sum up the costs of parts in an assembly and places the total into the estimated cost in the assembly's Estimated cost iProperty. This code works fine in some assemblies. When I try it in a larger upper level assembly, I get the Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)) error.
I've seen emails that say this is related to LOD. But have not seen a clear solution for this.
Code below:
SyntaxEditor Code Snippet
'clear the custom property in the assembly iProperties.Value("Project", "Estimated Cost") = 0 'set a reference to the assembly component definintion.'This assumes an assembly document is open. Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 'Iterate through all of the occurrences Dim oOccurrence As ComponentOccurrence For Each oOccurrence In oAsmCompDef.Occurrences 'check for and skip virtual components'(in case a virtual component trips things up) If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then 'custom property in the assembly xNumber = iProperties.Value("Project", "Estimated Cost") 'custom property in the parts yNumber = iProperties.Value(oOccurrence.Name, "Project", "Estimated Cost") sumNumber = xNumber + yNumber 'set custom property values iProperties.Value("Project", "Estimated Cost") = sumNumber Else End If Next