Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catia macro BOM to partproperties

Status
Not open for further replies.

Jurchek80

Mechanical
Jun 8, 2017
3
SI
Hi all,

I have the following Problem
I try to make a script to extract properties like quantity, positon number,... from BOM(billofmaterial)
and put them to part_properties
I need this data for further processing.

Can you someone help me please?

Thanks a lot

lp jure
 
Replies continue below

Recommended for you

tnx to reply ferdo

yes i found this
it is very usefull but i dont know how to extract data for exact part:
Code:
Sub CATMain()

Dim productDocument1 As Document
'Set productDocument1 = CATIA.ActiveDocument
Set productDocument1 = CATIA.

Dim product1 As Product
Set product1 = productDocument1.Product

Dim assemblyConvertor1 As CATBaseDispatch
Set assemblyConvertor1 = product1.GetItem("BillOfMaterial")

'Dim arrayOfVariantOfBSTR1(7) 'change number if you have more custom columns/array...
'arrayOfVariantOfBSTR1(0) = "Quantity"
'arrayOfVariantOfBSTR1(1) = "Part Number"
'arrayOfVariantOfBSTR1(2) = "Number"
'arrayOfVariantOfBSTR1(3) = "Nomenclature"
'arrayOfVariantOfBSTR1(4) = "Revision"
'arrayOfVariantOfBSTR1(5) = "Mass" 'in addition of what is by default
'arrayOfVariantOfBSTR1(6) = "Density"  'in addition of what is by default
'arrayOfVariantOfBSTR1(7) = "Material"  'in addition of what is by default

'assemblyConvertor1.SetCurrentFormat arrayOfVariantOfBSTR1

Dim arrayOfVariantOfBSTR2(3)  'change number if you have more custom columns/array...
arrayOfVariantOfBSTR2(0) = "Quantity"
arrayOfVariantOfBSTR2(1) = "Part Number"
arrayOfVariantOfBSTR2(2) = "Number"
arrayOfVariantOfBSTR2(3) = "Naziv"
assemblyConvertor1.SetSecondaryFormat arrayOfVariantOfBSTR2

assemblyConvertor1.Print "TXT", "c:\macro\Custom_BOM.txt", product1



Set xlApp = CreateObject("Excel.Application")

Set MyXL = GetObject(, "Excel.Application")

If Err.Number <> 0 Then ExcelWasNotRunning = True

Err.Clear

Set MyXL = GetObject("C:\macro\Book1.xls")
 
XLApp.Visible = True


Thanks a lot

lp jure
 
tnx ferdo

yes i need to write data (painted red) from BOM (maybe i can find this data somewhere else) to user defined properties(see picture down)
in ned to put "quantity" to kolicina
and "number" to pozicija

Code:
Dim arrayOfVariantOfBSTR2(3)  'change number if you have more custom columns/array...
arrayOfVariantOfBSTR2(0) = [COLOR=#EF2929]"Quantity"[/color]
arrayOfVariantOfBSTR2(1) = "Part Number"
arrayOfVariantOfBSTR2(2) = [COLOR=#EF2929]"Number"[/color]
arrayOfVariantOfBSTR2(3) = "Naziv"
assemblyConvertor1.SetSecondaryFormat arrayOfVariantOfBSTR2

Zajeta_slika_w1pcj4.jpg


regards
jure
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top