HM-8050: Create Forces on Nodes
In this tutorial you will create forces on nodes and add a button on the User page.
- Determine the commands to create forces on nodes
- Create a Utility menu macro to execute the commands
- Create a new button on the User page of the Utility menu to run the macro
In order to execute command file commands or Tcl scripts from a button on any of the HyperMesh Utility menu pages, a Utility menu macro must first be defined. A Utility menu macro contains valid command file or templex commands that execute the appropriate operations, and is defined using the *beginmacro and *endmacro commands. Macros may accept data passed to them using the arguments $1, $2, and so on. Each argument specifies where the values should be substituted. These macros are defined within the .mac files, including the userpage.mac file.
*beginmacro(macroname)
command statements go here
*endmacro()
Utility menu macros consist of HyperMesh Tcl modify commands.
Load collectors can be created and edited using the Model Browser. Simply right-click in the Model Browser and select to create one. To edit the name, color, or card image of a load collector, right -lick on the load collector name in the Model Browser and select Edit.
The Forces panel can be accessed from the menu bar by selecting .

Figure 1.
Delete Existing Command File
In this step you will delete the existing command file.
- Navigate to the current working directory and locate the file, command.tcl.
- Delete the file.
Perform Operations
In this step you will perform operations.
Every command issued in HyperMesh appears in the order executed and is reflected in the command file.
- From the menu bar, select and then load the file, c_channel-tcl.hm.
- Right-click in the Model Browser and select .
- In the name field, type forces.
- Click Create.
- Open the Forces panel.
- Activate the create subpanel.
-
Click nodes and select one node in the model.
- For the direction of the force, choose the z-axis option.
- For magnitude=, type 23.
- Toggle from magnitude % option to uniform size option for load size and set the value to 15.
- Click create.
Extract Commands
In this step you will extract the commands from the command file.
Create a Tcl Script
In this step you will create a Tcl script named create_force.tcl, convert the commands to Tcl format, and modify as necessary.
Create a Utility menu Macro
In this step you will create a Utility menu macro that runs a Tcl script.
Add the Macro Button
In this step, you will add a macro button to the User page.
Reload the Current File
In this step you will reload the current .mac file to load the modified userpage.mac.
Make sure to load the proper .mac file from the hm\scripts\<profile name> directory based on the current user profile, or load the default hm.mac in hm\bin\<platform> if no user profile is loaded.
Test the Macro
In this step, you will test the macro.