Creating a Parameter Group
- Create a Script group.
Right-click in the Groups Panel and choose Create Parameter from the menu.
The parameter is created with a default name and a default value of zero.
- Rename the Parameter.
Script Group and Parameter Example
This example shows how Parameter Groups can be used to modify the parameters of the Gear script.
- Insert the Gear snippet into an empty script.
- Save the script to a Script Group.
- Create a Parameter group as described above and name it "Teeth".
- Look for the variable "nTeeth" in the script and edit it as shown below.
- Click the 'Teeth' Parameter in the Groups Panel and change it to the original value of 20.
- Right-click the Script Group and choose Run Script from the menu to create a 20-tooth gear.
- Expand the Script Group node in the Groups Panel and see that it displays the current value of the Teeth parameter.
- By default, scripts run after you change a parameter value. Right-click the Script Group and choose Pause from the menu keep the script from running until you explicitly run it. The script icon in the Groups Panel now has a 'paused' icon.
- Change the Teeth parameter to 40 and see that the script group now has a yellow triangle in the Groups Panel to indicate that the Teeth parameter has changed.
- The snippet does not delete the current gear before it creates a new one. So, delete the current gear and rerun the script to create a 40-tooth gear.
- Right-click in the Groups Panel and create a new Parameter named "oRadius".
- Find the 'oRadius' variable in the script and edit as you did for the Teeth parameter.
- Change the parameter value to 0.02 to match the initial value in the script.
- Right-click the parameter and change the units to Length.
- Notice that the Parameter value changes to "20mm", indicating that the script assumes length units of Meters.
- Change the value to 30mm and change the number of teeth back to 20
- Delete the current gear
- Run the script to create a gear with 20 teeth and an outside radius of 30mm.