{"id":1333,"date":"2022-01-04T21:38:19","date_gmt":"2022-01-05T05:38:19","guid":{"rendered":"https:\/\/gantovnik.com\/bio-tips\/?p=1333"},"modified":"2022-01-04T21:38:19","modified_gmt":"2022-01-05T05:38:19","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-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-2-2-2\/","title":{"rendered":"#247 Create a procedure with default arguments in tcl"},"content":{"rendered":"<p>An example of a procedure with procedure with default arguments is <\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nproc add {a {b 2000} } {\r\n  return &#x5B;expr $a+$b]\r\n}\r\nputs &#x5B;add 22 10]\r\nputs &#x5B;add 22]\r\n<\/pre>\n<p>Result:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n32\r\n2022\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>An example of a procedure with procedure with default arguments is proc add {a {b 2000} } { return &#x5B;expr $a+$b] } puts &#x5B;add 22 10] puts &#x5B;add 22] Result: 32 2022<\/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-1333","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-lv","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":753,"url":"https:\/\/gantovnik.com\/bio-tips\/2020\/10\/127-tcl-function-with-default-arguments\/","url_meta":{"origin":1333,"position":0},"title":"#126: tcl function with default arguments","author":"gantovnik","date":"2020-10-08","format":false,"excerpt":"#126: tcl function with default arguments [code language=\"python\"] proc add {a {b 5}} { return [expr $a+$b] } puts [add 10 12] puts [add 12] [\/code] Output: [code language=\"python\"] 22 17 [\/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":1333,"position":1},"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":1331,"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\/","url_meta":{"origin":1333,"position":2},"title":"#246 Create a procedure with variable number of arguments in tcl","author":"gantovnik","date":"2022-01-04","format":false,"excerpt":"An example of a procedure with variable number of arguments is [code language=\"python\"] proc avg {numbers} { set sum 0 foreach number $numbers { set sum [expr $sum + $number] } set average [expr $sum\/[llength $numbers]] return $average } puts [avg {50 50 50 60}] puts [avg {50 50 50}]\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":[]},{"id":1327,"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\/","url_meta":{"origin":1333,"position":3},"title":"#244 Create a procedure in tcl","author":"gantovnik","date":"2022-01-04","format":false,"excerpt":"The syntax of creating a procedure is [code language=\"python\"] proc procedureName {arguments} { body } [\/code] Example: [code language=\"python\"] proc helloWorld {} { puts \"Hello, World!\" } helloWorld [\/code] Result: [code language=\"python\"] Hello, World! [\/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":1349,"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-2-2-2-2-2-2-2\/","url_meta":{"origin":1333,"position":4},"title":"#254 The switch operator in tcl","author":"gantovnik","date":"2022-01-05","format":false,"excerpt":"The switch command matches its string argument against each of the pattern arguments in order. Example: [code language=\"python\"] set thickness t2 switch $thickness { t1 { puts 0.01 } t2 { puts 0.02 } t3 { puts 0.03 } t4 { puts 0.04 } default { puts \"unknown\" } }\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":[]},{"id":781,"url":"https:\/\/gantovnik.com\/bio-tips\/2020\/11\/134-global-variable-in-tcl\/","url_meta":{"origin":1333,"position":5},"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":[]}],"_links":{"self":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1333","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=1333"}],"version-history":[{"count":0,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1333\/revisions"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=1333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=1333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=1333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}