{"id":1349,"date":"2022-01-05T18:33:10","date_gmt":"2022-01-06T02:33:10","guid":{"rendered":"https:\/\/gantovnik.com\/bio-tips\/?p=1349"},"modified":"2022-01-05T18:33:10","modified_gmt":"2022-01-06T02:33:10","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-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-2-2-2-2-2-2-2\/","title":{"rendered":"#254 The switch operator in tcl"},"content":{"rendered":"<p>The switch command matches its string argument against each of the pattern arguments in order.<\/p>\n<p>Example:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nset thickness t2\r\nswitch $thickness {\r\n    t1 { puts 0.01 }\r\n    t2 { puts 0.02 }\r\n    t3 { puts 0.03 }\r\n    t4 { puts 0.04 }\r\n    default { puts &quot;unknown&quot; }\r\n}\r\n<\/pre>\n<p>Result:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n0.02\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The switch command matches its string argument against each of the pattern arguments in order. Example: set thickness t2 switch $thickness { t1 { puts 0.01 } t2 { puts 0.02 } t3 { puts 0.03 } t4 { puts 0.04 } default { puts &quot;unknown&quot; } } Result: 0.02<\/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-1349","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-lL","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1311,"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\/","url_meta":{"origin":1349,"position":0},"title":"#237 Create a dictionary in tcl","author":"gantovnik","date":"2022-01-04","format":false,"excerpt":"A dictionary is an arrangement for mapping values to keys. The syntax for the conventional dictionary is [code language=\"python\"] dict set dictname key value # or dict create dictname key1 value1 key2 value2 .. keyn valuen [\/code] Example: [code language=\"python\"] dict set thicknesses t1 0.1 puts $thicknesses dict set thicknesses\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":1321,"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\/","url_meta":{"origin":1349,"position":1},"title":"#241 Get all keys in dictionary in tcl","author":"gantovnik","date":"2022-01-04","format":false,"excerpt":"The syntax for retrieving all keys in dict is [code language=\"python\"] [dict keys $dictname] [\/code] Example: [code language=\"python\"] set thicknesses [dict create t1 0.1 t2 0.2 t3 0.25] set keys [dict keys $thicknesses] puts $keys [\/code] Result: [code language=\"python\"] t1 t2 t3 [\/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":1313,"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\/","url_meta":{"origin":1349,"position":2},"title":"#238 Get size of a dictionary in tcl","author":"gantovnik","date":"2022-01-04","format":false,"excerpt":"The syntax for getting size of dict is [code language=\"python\"] [dict size dictname] [\/code] Example: [code language=\"python\"] set thicknesses [dict create t1 0.1 t2 0.2] puts [dict size $thicknesses] [\/code] Result: [code language=\"python\"] 2 [\/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":1315,"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\/","url_meta":{"origin":1349,"position":3},"title":"#239 Dictionary iteration in tcl","author":"gantovnik","date":"2022-01-04","format":false,"excerpt":"A dictionary iteration for printing keys and values of the dictionary is [code language=\"python\"] set thicknesses [dict create t1 0.1 t2 0.2 t3 0.25] foreach item [dict keys $thicknesses] { set value [dict get $thicknesses $item] puts $value } [\/code] Result: [code language=\"python\"] 0.1 0.2 0.25 [\/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":1318,"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\/","url_meta":{"origin":1349,"position":4},"title":"#240 Get a value for a key in dictionary in tcl","author":"gantovnik","date":"2022-01-04","format":false,"excerpt":"The syntax for retrieving value for a key in dict is [code language=\"python\"] [dict get $dictname $keyname] [\/code] Example: [code language=\"python\"] set thicknesses [dict create t1 0.1 t2 0.2 t3 0.25] set value [dict get $thicknesses t3] puts $value [\/code] Result: [code language=\"python\"] 0.25 [\/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":1323,"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\/","url_meta":{"origin":1349,"position":5},"title":"#242 Get all values in dictionary in tcl","author":"gantovnik","date":"2022-01-04","format":false,"excerpt":"The syntax for retrieving all values in dict is [code language=\"python\"] [dict values $dictname] [\/code] Example: [code language=\"python\"] set thicknesses [dict create t1 0.1 t2 0.2 t3 0.25] set values [dict values $thicknesses] puts $values [\/code] Result: [code language=\"python\"] 0.1 0.2 0.25 [\/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":[]}],"_links":{"self":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1349","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=1349"}],"version-history":[{"count":0,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1349\/revisions"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=1349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=1349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=1349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}