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.
- addframe position
- Add a frame at position. The path to the new frame is returned. Currently only 1 is valid for position, which creates a frame above the command window.
- 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 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 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.
- 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.
- 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.
- getframeworkstate
- Returns the state of the framework 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 menu.
- getrecentimports
- Returns the list of recent imports from the 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.
- 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.
- 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.
- removeframe position
- Removes the frame at position created using hm_framework addframe.
- 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 the menu.
- removerecentimport file
- Removes a recent import from the 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.
- 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;
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
if { [ catch {command_name...} ] } {
# Handle error
}
Version History
9.0
2020.1 - getuserprofile and loaduserprofile are now supported in batch mode.