0% found this document useful (0 votes)
15 views14 pages

01 - Chapter 2 HyperMesh Process Automation Intro - 10template

The document provides an introduction to HyperMesh automation, outlining its levels from basic macros to advanced scripting with Tcl/Tk and the Altair Process Manager. It details the HyperMesh Utility Menu, including how to customize it with user-created macros and scripts, and provides examples of creating buttons to execute these commands. Practical exercises are included to reinforce the concepts presented.

Uploaded by

Kamlesh Jagtap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views14 pages

01 - Chapter 2 HyperMesh Process Automation Intro - 10template

The document provides an introduction to HyperMesh automation, outlining its levels from basic macros to advanced scripting with Tcl/Tk and the Altair Process Manager. It details the HyperMesh Utility Menu, including how to customize it with user-created macros and scripts, and provides examples of creating buttons to execute these commands. Practical exercises are included to reinforce the concepts presented.

Uploaded by

Kamlesh Jagtap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 14

Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

Chapter 2: Introduction to HyperMesh


Process Automation
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

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
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

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


Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

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
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

Level 2: HyperMesh Tcl/Tk Script

• Tcl/Tk
• 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
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

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
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

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.
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

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.
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

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.
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

*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 header message bar when button selected
• Enclose with quotes (“)
• MacroName: name of macro to call when button is selected
• Enclose with quotes (“)
• Arg1…: list of one or more optional arguments passed to macro
• May have as many arguments as computer’s memory allows
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

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”)
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

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
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

Online Help
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.

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.

You might also like