I'm trying to alter a user selected parameter of a selected CATPart in an assembly via CADSelection. Ultimatelly this will go into a GUI in VBA and the user will, select the CATPart, open the macro and via the GUI change whatever parameters he requires. I've recorded the macro and tweaked around with this for a while now, but i can't seem to finish this.
My tree is:
Product;
-Part;
-Part_Teste_2;
-Part_Teste_3;
-Part_Teste_4;
-Part_Teste_5;
All of the above "Part_Teste" have 3 parameters one of them is called "Comprimento"
How do I change make sure that the macro alters the selected CATPArt's parameter instead of ("Part_Teste_3.CATPart")?
The macro that I have so far is:
Language="VBSCRIPT"
Sub CATMain()
Set oProductDoc = CATIA.ActiveDocument
Set oProd = oProductDoc.Product
Set oDocs = CATIA.Documents
Set oSelection = CATIA.ActiveDocument.Selection
If oSelection.Count < 1 then
MsgBox "Pick some components using cad selection.","No components were selected"
Else
Set oPartDoc = oDocs.Item("Part_Teste_3.CATPart")
Set oPart = oPartDoc.Part
Set oParam = oPart.Parameters
Set oLength = oParam.Item("Comprimento")
oLength.Value = 50.000000
End If
oSelection.Clear
oProd.Update
End Sub