Get Part parameters from CATIA Assembly

Nikita Pelevin

Get Part parameters from CATIA Assembly

Hello!

I'm writing code that takes the Part name, File name, quantity and specific parameters from the Part. I used code to take this information and add it to the array. It's retrieving "Material" parameter, but it takes from wrong Part or randomly. And I don't understand why.

Part of my code:


Set ItemSelection = CATIA.ActiveDocument.Selection
Set Prod = CATIA.ActiveDocument.Product.Products
For i = 1 to Prod.Count
        For j = 1 to ItemSelection.Count
            If Prod.Item(i).Name = ItemSelection.Item(j).Reference.Name Then
                k = k + 1
                BOMTable(1,k) = Prod.Item(i).PartNumber
                BOMTable(2,k) = ItemSelection.Item(j).Reference.Name
                BOMTable(3,k) = CATIA.Documents.Item(j).Product.Parameters.Item("Material").Value
                BOMTable(4,k) = 1 
            End If
        Next
    Next

I'm attached Product tree and resulting table at Excel.

Attachments

  • Product_tree.jpg (74.4k)
  • table.jpg (171.8k)

Aaron Hinz

RE: Get Part parameters from CATIA Assembly
(in response to Nikita Pelevin)

I'm having the same problem, if you find an answer. Please let me know!

Nikita Pelevin

RE: Get Part parameters from CATIA Assembly
(in response to Aaron Hinz)

Yeah. I'm find solution.

At the code above need to replace string with below:

BOMTable(3,k) = Prod.Item(i).Parameters.Item("Material").Value