Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Edit CatScript for BoM generation

Status
Not open for further replies.

AndresXML

Automotive
Mar 26, 2022
2
0
0
DE
Hi,

I've got the following CatScript that generates an excel file with the BoM of an active product. I need to edit it in order to include products within the main product, not just parts. Right now, the resulting excel file only lists parts.

Code:
Language="VBSCRIPT"

Sub CATMain()

Set wshShell = CreateObject("WScript.Shell")
strDesktopPath = wshShell.SpecialFolders("Desktop")

Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set assemblyConvertor1 = product1.GetItem("BillOfMaterial")

Dim arrayOfVariantOfBSTR1(4)
arrayOfVariantOfBSTR1(0) = "Part Number"
arrayOfVariantOfBSTR1(1) = "Product Description"
arrayOfVariantOfBSTR1(2) = "Quantity"
arrayOfVariantOfBSTR1(3) = "Definition"
arrayOfVariantOfBSTR1(4) = "Nomenclature"
assemblyConvertor1.SetSecondaryFormat arrayOfVariantOfBSTR1

Set assemblyConvertor2 = product1.GetItem("BillOfMaterial")

Dim arrayOfVariantOfBSTR2(4)
arrayOfVariantOfBSTR2(0) = "Part Number"
arrayOfVariantOfBSTR2(1) = "Product Description"
arrayOfVariantOfBSTR2(2) = "Quantity"
arrayOfVariantOfBSTR2(3) = "Definition"
arrayOfVariantOfBSTR2(4) = "Nomenclature"

assemblyConvertor2.SetSecondaryFormat arrayOfVariantOfBSTR2

assemblyConvertor2.[Print] "XLS", strDesktopPath & "\BoM.xls", product1

End Sub

I can't figure out what I need to change.

Any tips?
Thanks
 
Status
Not open for further replies.
Back
Top