Start a new topic

powerVault CAD BOM

Hello, 


I am looking to display the BOM for the main file as well as all the children assemblies in the CAD BOM tab, then export to csv. 


When following along the tutorial https://blog.coolorange.com/2017/03/03/cad-bom-via-powervault/ , the children assemblies are shown and the export csv button is functional. 


What changes are required in FileBOM.ps1 to display all BOM including children assemblies?



Thanks in advance,

Jeff

Capture.PNG
(50.2 KB)

Hello Jeff,

To be able to display the child assemblies you can use a loop where you execute a Get-VaultFileBom cmdlet on every component that you got with the first Get-VaultFileBom. Here is an example:

$file = Get-VaultFile -FileId $fileID

$bom = Get-VaultFileBOM -File $file._FullPath -GetChildrenBy ExactVersion #ExactVersion,LatestVersion,LatestReleasedVersion,LatestReleasedVersionOfRevision

foreach ($b in $bom) {

    $bom += Get-VaultFileBom -File $b._FullPath -GetChildrenBy ExactVersion #ExactVersion,LatestVersion,LatestReleasedVersion,LatestReleasedVersionOfRevision

}


Kind regards,

Manuel Cassan

Manuel,


Thanks for the quick response!


It looks to have worked for the first layer of children assemblies in the main assembly. Is it possible generate the BOM for the children's children assemblies as far down as they go? to get a comprehensive list of all parts involved? 


Also, when generating a Position number in the table for each item in the sorting section of FileBOM.ps1, is it possible to delimit the position column of the part based on the assembly it came from?? For example 1:1 is first part in first child assembly of main, 1:2:1 is first part in second assembly of main's first child, etc.


Something like the attached spreadsheet?


Thanks for your support,

Jeff

Capture.PNG
(60.5 KB)

Hello Jeff,

The cmdlet Get-VaultFileBom will get a recursive switch that will make it possible to get all children. At the moment the only possibility is to recreate the recursion yourself in the code. Please have a look at this sample code:

$wholeBom = Get-VaultFileBom -File $file._FullPath -GetChildrenBy LatestVersion

$check = $wholeBom

while ($check) {

    foreach ($bom in $check) {

        $b = Get-VaultFileBom -File $bom._FullPath -GetChildrenBy LatestVersion

        $wholeBom += $b

    }

    $check = $b

}


The Get-VaultFileBom cmdlet returns empty on failure or when a part is returned which has no BOM. this code will execute a Get-VaultFileBom on every file that gets returned until the $check variable is empty, which means the end is reached.


Kind regards,

Manuel Cassan


1 person likes this
Login or Signup to post a comment