Update-FLCBOM
Manipulates the BOM of an existing Item in Fusion 360 Manage.
Syntax
Update-FLCBOM -Workspace <String> -ItemId <Long> -Rows <Object[]> [<CommonParameters>]
<#
PARAMETER
-Workspace
Required true
-ItemId
Required true
-Rows
Required true
<CommonParameters>
This cmdlet supports the common parameters: ErrorAction, ErrorVariable
#>
Directly passing an Item object:
Update-FLCBOM -InputObject <PSObject> -Rows <Object[]> [<CommonParameters>]
<#
PARAMETER
-InputObject
Required true
Accepts pipeline input: true
-Rows
Required true
<CommonParameters>
This cmdlet supports the common parameters: ErrorAction, ErrorVariable
#>
Parameters
Type |
Name |
Description |
---|---|---|
String |
Workspace |
The name of the workspace that contains the header Item |
Long |
ItemId |
The ID of the BOM header Item |
InputObject |
The Fusion 360 Manage header Item. |
|
(Hashtable/PsObject)[] |
Rows |
Overrides all BOM line items with the passed BOM line items information |
Return type
BomRow[] ← on success.
empty ← on failure. Exception/ErrorMessage can be accessed using $Error.
Remarks
The Cmdlet can be used to add existing Items to a BOM, edit BOM line items and delete Items from a specific BOM in Fusion 360 Manage.
The passed -Workspace has to be configured properly and must allow linking the passed items.
In order to override the current BOM line items the -Rows argument allows passing BOM information for Items from different Workspaces that should be added or edited on the according header Item.
All the BOM items that are not present in the array will be deleted from the BOM (not from the Workspace).
The required information for linking Fusion 360 Manage Items can be passed using the Workspace
and Id
properties.
For BOM line items from revision-controlled workspaces, always the latest versions of the passed items are linked, even if work versions of the respective items are passed.
The argument allows passing the name and value for all the Standard BOM Fields and Custom BOM fields using the ‘Bom_’ prefix (e.g Bom_Quantity
) regardless of the used display names in the different BOM Views.
Only BOM Fields that are assigned to a View in the Bill of Materials Tab can be specified.
For those BOM fields which are not present in the Hashtable or PsObject, a configured default value is used when a new line item is added. For example auto-numbering is used when no Bom_PositionNumber
field is supplied
When editing existing BOM line items, the value in Fusion 360 Manage is kept untouched.
Additional information about the limitations and requirements of the possible BOM Field Types can be found here.
Not editable Fields
Fields that are not editable in the Bill of Materials Tab (e.g. computed Roll Up Fields) can not be updated using this cmdlet.
Examples
To use the examples below a Fusion 360 Manage PLM demo Tenant is required:
Update a BOM and its fields for an Item in Fusion 360 Manage
Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'
$bomRows = Update-FLCBOM -Workspace 'Products' -ItemId 7557 -Rows @(
@{
'Bom_PositionNumber'=1 #Field Type: Integer
'Workspace' = 'Products'
'Id'=7549
'Bom_Quantity'= 6.96 #Field Type: Float
},
@{
'Workspace' = 'Items'
'Id' = 8065
'Bom_CustomCheckbox' = $false #Field Type: Check Box
}
)
Override only specific line items in a BOM
Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'
$item = (Get-FLCItems -Workspace 'Items' -Filter '"699-00007 - BAC Mono mk1 custom steering wheel"')[0]
# all the filtered out items will be removed
$existingBomRows = ($item | Get-FLCBOM) | Where-Object { $_.Title -ne 'Push Button' }
$existingBomRows[0].Bom_Quantity = 2.0
$newBomRows = (Get-FLCItems -Workspace 'Items' -Filter '"Push Button"') | Select-Object -Property Workspace, Id, @{Name = 'Bom_Quantity'; Expression = {1.0}}
$bomRows = $item | Update-FLCBOM -Rows ($existingBomRows + $newBomRows)
Create a BOM and its associated Items in Fusion 360 Manage from the Structured BOM of a Vault File
Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'
$file = Get-VaultFile -Properties @{Name = 'Pad Lock.iam'}
$fileBom = Get-VaultFileBOM -File $file._FullPath
$flcBomRows = @()
foreach($fileBomRow in $fileBom) {
$flcBomRowItem = Add-FLCItem -Workspace 'Items' -Properties @{
'Title' = $fileBomRow._PartNumber
'PDM_UNIT_OF_MEASURE' = 'Each'
}
$flcBomRows += @{
'Id' = $flcBomRowItem.Id
'Workspace' = $flcBomRowItem.Workspace
'Bom_PositionNumber' = $fileBomRow.Bom_PositionNumber
'Bom_Quantity' = $fileBomRow.Bom_Quantity
}
}
$flcItem = Add-FLCItem -Workspace 'Items' -Properties @{'Title' = $file._PartNumber}
$flcBomRows = $flcItem | Update-FLCBOM -Rows $flcBomRows
Error handling, analyze why adding Items to a BOM failed using $Error
Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'
$childItems = Get-FLCItems -Workspace 'Items' -Filter 'ITEM_DETAILS:TITLE="Gear Shift Paddle"'
$bomRows = Update-FLCBOM -Workspace 'Items' -ItemId 8071 -Rows $childItems
if(-not $bomRows){
$Error[0].Exception # Returns "error.bom.cyclical: Saving these changes produces a cyclical BOM, this is not permitted"
}
Error handling, analyze why several bomRows could not be updated using $Error
Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'
$bomRows = Update-FLCBOM -Workspace 'Items' -ItemId 6862 -Rows @(
@{
'Workspace' = 'Items'
'Id'=8213
'Bom_PositionNumber'= "Invalid_Pos" #Invalid position number
},
@{
'Workspace' = 'Items'
'Id' = 0 #Invalid item Id
}
)
if(-not $bomRows){
$Error[0].Exception # Returns System.AggregateException: "One or more errors occurred."
$Error[0].Exception.InnerExceptions # Returns: "Input string was not in a correct format."
# "No Item found with the given id: 0."
}