{"id":1327,"date":"2022-01-04T20:12:24","date_gmt":"2022-01-05T04:12:24","guid":{"rendered":"https:\/\/gantovnik.com\/bio-tips\/?p=1327"},"modified":"2022-01-04T20:12:24","modified_gmt":"2022-01-05T04:12:24","slug":"133-create-vectors-and-planes-using-tcl-in-hypermesh-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2","status":"publish","type":"post","link":"https:\/\/gantovnik.com\/bio-tips\/2022\/01\/133-create-vectors-and-planes-using-tcl-in-hypermesh-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2\/","title":{"rendered":"#244 Create a procedure in tcl"},"content":{"rendered":"<p>The syntax of creating a procedure is<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nproc procedureName {arguments} {\r\n  body\r\n}\r\n<\/pre>\n<p>Example:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nproc helloWorld {} {\r\n  puts &quot;Hello, World!&quot;\r\n}\r\nhelloWorld\r\n<\/pre>\n<p>Result:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nHello, World!\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The syntax of creating a procedure is proc procedureName {arguments} { body } Example: proc helloWorld {} { puts &quot;Hello, World!&quot; } helloWorld Result: Hello, World!<\/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-1327","post","type-post","status-publish","format-standard","hentry","category-tcl"],"modified_by":"gantovnik","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8bH0k-lp","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1047,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/11\/187-feet-to-meter-converter-using-python-tcl-tk\/","url_meta":{"origin":1327,"position":0},"title":"#187 Feet to meter converter using python tcl\/tk","author":"gantovnik","date":"2021-11-07","format":false,"excerpt":"[code language=\"python\"] package require Tk wm title . \"Feet to Meters\" grid [ttk::frame .c -padding \"3 3 12 12\"] -column 0 -row 0 -sticky nwes grid columnconfigure . 0 -weight 1; grid rowconfigure . 0 -weight 1 grid [ttk::entry .c.feet -width 7 -textvariable feet] -column 2 -row 1 -sticky we\u2026","rel":"","context":"In &quot;tcl&quot;","block_context":{"text":"tcl","link":"https:\/\/gantovnik.com\/bio-tips\/category\/tcl\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex187.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":781,"url":"https:\/\/gantovnik.com\/bio-tips\/2020\/11\/134-global-variable-in-tcl\/","url_meta":{"origin":1327,"position":1},"title":"#134 Global variable in tcl","author":"gantovnik","date":"2020-11-12","format":false,"excerpt":"#134 Global variable in tcl [code language=\"python\"] set f \"This is a global variable\"; #This procedure cannot access the global variable f. proc testproc1 { } { catch {puts $f} val; puts $val; } #This procedure can access the global variable f using the global command. proc testproc2 { }\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":783,"url":"https:\/\/gantovnik.com\/bio-tips\/2020\/11\/135-global-namespace-in-tcl\/","url_meta":{"origin":1327,"position":2},"title":"#135 Global namespace in tcl","author":"gantovnik","date":"2020-11-12","format":false,"excerpt":"#135 Global namespace in tcl It is possible to reference global variables inside procedures using global namespace indicator: [code language=\"python\"] set ::element_list \"1 2 3 4 5\"; proc ::element_info {} { puts $::element_list; set ::node_list \"10 20 30 40\"; puts $::node_list; } element_info; 1 2 3 4 5 10 20\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":1333,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/01\/133-create-vectors-and-planes-using-tcl-in-hypermesh-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2\/","url_meta":{"origin":1327,"position":3},"title":"#247 Create a procedure with default arguments in tcl","author":"gantovnik","date":"2022-01-04","format":false,"excerpt":"An example of a procedure with procedure with default arguments is [code language=\"python\"] proc add {a {b 2000} } { return [expr $a+$b] } puts [add 22 10] puts [add 22] [\/code] Result: [code language=\"python\"] 32 2022 [\/code]","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":[]},{"id":1329,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/01\/133-create-vectors-and-planes-using-tcl-in-hypermesh-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2\/","url_meta":{"origin":1327,"position":4},"title":"#245 Create a procedure with multiple arguments in tcl","author":"gantovnik","date":"2022-01-04","format":false,"excerpt":"An example for procedure with multiple arguments is [code language=\"python\"] proc add {a b} { return [expr $a+$b] } puts [add 2000 22] [\/code] Result: [code language=\"python\"] 2022 [\/code]","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":[]},{"id":2219,"url":"https:\/\/gantovnik.com\/bio-tips\/2024\/06\/431-hypermesh-python-script-to-create-nodes-using-coordinates-from-csv-file\/","url_meta":{"origin":1327,"position":5},"title":"#431 HyperMesh python script to create nodes using coordinates from csv file","author":"gantovnik","date":"2024-06-24","format":false,"excerpt":"Finally, I read how to write a script for HyperMesh in python. In this example, the script reads the coordinates of points from a cvs file. [code language=\"python\"] import os import hm import hm.entities as e from hwx import gui import csv model=hm.Model() os.chdir(r\"D:\\projects\\wordpress\\ex431\") with open('ex431_coordinates.csv', mode ='r') as file:\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\/2024\/06\/ex431.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1327","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=1327"}],"version-history":[{"count":0,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1327\/revisions"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=1327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=1327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=1327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}