07-11-2023
12:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
07-11-2023
12:58 AM
Hi @ysbaodnj,
Here is a small code that goes into each single parts contained in the assembly and add up all the part features, and also user created work planes, work axes and work points.
Dim Doc As Inventor.AssemblyDocument = ThisApplication.ActiveDocument
Dim AssyCompDef As Inventor.AssemblyComponentDefinition = Doc.ComponentDefinition
Dim Counter As Integer = 0
For Each Occ As Inventor.ComponentOccurrence In AssyCompDef.Occurrences.AllLeafOccurrences
Dim pDoc As Inventor.PartDocument = Occ.ReferencedDocumentDescriptor.ReferencedDocument
Dim PartCompDef As Inventor.PartComponentDefinition = pDoc.ComponentDefinition
Dim f As Integer = PartCompDef.Features.Count
Counter += f
Dim wp As Integer = PartCompDef.WorkPlanes.Count - 3
Dim wa As Integer = PartCompDef.WorkAxes.Count - 3
Dim p As Integer = PartCompDef.WorkPoints.Count - 1
Counter = Counter + wp + wa + p
Next
MsgBox(Counter)
The downside is that it doesn't add up the work planes, points, and axes created in an sub assembly. Only it's parts. Do we have to go further ?
Kind regards,
FINET L.
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"