{"id":10734,"date":"2026-04-30T13:40:40","date_gmt":"2026-04-30T20:40:40","guid":{"rendered":"https:\/\/gantovnik.com\/bio-tips\/?p=10734"},"modified":"2026-04-30T13:40:40","modified_gmt":"2026-04-30T20:40:40","slug":"get-current-hypermesh-model-name-using-tcl","status":"publish","type":"post","link":"https:\/\/gantovnik.com\/bio-tips\/2026\/04\/get-current-hypermesh-model-name-using-tcl\/","title":{"rendered":"#468 How to Get the Name of the Current Model Opened in HyperMesh Using Tcl"},"content":{"rendered":"<p data-start=\"75\" data-end=\"321\">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.<\/p>\n<p data-start=\"323\" data-end=\"440\">HyperMesh provides the command <code>hm_info currentfile<\/code>, which returns the full path of the currently opened model file.<\/p>\n<p data-start=\"323\" data-end=\"440\">Complete Example:<\/p>\n<pre class=\"lang:python decode:true \">set currentmodel [hm_info currentfile]\nset modelname [file tail $currentmodel]\nset dirname [file dirname $currentmodel]\n\nputs \"Current model full path: $currentmodel\"\nputs \"Current model name: $modelname\"\nputs \"Current model directory: $dirname\"<\/pre>\n<h3 data-section-id=\"6zzv5x\" data-start=\"1438\" data-end=\"1447\">Notes<\/h3>\n<p data-start=\"1449\" data-end=\"1686\" data-is-last-node=\"\" data-is-only-node=\"\">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.<\/p>\n<p data-start=\"323\" data-end=\"440\">\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_lmt_disableupdate":"no","_lmt_disable":"no","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[24,27,334],"tags":[336,338,337,23,335,43],"class_list":["post-10734","post","type-post","status-publish","format-standard","hentry","category-hypermesh","category-tcl","category-tcl-scripting","tag-altair-hypermesh","tag-cae-automation","tag-hm_info","tag-hypermesh","tag-hypermesh-scripting","tag-tcl"],"modified_by":"gantovnik","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8bH0k-2N8","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":2032,"url":"https:\/\/gantovnik.com\/bio-tips\/2024\/01\/403-get-nodes-for-all-elements-in-the-fem-model-in-hypermesh-using-tcl-script\/","url_meta":{"origin":10734,"position":0},"title":"#403 Get nodes for all elements in the FEM model in HyperMesh using tcl script","author":"gantovnik","date":"2024-01-13","format":false,"excerpt":"ex403.tcl Output file: ex403.txt","rel":"","context":"In &quot;HyperMesh&quot;","block_context":{"text":"HyperMesh","link":"https:\/\/gantovnik.com\/bio-tips\/category\/hypermesh\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6260,"url":"https:\/\/gantovnik.com\/bio-tips\/2024\/11\/452-save-selected-nodes-coordinates-to-csv-file-in-tcl-for-hypermesh\/","url_meta":{"origin":10734,"position":1},"title":"#452 Save selected nodes coordinates to*.csv file in tcl for HyperMesh","author":"gantovnik","date":"2024-11-26","format":false,"excerpt":"set script_path [ file dirname [ file normalize [ info script ] ] ] puts $script_path set output_file [file join $script_path \"nodes.csv\"] set file_id [open $output_file \"w\"] puts $file_id \"node_id,x,y,z\" *clearmark nodes 1 *createmarkpanel nodes 1 \"Select Nodes\" set selected_nodes [hm_getmark nodes 1] if {[llength $selected_nodes] == 0} { puts\u2026","rel":"","context":"In &quot;HyperMesh&quot;","block_context":{"text":"HyperMesh","link":"https:\/\/gantovnik.com\/bio-tips\/category\/hypermesh\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8057,"url":"https:\/\/gantovnik.com\/bio-tips\/2025\/02\/458-hypermesh-tcl-script-to-save-selected-node-ids-and-coordinates-to-a-csv-file\/","url_meta":{"origin":10734,"position":2},"title":"#458 HyperMesh tcl script to save selected node IDs and coordinates to a csv file","author":"gantovnik","date":"2025-02-20","format":false,"excerpt":"In this example, we create n=40 random nodes, select several of them, and save their node IDs and coordinates in a csv file. proc RandomReal {min max} { return [expr (rand()*($max-$min)+$min)] } set x_min 0.0 set x_max 20.0 set y_min 0.0 set y_max 10.0 set n 40 for {set i\u2026","rel":"","context":"In &quot;HyperMesh&quot;","block_context":{"text":"HyperMesh","link":"https:\/\/gantovnik.com\/bio-tips\/category\/hypermesh\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2025\/02\/2025-02-20_005944.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2025\/02\/2025-02-20_005944.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2025\/02\/2025-02-20_005944.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2025\/02\/2025-02-20_005944.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2025\/02\/2025-02-20_005944.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2025\/02\/2025-02-20_005944.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1727,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/12\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-2-2-2-2-2-2-2-2-2-3-2-2-2-2-2-2-2-2-2-2-4\/","url_meta":{"origin":10734,"position":3},"title":"#327 Creates nodes with coordinates from text file using HyperMesh Tcl","author":"gantovnik","date":"2022-12-14","format":false,"excerpt":"nodes.txt create_nodes.tcl","rel":"","context":"In &quot;HyperMesh&quot;","block_context":{"text":"HyperMesh","link":"https:\/\/gantovnik.com\/bio-tips\/category\/hypermesh\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/12\/ex327.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":4445,"url":"https:\/\/gantovnik.com\/bio-tips\/2024\/09\/447-command-loadsize-in-tcl-for-hypermesh\/","url_meta":{"origin":10734,"position":4},"title":"#447 Command *loadsize in tcl for HyperMesh","author":"gantovnik","date":"2024-09-16","format":false,"excerpt":"This command is deprecated but can be found in old tcl scripts. It is replaced with setoption load_size_magnitude, *setoption load_size_type,\u00a0setoption load_size_uniform *loadsize Sets the display size of loads. Syntax *loadsize config size option scale Inputs config The load config to set. Valid values are: 1 \u2013 forces 2 \u2013 moments\u2026","rel":"","context":"In &quot;HyperMesh&quot;","block_context":{"text":"HyperMesh","link":"https:\/\/gantovnik.com\/bio-tips\/category\/hypermesh\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2017,"url":"https:\/\/gantovnik.com\/bio-tips\/2024\/01\/402-find-edge-nodes-of-mesh-and-create-node-sets-for-each-edge-using-tcl-script-in-hypermesh\/","url_meta":{"origin":10734,"position":5},"title":"#402 Find edge nodes of mesh and create node sets for each edge loop using tcl script in HyperMesh","author":"gantovnik","date":"2024-01-07","format":false,"excerpt":"Assume we have this model: The script will find all edges and create set of nodes for each edge:","rel":"","context":"In &quot;HyperMesh&quot;","block_context":{"text":"HyperMesh","link":"https:\/\/gantovnik.com\/bio-tips\/category\/hypermesh\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/01\/ex402_3.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/01\/ex402_3.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/01\/ex402_3.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/10734","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/comments?post=10734"}],"version-history":[{"count":2,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/10734\/revisions"}],"predecessor-version":[{"id":10736,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/10734\/revisions\/10736"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=10734"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=10734"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=10734"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}