{"id":525,"date":"2020-05-06T21:20:22","date_gmt":"2020-05-07T04:20:22","guid":{"rendered":"http:\/\/gantovnik.com\/bio-tips\/?p=525"},"modified":"2020-05-06T21:20:22","modified_gmt":"2020-05-07T04:20:22","slug":"tcl-script-that-prompts-the-user-to-select-nodes-and-displays-their-x-y-and-z-coordinates","status":"publish","type":"post","link":"https:\/\/gantovnik.com\/bio-tips\/2020\/05\/tcl-script-that-prompts-the-user-to-select-nodes-and-displays-their-x-y-and-z-coordinates\/","title":{"rendered":"Tcl script that prompts the user to select nodes and displays their x, y and z coordinates"},"content":{"rendered":"<p>Tcl script that prompts the user to select nodes and displays their x, y and z coordinates:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\n#An example is a Tcl script that prompts the user to select nodes \n#and displays their x, y and z coordinates:\nhm_markclear nodes 1\n*createmarkpanel nodes 1\nset nodes &#x5B;hm_getmark nodes 1]\nif { ! &#x5B; Null nodes ] } {\n    foreach node $nodes {   \n        set xVal &#x5B;hm_getvalue nodes id=$node dataname=x]\n        set yVal &#x5B;hm_getvalue nodes id=$node dataname=y]\n        set zVal &#x5B;hm_getvalue nodes id=$node dataname=z]\n        tk_messageBox -message &quot;Node $node = $xVal $yVal $zVal&quot;\n    }\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Tcl script that prompts the user to select nodes and displays their x, y and z coordinates: #An example is a Tcl script that prompts the user to select nodes #and displays their x, y and z coordinates: hm_markclear nodes 1 *createmarkpanel nodes 1 set nodes &#x5B;hm_getmark nodes 1] if { ! &#x5B; Null nodes [&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":"yes","_lmt_disable":"","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":[27],"tags":[],"class_list":["post-525","post","type-post","status-publish","format-standard","hentry","category-tcl"],"modified_by":null,"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8bH0k-8t","jetpack_likes_enabled":true,"jetpack-related-posts":[{"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":525,"position":0},"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":525,"position":1},"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":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":525,"position":2},"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 [code language=\"python\"] set script_path [ file dirname [ file normalize [ info script ] ] ] puts $script_path cd $script_path pwd *createmark elems 1 all set elemList [ hm_getmark elements 1 ] *clearmark elements 1 set outfile [open \"ex403.txt\" w] foreach elem_id $elemList { # Get the list of\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":943,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/09\/170-gets-the-distance-of-the-given-point-from-the-nearest-line-with-ids-specified-as-arguments-in-hypermesh-tcl\/","url_meta":{"origin":525,"position":3},"title":"#170 Gets the distance of the given point from the nearest line with IDs specified as arguments in HyperMesh tcl","author":"gantovnik","date":"2021-09-01","format":false,"excerpt":"#170 Gets the distance of the given point from the nearest line with IDs specified as arguments in HyperMesh tcl. To get closest to the point with coordinates (10, 20, 30) point on the line with ID 13: [code language=\"python\"] hm_getdistancefromnearestline [list 10 20 30] 13 [\/code] To get closest\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":1733,"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-2\/","url_meta":{"origin":525,"position":4},"title":"#328 Add labels with node coordinates using HyperMesh Tcl","author":"gantovnik","date":"2022-12-14","format":false,"excerpt":"nodes.txt [code language=\"python\"] 3.3 10 3 1.4 6 0 2.6 7 4 8.5 10 9 0.3 2 2 6.4 6 10 1.1 5 7 5.7 3 3 0.6 8 9 1.4 0 6 [\/code] create_nodes.tcl [code language=\"python\"] set script_path [ file dirname [ file normalize [ info script ] ]\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\/2022\/12\/ex328.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/12\/ex328.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/12\/ex328.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":527,"url":"https:\/\/gantovnik.com\/bio-tips\/2020\/05\/tcl-command-that-retrieves-the-x-component-of-a-force-of-id-12-defined-in-the-global-system\/","url_meta":{"origin":525,"position":5},"title":"Tcl commands","author":"gantovnik","date":"2020-05-06","format":false,"excerpt":"Tcl command that retrieves the x component of a force of ID 12 defined in the global system: [code language=\"python\"] set force_x [hm_getvalue loads id=12 dataname=comp1] [\/code] To retrieve the node that load 12 is applied to: [code language=\"python\"] set node_id [hm_getvalue loads id=12 dataname=node.id] [\/code] To retrieve the y\u2026","rel":"","context":"In &quot;tcl&quot;","block_context":{"text":"tcl","link":"https:\/\/gantovnik.com\/bio-tips\/category\/tcl\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/525","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=525"}],"version-history":[{"count":0,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/525\/revisions"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}