Costin Ruja
Electrical
Good morning !
I need to link the native parameters in a part (part number, revision, definition...) to some other additional parameters which I have made.
I have a working script to generate these additional parameters, script that is made using the record function. It works fine, but then I have to input the formulas by hand.
Can you guys advise me how to make another script to automatically generate also the formulas ?
Below you can find the sample code to generate the additional parameters.
As for an example, how would the code look if i want to add some formulas which state
Part number = Cod specificatie
Description = Descriere
CATmaterial = Material
Best regards,
Costin Ruja
I need to link the native parameters in a part (part number, revision, definition...) to some other additional parameters which I have made.
I have a working script to generate these additional parameters, script that is made using the record function. It works fine, but then I have to input the formulas by hand.
Can you guys advise me how to make another script to automatically generate also the formulas ?
Below you can find the sample code to generate the additional parameters.
Code:
ub CATMain()Dim partDocument1 As Document
Set partDocument1 = CATIA.ActiveDocument
Dim product1 As CATBaseDispatch
Set product1 = partDocument1.GetItem("Part1")
Dim parameters1 As Parameters
Set parameters1 = product1.UserRefProperties
Dim strParam1 As StrParam
Set strParam1 = parameters1.CreateString("Denumire", "")
strParam1.ValuateFromString "Brida"
Dim parameters2 As Parameters
Set parameters2 = product1.UserRefProperties
Dim strParam2 As StrParam
Set strParam2 = parameters2.CreateString("Cod specificatie", "")
strParam2.ValuateFromString "16100-L2-001"
Dim parameters3 As Parameters
Set parameters3 = product1.UserRefProperties
Dim strParam3 As StrParam
Set strParam3 = parameters3.CreateString("Descriere", "")
strParam3.ValuateFromString "Foaie de carton electrotehnic gros 10mm"
Dim parameters4 As Parameters
Set parameters4 = product1.UserRefProperties
Dim strParam4 As StrParam
Set strParam4 = parameters4.CreateString("Nomenclator", "")
strParam4.ValuateFromString "Placi, blocuri, foi"
Dim parameters5 As Parameters
Set parameters5 = product1.UserRefProperties
Dim strParam5 As StrParam
Set strParam5 = parameters5.CreateString("Unitate de masura", "")
strParam5.ValuateFromString "kg"
Dim parameters6 As Parameters
Set parameters6 = product1.UserRefProperties
Dim strParam6 As StrParam
Set strParam6 = parameters6.CreateString("CATMaterial", "")
strParam6.ValuateFromString "IEC 60641-3-1 B 3.1A"
Dim parameters7 As Parameters
Set parameters7 = product1.UserRefProperties
Dim strParam7 As StrParam
Set strParam7 = parameters7.CreateString("Standard", "")
strParam7.ValuateFromString "Weidmann"
Dim parameters8 As Parameters
Set parameters8 = product1.UserRefProperties
Dim strParam8 As StrParam
Set strParam8 = parameters8.CreateString("Producator", "")
strParam8.ValuateFromString "…"
Dim parameters9 As Parameters
Set parameters9 = product1.UserRefProperties
Dim strParam9 As StrParam
Set strParam9 = parameters9.CreateString("ID", "")
strParam9.ValuateFromString "CuE"
Dim parameters10 As Parameters
Set parameters10 = product1.UserRefProperties
Dim realParam1 As RealParam
Set realParam1 = parameters10.CreateReal("Densitate", 0.000000)
realParam1.ValuateFromString "1250.1"
Dim parameters11 As Parameters
Set parameters11 = product1.UserRefProperties
Dim realParam2 As RealParam
Set realParam2 = parameters11.CreateReal("Volum brut", 0.000000)
realParam2.ValuateFromString "1250.1"
Dim parameters12 As Parameters
Set parameters12 = product1.UserRefProperties
Dim realParam3 As RealParam
Set realParam3 = parameters12.CreateReal("Volum net", 0.000000)
realParam3.ValuateFromString "1250.1"
Dim parameters13 As Parameters
Set parameters13 = product1.UserRefProperties
Dim realParam4 As RealParam
Set realParam4 = parameters13.CreateReal("Masa bruta", 0.000000)
realParam4.ValuateFromString "1250.1"
Dim parameters14 As Parameters
Set parameters14 = product1.UserRefProperties
Dim realParam5 As RealParam
Set realParam5 = parameters14.CreateReal("Masa neta", 0.000000)
realParam5.ValuateFromString "1250.1"
End Sub
As for an example, how would the code look if i want to add some formulas which state
Part number = Cod specificatie
Description = Descriere
CATmaterial = Material
Best regards,
Costin Ruja