When working with Tcl scripts in HyperMesh, it is often useful to get the name of the currently opened model file. For example, you may want to automatically create output files, reports, or logs using the same name as the active HyperMesh model.
HyperMesh provides the command hm_info currentfile, which returns the full path of the currently opened model file.
Complete Example:
|
1 2 3 4 5 6 7 |
set currentmodel [hm_info currentfile] set modelname [file tail $currentmodel] set dirname [file dirname $currentmodel] puts "Current model full path: $currentmodel" puts "Current model name: $modelname" puts "Current model directory: $dirname" |
Notes
This approach is useful when you want to write scripts that automatically save results or export files into the same folder as the active HyperMesh model. It also helps avoid hardcoding file names and directory paths in your Tcl scripts.
Last Updated on 2026-04-30 by gantovnik
Recent Comments