Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
wayne.brill
in reply to: Raider_71

Hi,

 

The BOM in the Inventor API is always based on the Master LOD and suppressing components do not change the listing in BOM. Maybe creating an iAssembly would meet your requirement. (Manage tab > Create iAssembly). This provides a way to include/exclude components and which reflects in BOM.

 

This link has steps explaining an iAssembly creation :
https://designandmotion.net/autodesk/mfg-pages/inventor/autodesk-inventor-iassembly-best-practices/


After you have created an iAssembly, a table will appear in the model browser that can be edited to include/exclude components. After you activate a table row, the updated BOM can be viewed.

 

 

Another approach would to use the Inventor API to iterate through all of the occurrences and export what you want from the occurrences to an Excel worksheet. An occurrence has a suppressed property so you could exclude the suppressed occurrences. See this VBA example in the help: AssemblyCount()

 

That example will fail on this line if there is a suppressed occurrence: "If oCompOcc.SubOccurrences.Count = 0 Then"

 

Edit the example with another If Else statement that checks the suppressed property to avoid that error:

>> >>

 For Each oCompOcc In oCompDef.Occurrences
   
        If oCompOcc.Suppressed = True Then
            Debug.Print oCompOcc.Name & "Suppressed = " & oCompOcc.Suppressed
            
        Else
        
        ' Check if it's child occurrence (leaf node)
        If oCompOcc.SubOccurrences.count = 0 Then
            Debug.Print oCompOcc.Name
            
            iLeafNodes = iLeafNodes + 1
        Else
            Debug.Print oCompOcc.Name
            iSubAssemblies = iSubAssemblies + 1
            Call processAllSubOcc(oCompOcc, _
                                sMsg, _
                                iLeafNodes, _
                                iSubAssemblies) ' subassembly
        End If
        End If
    Next

<< <<

 

 

The example in this post writes to an Excel worksheet. (not related to exporting a BOM)

http://adndevblog.typepad.com/manufacturing/2013/02/manipulate-rows-and-columns-of-ipart-1.html

 

 

Thanks,

Wayne

 



Wayne Brill
Developer Technical Services
Autodesk Developer Network