hm_framework

Controls certain options and of the HyperMesh GUI framework.

Syntax

hm_framework argument ?options?

Type

HyperMesh Tcl GUI Command

Description

This command allows you to update and query many aspects of the HyperMesh GUI framework. Depending on the argument specified, the supported options will change.

Inputs

activatetab name
Activates (raises) the tab named name.
addpanel name title
Add a frame named name to the list of panels that can be displayed over the HyperMesh panel area. title is displayed in the menu bar when the panel is displayed. Use hm_framework drawpanel to display the panel. The panel must contain a return button that calls hm_exitpanel in order to properly exit the panel.
addrecentfile file
Add a file to the list of recent files in the File > Recent Files menu. The full path of the file should be specified. Only the filename portion of the path will display in the menu.
addrecentimport file type
Add a file to the list of recent files in the File > Recent Imports menu. The full path of the file should be specified. The type argument defines the translator used to import the file. Only the filename portion of the path will display in the menu.
addtab name ?frame_name? ?width_proc? ?notify_proc? ?is_global?
Add a new tab named name.
If frame_name is not specified, name must be one of the standard HyperMesh tabs. If frame_name is specified, this indicates the name to be given to the parent frame that is created along with the tab. If frame_name is specified, width_proc can also be specified.
width_proc defines a procedure that is called when you double clicks the tab sash, resizing the frame to fit its contents. This procedure is passed one argument (the current width of the tab) and returns the new width of the tab. If width_proc is specified, notify_proc can also be specified.
notify_proc defines a procedure that is called when one of four tab events occurs:
  • before_activate
  • after_activate
  • before_deactivate
  • after_deactivate
Each of these events calls notify_proc with one argument (the event name).
is_global defines whether the tab should remain when switching between applications (1) or whether it should be destroyed (0, default).
drawpanel frame_name ?height?
Draw an existing frame over the HyperMesh panel area. The frame must have been added using hm_framework addpanel and must exist before running this command.
If ?height? is specified it can be set to "" (blank), -1, or a positive integer. Blank means do not change the panel height, -1 means use the standard (native) menu height, and a positive integer specifies the desired height. The default is -1. The framework will resize the panel area before drawing the frame.
formatwindowtitle string
Returns string formatted for the window title. This is used by user profiles to show a standard layout. It is used in conjunction with hm_wm title.
getactivetabs
Returns a list of active (raised) tabs. This only returns standard HyperMesh tabs, not tabs created using hm_framework addtab.
getalltabs
Returns a list of all tabs. This returns both standard HyperMesh tabs and tabs created using hm_framework addtab.
getcmdstatus
Returns the current visible status (0=off, 1=on) of the command window.
getgraphicsclick
After running with this option, a message is posted to "Move the mouse into the graphics region." You can move the mouse anywhere with no effects, as long as they never enter the modeling window. Once the mouse is moved inside the modeling window, a message to click on the screen is posted. At this point, if you move anywhere outside of the modeling window at all, the mode is exited and an empty string is returned. Right-clicking also forces an exit and returns an empty string. The first left click in the modeling window returns the x, y coordinates (relative to the entire screen) and exits the mode. If multiple monitors are used, the coordinates are returned relative to monitor 1. The return values are consistent with hm_winfo graphicx/graphicy options.
gethmtabs
Returns a list of the standard HyperMesh tabs.
getmenustatus
Returns the current visible status (0=off, 1=on) of the panel area.
getpulldowns
Returns the path to the HyperMesh menu.
getrecentfiles
Returns the list of recent files from the Files > Recent Files menu.
getrecentimports
Returns the list of recent imports from the File > Recent Imports menu.
getregisteredprocs event
Returns the list of procedures to be called when event occurs. Current supported events are:
  • after_menudraw
  • after_userprofile
  • before_exit
  • before_menudraw
  • database_modified
  • erase_userpanel
gettabframe name
Returns the frame associated with the tab named name.
getuserprofile
Returns the current user profile and user subprofile names. If no user profile is loaded, both values will return null. If there is no subprofile for the current profile, subprofile will be null.
These values can be utilized with hm_framework loaduserprofile.
Supported for both interactive and batch mode.
getvisibletabs
Returns a list of visible tabs. This returns both standard HyperWorks Desktop tabs and tabs created using the addtab option. This returns both visible tabs and tabs that exist but have their tab area turned off.
loaduserprofile profile subprofile after_proc
Loads a user profile with name profile.
subprofile defines the subprofile for profiles that have multiple subprofiles available (e.g. Abaqus, LS-DYNA, PAM-CRASH, Radioss, and so on). If no subprofile is required, double quotes must be specified "".
after_proc defines a procedure that will be run after the user profile is loaded. If no after_proc is required, double quotes must be specified "".
Supported for both interactive and batch mode.
popgui
Restore the size and position of the toplevel with the geometry saved by pushgui.
pushgui
Push (hide) the entire toplevel. Records the geometry so it can be restored with popgui.
registerproc notify_proc event
The procedure notify_proc will be added to a list of procedures to be called when event occurs. Current supported events are:
  • activate_gui - Calls notify_proc with no arguments when HyperWorks Desktop client is activated.
  • after_menudraw - Calls notify_proc with one argument (the panel name just drawn). This proc will be unregistered if it returns an error.
  • after_userprofile - Calls notify_proc with one argument (the name of the user profile that was loaded).
  • before_exit - Calls notify_proc with no arguments. It is recommended that you add a dialog or a prompt in notify_proc, prompting you if you want to exit or not. A return value of 1 from notify_proc will not exit HyperWorks Desktop. Any other value will exit HyperWorks Desktop.
  • before_menudraw - Calls notify_proc with one argument (the panel name to be drawn). This proc will be unregistered if it returns an error.
  • database_modified - Calls notify_proc with no arguments when any operation is performed that modifies the database. This has the potential for performance deprecation as the procedure is called for every database modification.
  • deactivate_gui - Calls notify_proc with no arguments when HyperWorks Desktop client is deactivated.
  • erase_userpanel - Calls notify_proc with the argument "TK Panel" whenever HyperMesh erases the User panel displayed using hm_framework drawpanel.
  • graphics_selection_changes - Calls notify_proc with no arguments when any entity is selected or unselected in the modeling window.
removelabelsfrompulldowns label_list
For each label in label_list, scan all menus that contain the label and delete it. This is used by user profiles to remove menu options.
removepanelsfrompulldowns panel_list
For each panel name in panel_list, scan all menus that contain the command hm_pushpanel panel and delete it. This is used by user profiles to remove panels.
removerecentfile file
Removes a recent files from theFile > Recent Files menu.
removerecentimport file
Removes a recent import from the File > Recent Imports menu.
removetab name
Remove tab named name. The associated frame still remains unless it is specifically destroyed. This command can be used with standard HM tabs as well as tabs created using hm_framework addtab.
force - This is an internal argument and must always be set to 0.
keep_frame - This is valid only for HyperWorks Desktop Desktop. It determines if the frame is destroyed (false, default) or kept (true) when removing the tab. For HyperWorks Desktop standalone this has no effect and the frame is always kept (true).
  • true - The tab is being kept by the framework
  • false - The tab is being destroyed by the framework
resetpulldowns
Reset the HyperMesh menu to its default state.
resizetab name width
Resize the tab area containing the tab named name and resize it to the specified width.
setcmdstatus status
Sets the visible status (0=off, 1=on) of the command window.
setguigeom size
Set the geometry size/position when restoring using the popgui option. Uses the same format for size as "wm geom", or a zero length string for "zoomed" (Windows only).
setnativeheight val
If val is set to -1, HyperMesh will automatically resize native (non TK) panels to their natural height when displayed (based on the menu font). If val is set to "" (blank), HyperMesh will not resize the modeling window. If <val> is set to a pixel value, HyperMesh will use this value to resize the panel area. Using this command along with the ?height? option to "drawpanel" allows user profiles to use different panel sizes for native panels and TK panels.
unregisterproc proc_name event
The procedure notify_proc will be removed from the list of procedures to be called when event occurs. Current supported events are:
  • after_menudraw
  • after_userprofile
  • before_exit
  • before_menudraw
  • database_modified
  • erase_userpanel

Examples

This example creates a panel that counts the number of elements in the mode and displays it on the panel. The return button on the panel will call hm_exitpanel.

hm_createmark elems 1 advanced all;
set count [hm_marklength elems 1];
hm_markclear elems 1;

set f .summary
frame $f
set top [frame $f.top];
pack $top -side top;
set bottom [frame $f.bottom];
pack $bottom -side bottom -fill x -expand 0;

label $top.label -text "Count of elements in model: $count";
pack $top.label
button $bottom.button -text "return" -command hm_exitpanel -bg #C06060;
pack $bottom.button -side right -anchor e;

hm_framework addpanel $f "Model Info";
hm_framework drawpanel $f;
Check if a tab exists. If so, raise it to the front. If not, create a new tab.
set alltabs [hm_framework getalltabs]

if {[lsearch $alltabs $title] != -1} {
    hm_framework activatetab "$title"
} else {
    set recess [frame .g_Model_Info -padx 7 -pady 7];
    hm_framework addtab "Model Info" $recess
}
Add a recent import to the pulldown menu:
hm_framework addrecentimport "C:/temp/optistruct.fem" "#optistruct\optistruct"

Errors

Incorrect usage results in a Tcl error. To detect errors, you can use the catch command:
if { [ catch {command_name...} ] } {
   # Handle error
}

Version History

2020.1 - getuserprofile and loaduserprofile are now supported in batch mode.

2021 - popgui, pushgui, removelabelsfrompulldowns, removepanelsfrompulldowns, resetpulldowns, setguigeom, and setnativeheight are deprecated in HyperWorks but continue to be supported in HyperWorks Desktop.

2021.2 - resizetab is deprecated in HyperWorks but continues to be supported in HyperWorks Desktop. addframe and removeframe options have been removed.

2022 - getpulldowns is deprecated in HyperWorks but continues to be supported in HyperWorks Desktop.