- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to write an iLogic app for processing bodies of the active Assembly.
My minimal goal is just to count unique bodies.
My current best bet is:
Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument Dim MsgBody As String="" Dim OccIndex As Integer=0 Dim BdQTY As Integer=0 For Each oOcc As ComponentOccurrence In oAsmDoc.ComponentDefinition.Occurrences BdQTY=BdQTY+oOcc.SurfaceBodies.Count OccIndex=OccIndex+1 MsgBody=MsgBody & "#" & OccIndex & ":" & vbCrLf & "Name : " & oOcc.Name & vbCrLf & "Type : " & oOcc.Type & vbCrLf & "BodyQTY = " & oOcc.SurfaceBodies.Count & vbCrLf & vbCrLf Next MsgBox(MsgBody,, BdQTY & " bodies found in " & oAsmDoc.ComponentDefinition.Occurrences.Count & " components:")
For standard sample weldment-assembly Carriage.iam it gives me wrong result (6 bodies) while expected is 10 bodies (reported by BSCT after pressing Ctrl+F7) :
I guess I have done at least two mistakes:
1. I am not skipping the body for duplicated occurences
2. I'm not counting bodies of sub-assemblies
and may be I should more carefully process weld-beads
As for 2 if I don't missed some easier way (some ready for use property) i probably need to add some recursion procedure (never did this before yet) , right?
Could please somebody point me in the right direction..
PS: My further goal - get body-complexity rating i.e.. report N (let say five) most complex bodies sorted for decreasing FaceCount
Please vote for Inventor-Idea Text Search within Option Names
Solved! Go to Solution.