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.
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).
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.
getregisteredprocs event
  • before_exit
  • database_modified
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 HyperMesh 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.
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 HyperMesh client is activated.
  • 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 HyperMesh. Any other value will exit HyperMesh.
  • 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 HyperMesh client is deactivated.
  • graphics_selection_changes - Calls notify_proc with no arguments when any entity is selected or unselected in the modeling window.
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 HyperMesh. It determines if the frame is destroyed (false, default) or kept (true) when removing the tab. For HyperMesh 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
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_userprofile
  • before_exit
  • database_modified

Examples

This example creates a docked window that counts the number of elements in the mode and displays it in the window.
Note: The options used in the example have been deprecated and will be replaced by a new API in the future.
hm_createmark elems 1 advanced all;
set count [hm_marklength elems 1];
hm_markclear elems 1;

set f .summary
frame $f

hm_framework addpanel $f "Model Info";
hm_framework drawpanel $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
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
}

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.

2022 - Deprecated options addpanel, drawpanel, getrecentfiles, and getrecentimports. Removed options addrecentfile, addrecentimport, getmenustatus, getpulldowns, getregisteredprocs after_menudraw, getregisteredprocs before_menudraw, getregisteredprocs erase_userpanel, popgui, pushgui, registerproc after_menudraw, registerproc before_menudraw, registerproc erase_userpanel, removelabelsfrompulldowns, removerecentfile, removerecentimport, resetpulldowns, resizetab, setcmdstatus, setguigeom, setnativeheight, unregisterproc after_menudraw, unregisterproc before_menudraw, and unregisterproc erase_userpanel.