VBScripts
You can pass values between the simulation process and the VBScript by mapping parameters to the arguments of a function in the script. For example, you can use the script to create a Physics Simulation object and all of the features of a simulation, such the material definitions, the loads, and the FEM representation. You can control the value of simulation objects, such as loads, by passing parameters to the arguments of a function in the script.
Similarly, you could create a design of experiments that runs a simulation designed to measure the peak stress around a hole. You could control the diameter of the hole in the part in each simulation by passing in a radius parameter to a VBScript that runs a 3D Modeling app.
In most cases, you will create a VBScript by recording your actions while interacting with a dialog box in a CATIA 3D Modeling app. You should create a macro library of type PLM VBA projects in which to store your macro.
VBScript macros recorded from your interactions with a dialog box will be of type
MS VBA; however, by default no arguments are passed into
a recorded VBScript macro. To pass in arguments, you must edit the function
definition. The following example shows a Radius
argument that has
been added to the function definition:
Sub CATMain(Radius As Long)
You can define which parameters will be passed in as arguments to the function. Parameters appear in the 3DX Script editor in the same order in which they are passed into the function.
You cannot record your interactions with a physics simulation dialog box; however, you can create a VBScript macro that operates on a simulation by entering the commands into a text editor.