Download presentation
Published byChester Hodges Modified over 9 years ago
1
Chapter 2: Introduction to HyperMesh Process Auomation
2
Fundamentals of HyperMesh Automation - Overview
Topics Presented: What is HyperMesh automation? Levels of automation, from basic to advanced The HyperMesh Utility Menu Files associated with the Utility Menu Running macros and Tcl/Tk scripts from the Utility Menu Exercise: Create Utility Menu button to run a user-created Tcl script In this chapter we will discuss what HyperMesh automation is and the different levels of automation available within HyperMesh. We will also examine the HyperMesh Utility menu, the files that are associated with it, and how to run macros and scripts from it.
3
What is HyperMesh Automation?
In general, it is an automatic or semi-automatic execution of a series of HyperMesh commands, steps or processes. Levels of Automation, from Basic to Advanced Level 1: HyperMesh macro Level 2: HyperMesh Tcl/Tk script Level 3: Altair Process Manager
4
Level 1: HyperMesh macro
Performs a HyperMesh action. It is a command file containing HyperMesh, mouse, and Templex commands. Some benefits Reduces user time and mouse clicks for lengthy and repetitive tasks. Creates custom HyperMesh environments Application examples One click shortcut to automesh panel, cleanup sub-panel, add point: point button One click tool turning on/off all of the geometry One click tool creating a component collector with a hard-coded name Limitations Cannot cancel execution or reject results of a macro A macro is not recursive; it cannot call itself
5
Level 2: HyperMesh Tcl/Tk Script
Publicly available, open-standard, interpreted scripting language Tcl/Tk is embedded in HyperMesh Some benefits Add logic and conditional control to HyperMesh macros Develop custom applications, including user-defined panels A Hypermesh Tcl/Tk script file contains HyperMesh macro commands HyperMesh Tcl commands Core Tcl/Tk commands Application examples Tool creating a solver material database Tool defining a HyperMesh panel Tool requesting user to specify load collector name and then creates the collector with that name if one does not already exist
6
Level 3: Altair Process Manager
Enables rapid development and deployment of process automation applications in the CAE domain It is a programmable personal workflow manager that guides users through standard work process Some benefits Standardize CAE processes Minimize CAE analysis set-up time Rerun previously-conducted CAE processes Provide integration with CAD, PDM systems, databases, intranets, and job submission systems Streamline CAE activities Establish and distribute “Best Practice” processes corporate wide
7
The HyperMesh Utility Menu
It contains HyperMesh-supplied macros and Tcl/Tk scripts It is customizable Add to it buttons with associated, user-created macros and Tcl/Tk scripts Located in the Tab area (View -> Utility Menu) Contains page selection buttons at bottom of menu A macro file (hm.mac) controls the display and available operations of the Utility Menu Attributes that you can change include: The Utility Menu page on which the operations appear. Text to be displayed on each control. Location and size of the menu. The help string to be displayed on the menu bar. The macro to call when each control is used.
8
Files Associated with the Utility Menu
hm.mac and [solver].mac files Base definitions file for default HyperMesh Utility menu or a solver user profile’s Utility menu, respectively The default hm.mac file sources the following additional macro files: disppage.mac Populates the Display page of the Utility Menu geommeshpage.mac Populates the Geom/Mesh page of the Utility Menu globalpage.mac Creates the button group that allows you to switch pages qamodelpage.mac Populates the QA/Model page of the Utility Menu userpage.mac Populates the User page of the Utility Menu The userpage.mac file is specifically reserved for user defined macros. May exist in the installation directory or in the directory from which HyperMesh launches. HyperMesh first looks for the userpage.mac file in the directory from which it launches and then in the installation directory. The userpage.mac is where we will be adding our macro definitions
9
Running Macros and Tcl/Tk Scripts from Utility Menu
Location for User-Created Macros Save them to your user-created userpage.mac file By default, macro menu’s User page is blank; it is reserved for user-created macros Location for User-Created Tcl/Tk Scripts Set environment variable, TCL_INCLUDE, containing list of path names to search before looking in default folder HyperMesh macros consist of valid command file or templex commands. To call a macro from the Utility menu, a button needs to be created. Button is located in the Utility menu. Button calls the appropriate macro using the *createbutton command.
10
*createbutton() Syntax:
*createbutton(page, name, row, column, width, COLOR, helpstring, macroName, [arg1…]) Page: page where button appears, values 1-n Name: text displayed on button Enclose with quotes (“ “) Use 12 to 24 characters depending on screen’s font scale or resolution Row: where button appears, values -1, 0, 1-n -1 is next available row plus one 0 is next available row # of visible rows depends on screen resolution Column: where button starts, values 0-10 Width: button’s width, values 1-10 COLOR: button’s color Colors: RED, BLUE, GREEN, CYAN, BUTTON, and MAGENTA Color’s spelling must be in uppercase Helpstring: string displayed in the bubble help for the button. MacroName: name of macro to call when button is selected Arg1…: list of one or more optional arguments passed to macro May have as many arguments as computer’s memory allows
11
Examples of Defined Macro Menu Buttons
Button calls user-created HyperMesh macro *createbutton(5, “Create force”, -1, 0, 10, GREEN, “Create force on selected nodes”, “createForce_macro”) Button calls HyperMesh-provided macro “EvalTcl” to evaluate user- created Tcl script *createbutton(5, “Create force”, -1, 0, 10, GREEN, “Create force on selected nodes”, “EvalTcl”, “create_force.tcl”)
12
Examples of Defined Macro Menu Buttons
Button calls user-created macro to evaluate user-created Tcl script *createbutton(5, “Create force”, -1, 0, 10, GREEN, “Create force on selected nodes”, “createForce_macro”, “create_force.tcl”) *beginmacro(“createForce_macro”) *evaltclscript($1,0) *endmacro() where *evaltclscript() runs a Tcl/Tk script *evaltclscript(filename, flag) Filename Tcl/Tk filename to run Flag flag to run command end functions, default = 0
13
Online Help
14
Practical Exercises Exercise 2a Description
Add a button to the User Page on the Utility Menu which executes the macro modeltour.tcl. This macro is located in the installation under hm\scripts, so a path is not needed. The name of the button should be “Model Tour”. The help string should be “Explore HyperMesh Session”. The color and location are up to you. HyperMesh commands used *createbutton() TCL/TK commands used none Hints On Windows, the working directory is located in the My Documents folder. Create a new text file called userpage.mac in this location and add the appropriate commands to make the button evaluate the tcl file.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.