Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I have assemly with subassemblies which have custom Property "MyNumber". I found how to sum all properties, but I need to filter some subassemblies in which I want to calculaate sum. Subassemblies which I want to filter have iProperties.Value("Summary", "Title") = MyNumber2. How can I first filter only subassemblies which have only this parameter and then sum their custom properties ?
'- - - - - - - - - - - sum the custom iProperty - - - - - - - - - - 'clear the custom property in the assembly iProperties.Value("Custom", "MyNumber") = 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("Custom", "MyNumber") 'custom property in the parts yNumber = iProperties.Value(oOccurrence.Name, "Custom", "MyNumber") sumNumber = xNumber + yNumber 'set custom property values iProperties.Value("Custom", "MyNumber") = sumNumber Else End If Next
Solved! Go to Solution.