# Get-VaultFileBOM Gets the Bill of Materials data from the CAD BOM of the specified file. ## Syntax ```powershell Get-VaultFileBom -File -GetChildrenBy [] ``` ## Parameters | Type | Name | Description | Default value | Optional | |-------------------------------------------------------------------------------------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|----------| | String | File | Full path to the file | | no | | [BomModelStateType]() | ModelStateType | Indicates for which [model state]() representation of the Inventor file the BOM should be retrieved.
Possible options are *Master*, *All* or the name of the model state representation | Master | yes | | [BomRowVersionType]() | GetChildrenBy | Which version of the children should be retrieved.
Possible options are *ExactVersion*, *LatestVersion*, *LatestReleasedVersion* and *LatestReleasedVersionOfRevision* | ExactVersion | yes | ## Return type [FileBomRow[]](
) ← on success\ **empty** ← on failure ## Remarks The Cmdlet generates and provides the **Structured** file BOM and supports the following component types: - **Normal:**\  Components with type Normal have no special characteristics and are included in quantity calculations. - **Phantom:**\  Components with type Phantom are ignored in the BOM but their children are promoted and included in the quantity calculations.\ Multiple same components can end up at the same level in the bill of materials when they get promoted.\ They will end up as a single [FileBomRow](
) with summed quantities. - **Reference:**\  Components with type Reference and their children are ignored in the BOM and are treated as if they do not exist. Read more about the different BOM structures [here](). For Inventor files with multiple [model states]() the Bill of Materials of all the different design representations can be retrieved.\ These can differ, for example, by suppressed components (which are not returned) or model state components with different part numbers. Individual component instances which have different [Instance Properties]() assigned are returned as single [FileBomRow]() when the "Merge Instance Rows" option is enabled in Inventor 2023 or newer. In situations where no CAD BOM information is available in Vault, the cmdlet behaves similar to the Vault "Assign Items" functionality.\ For Inventor files, for example, the Structured BOM View should be activated, otherwise [empty position numbers and row orders]() will be returned. Also, the cmdlet returns *emtpy* for *iAssembly and iPart factories*. The different child component search strategies can be specified via **GetChildrenBy** option.\ For strategies different than *ExactVersion*, it is possible that less [FileBomRows]() are returned when they where removed in the detected Vault file version.\ Like the Vault "Assign Items" functionality, also new components added in later Vault file versions are returned with empty position numbers and with row orders of 0. The cmdlet handles files with *missing CAD BOMs*, BOMs that contain references to *unresolvable* Vault files or removed *model states* by returning all the intact and the corrupted [FileBomRows]() with all the data it can provide. Accessing other properties can lead to exceptions. ## BomModelStateType | Name | Description | |----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------| | Master | By default only the [FileBomRows]() from the first model state entry, named *Master*, are returned. | | All | All the available model states are returned, even if they have the same part number or [delegated BOMs]().
Thus, such representations include also a *Master* model state component or components for automatically migrated Level Of Details or Substitute model states. | | {name of the model state} | Specify the name of a non-master model state (or Substitute model states) to retrieve its BOM representation. | :::{admonition} Known issue with Model States and Vault Client 2022 :class: warning When working with Inventor 2022 it is recommended to install the *Vault 2022.3 Update (Client)* or newer as several issues related to FileBOMs and Model States were addressed in the [Inventor Vault Add-in](). ::: ## BomRowVersionType | Name | Description | |---------------------------------|------------------------------------------------------------------------------------------------------------------------------------| | ExactVersion | Get the exact version of the component. | | LatestVersion | Get the latest version of the component. | | LatestReleasedVersion | Get the latest released version of the component. If no released version is found, the exact version is used. | | LatestReleasedVersionOfRevision | Get the latest released version from the same revision. If no released version is found in the Revision, the exact version is used.| ## Examples **Display the Structured file BOM for Pad Lock in Console** ```powershell $file = Get-VaultFile -Properties @{Name = "Pad Lock.iam"} $fileBom = Get-VaultFileBOM -File $file._fullPath #Print BOM data as Table like in Inventor $fileBom | sort-object {[int]$_.Bom_PositionNumber} | Format-Table Bom_PositionNumber,Bom_Number,Bom_Structure,Bom_Quantity,Bom_ItemQuantity,Bom_UnitQuantity,Bom_Unit <# Bom_PositionNumber Bom_Number Bom_Structure Bom_Quantity Bom_ItemQuantity Bom_UnitQuantity Bom_Unit ------------------ ---------- ------------- ------------ ---------------- ---------------- -------- 1 100002 Normal 1 1 1 Each 2 100004 Normal 1 1 1 Each 3 100005 Normal 1 1 1 Each 4 100006 Normal 1 1 1 Each 5 100008 Normal 1 1 1 Each 6 100011 Normal 1 1 1 Each 7 100010 Normal 1 1 1 Each 8 100003 Normal 1 1 1 Each 9 100012 Normal 1 1 1 Each 10 100016 Normal 1 1 1 Each 11 100009 Normal 1 1 1 Each #> ``` **Get the latest released file BOM data of assembly which includes new components in Phantom** ```powershell $fileBom = Get-VaultFileBOM -File "$/Designs/AssemblyWithPhantom.iam" -GetChildrenBy LatestReleasedVersion #Print BOM data of latest released component versions, including the promoted Phantom components $fileBom | Format-Table Bom_RowOrder,Bom_PositionNumber,Bom_Number,Bom_Structure,Bom_Quantity,Bom_ItemQuantity,Bom_UnitQuantity,Bom_Unit <# Bom_RowOrder Bom_PositionNumber Bom_Number Bom_Structure Bom_Quantity Bom_ItemQuantity Bom_UnitQuantity Bom_Unit ------------ ------------------ ---------- ------------- ------------ ---------------- ---------------- -------- 0 NewPart Normal 1 1 1 Each 2 5 Part2 Normal 2 2 1 Each #> ``` **Retrieve the file BOM for all assembly model states** ```powershell $file = Get-VaultFile -File '$/Designs/caster_w_MS.iam' if($file._HasModelState -eq $null -or $file._HasModelState -ne $true) { Write-Host "File $($file._Name) is not an Inventor file or has only one Master model state!" return } $allModelStates = Get-VaultFileBOM -File '$/Designs/caster_w_MS.iam' -ModelStateType All foreach($modelState in $allModelStates) { Write-Host "$($modelState._Name) ($($modelState.Bom_ModelState)): $($modelState.'Bom_Part Number')" -NoNewline $fileBom = Get-VaultFileBOM -File '$/Designs/caster_w_MS.iam' -ModelStateType $modelState.Bom_ModelState $fileBom | Format-Table Bom_RowOrder,Bom_PositionNumber,Bom_Number,Bom_Structure,Bom_ModelState,Bom_Quantity,Bom_ItemQuantity,Bom_UnitQuantity,Bom_Unit Write-Host "" } <# caster_w_MS.iam (Master): FP-1000 Bom_RowOrder Bom_PositionNumber Bom_Number Bom_Structure Bom_ModelState Bom_Quantity Bom_ItemQuantity Bom_UnitQuantity Bom_Unit ------------ ------------------ --------------- ------------- -------------- ------------ ---------------- ---------------- -------- 1 1 top plate Normal Master 1 1 1 Each 2 2 support arm Normal Simplified 2 2 1 Each 3 3 HEX FLANGE SREW Normal Welded 4 4 1 Each 4 4 bushing Normal Master 2 2 1 Each ... caster_w_MS.iam (Stage2): FP-3000 Bom_RowOrder Bom_PositionNumber Bom_Number Bom_Structure Bom_ModelState Bom_Quantity Bom_ItemQuantity Bom_UnitQuantity Bom_Unit ------------ ------------------ --------------- ------------- --------------- ------------ ---------------- ---------------- -------- 1 1 top plate Normal Master 1 1 1 Each 2 2 support arm Normal Simplified 2 2 1 Each 4 4 bushing Normal Face machining 1 1 1 Each #> ``` **Skip BomRows of unconditionally removed or erroneous file components** ```powershell $fileBom = ( Get-VaultFileBOM -File "$/Designs/CorruptFileBom.iam" -GetChildrenBy LatestVersion ) | foreach { try { $successfullyRetrievedBomNumber = $_ | Select-Object -ExpandProperty Bom_Number return $_ } catch { # Skip unconditionally removed or erronous file component, similar as Vault "Assign Items" functionality } } ```