nainh
Automotive
- Nov 9, 2022
- 10
Hi I'm a junior designer and still new with CATIA Automation. I wrote a cat vbscript to rename my part once it has a new parameter "Dimension". The part number shall have additional Dimension.value into the name. As per image below I want the part name to become '01-01_16x33x50'
somehow my code doesn't work and i'm clueless why
code as per below:
Sub CATMain()
Set catDoc = CATIA.ActiveDocument
Set catPart = CatDoc.Part
Set objParameters = catPart.Parameters
For i = 1 To obj.Parameters.Count
Set objParameter = objParameter.Item(i)
str ParmName = objParameter.Name
str ParmValue = objParameter.ValueAsString
If Instr(i, strParmName, "Dimension") Then
CatDoc.Part.PartNumber = PartNumber & "_" & strParmValue
End If
End Sub
Hope I can have review from you guys. and I'm sorry if I'm complicating things up since I'm not sure if there is any simpler way of doing it so.
somehow my code doesn't work and i'm clueless why
code as per below:
Sub CATMain()
Set catDoc = CATIA.ActiveDocument
Set catPart = CatDoc.Part
Set objParameters = catPart.Parameters
For i = 1 To obj.Parameters.Count
Set objParameter = objParameter.Item(i)
str ParmName = objParameter.Name
str ParmValue = objParameter.ValueAsString
If Instr(i, strParmName, "Dimension") Then
CatDoc.Part.PartNumber = PartNumber & "_" & strParmValue
End If
End Sub
Hope I can have review from you guys. and I'm sorry if I'm complicating things up since I'm not sure if there is any simpler way of doing it so.