Sunday, March 29, 2015

How to create a parameter CATIA macro

This CATIA CATScript macro creates a new parameter in a CATPart file.

'####################################
Sub CATMain()
'set the active document (must be a CATPart)
Dim myDoc As Document
Set myDoc = CATIA.ActiveDocument

 'create an integer parameter
Dim thickness As IntParam
Set thickness = myDoc.Part.Parameters.CreateInteger ("Material Thickness", 2.0)

'create a real number parameter
Dim revision As RealParam
Set revision = myDoc.Part.Parameters.CreateReal("Revision", 2.5)

'create a string number parameter
Dim material As StringParam
Set material = myDoc.Part.Parameters.CreateString("Material", 2.5)


End Sub

For more, check out Scripting4v5.com.