Use BOM functions to perform operations on the Bill of Material in an assembly.
You can override the calculated component quantity shown in the BOM. You can also export BOM data to Excel and other formats.
To access the BOM functions, expand the BOM node under the System tab in the Snippets area.
Export the BOM to an external file.
Syntax
ThisBOM.Export(“BOMViewName”, filename, format)
“BOMViewName”
The name that appears in a tab in the Inventor Bill of Materials dialog box. This value can be Model Data, Structured, or Parts Only. Enable the view you want to use before you run the rule for the first time (right-click on the tab in the BOM table).
filename
Name of the export file to create (with filename extension). If you do not specify a full path, the BOM is exported to the folder in which the assembly is stored. For an Excel export, the filename extension must be .xls (.xlsx is not supported).
format
Can be one of the following:
Examples
ThisBOM.Export("Parts Only", "Bom353.xls", kMicrosoftExcelFormat) ThisBOM.Export("Structured", "Bom631.xls", kTextFileTabDelimitedFormat) ThisBOM.Export("Structured", ThisDoc.ChangeExtension(".mdb"), kMicrosoftAccessFormat)
Overrides the quantity for a component. This function can be useful if you only show a few instances in the model, and the BOM lists the actual number. It is like opening the Bill of Materials dialog box, and then choosing "Static Quantity" instead of "Calculate Quantity” in the QTY column for a component.
Syntax
ThisBOM.OverrideQuantity(“Model Data”, partNumber, quantity)
The first argument names the BOM view and must always be "Model Data".
partNumber
The Part Number property of the component. This value shows up as a column in the BOM view.
quantity
Quantity to set for this component.
Example
ThisBOM.OverrideQuantity("Model Data", "Top Screw", 18)
Sets the BOM quantity back to the automatically calculated quantity.
Syntax
quantity = ThisBOM.CalculateQuantity(“Model Data”, “partNumber”)
Example
quantity = ThisBOM.CalculateQuantity("Model Data", "Top Screws")