I want to get 2 parameters in "bill of material". first "Length" in structure workbench, second is "quantity". I try to find these 2 parameters in
CATIA.Documents.Item(Document).Product.ReferenceProduct
But can't. I have an idea. I try find a way to get "Bill of material" into an array. I found a code write Bill of material to excel file.
On Error Resume Next
Dim productDocument1 As productDocument
Set productDocument1 = CATIA.ActiveDocument
Dim product1 As Product
Set product1 = productDocument1.Product
Dim assemblyConvertor1 As AssemblyConvertor
Set assemblyConvertor1 = product1.GetItem("BillOfMaterial")
assemblyConvertor1.[Print] "XLS", "D:\BOM.xls", product1
How to get "Bill of material" data into an array? Thanks
The length parameter of elements of the structure design apparently only available trough the StrComputeServices Example:
Sub CATMain()
Dim oRootProduct as Product
Dim oInstanceProduct as Product
Dim oStrWB as Workbench
Dim oStrServices As StrComputeServices
Set oRootProduct = CATIA.ActiveDocument.Product
Set oInstanceProduct = oRootProduct.Products.Item(1)
Set oStrWB = CATIA.ActiveDocument.GetWorkbench("StrWorkbench")
Set oStrServices = oStrWB.StrComputeServices
MsgBox CStr(oStrServices.GetLength(oInstanceProduct))
End Sub