{"id":1307,"date":"2022-01-04T01:47:06","date_gmt":"2022-01-04T09:47:06","guid":{"rendered":"https:\/\/gantovnik.com\/bio-tips\/?p=1307"},"modified":"2022-01-04T01:47:06","modified_gmt":"2022-01-04T09:47:06","slug":"133-create-vectors-and-planes-using-tcl-in-hypermesh-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\/","title":{"rendered":"#235 Transform list to variables in tcl"},"content":{"rendered":"<p>The syntax for copying values to variables is<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nlassign listname variable1 variable2.. variablen\r\n<\/pre>\n<p>Example:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nset list {orange blue red green}\r\nlassign $list var1 var2\r\nputs $var1\r\nputs $var2\r\n<\/pre>\n<p>Result:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\norange\r\nblue\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The syntax for copying values to variables is lassign listname variable1 variable2.. variablen Example: set list {orange blue red green} lassign $list var1 var2 puts $var1 puts $var2 Result: orange blue<\/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-1307","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-l5","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1298,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/01\/133-create-vectors-and-planes-using-tcl-in-hypermesh-2-2-2-2-2\/","url_meta":{"origin":1307,"position":0},"title":"#231 List item at index in tcl","author":"gantovnik","date":"2022-01-04","format":false,"excerpt":"The syntax for selecting list item at a specific index is [code language=\"python\"] lindex listname index [\/code] Example: [code language=\"python\"] set var {orange blue red green} puts [lindex $var 0] puts [lindex $var 1] puts [lindex $var 2] puts [lindex $var 3] [\/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":1307,"position":1},"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":[]},{"id":1309,"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\/","url_meta":{"origin":1307,"position":2},"title":"#236 Sorting a list in tcl","author":"gantovnik","date":"2022-01-04","format":false,"excerpt":"The syntax for sorting a list is [code language=\"python\"] lsort listname [\/code] Example: [code language=\"python\"] set var {orange blue red green} set var [lsort $var] puts $var [\/code] Result: [code language=\"python\"] blue green orange red [\/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":1302,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/01\/133-create-vectors-and-planes-using-tcl-in-hypermesh-2-2-2-2-2-2-2\/","url_meta":{"origin":1307,"position":3},"title":"#233 Replace items in list at indices in tcl","author":"gantovnik","date":"2022-01-04","format":false,"excerpt":"The syntax for replacing list items at specific indices is [code language=\"python\"] lreplace listname firstindex lastindex value1 value2..valuen [\/code] Example: [code language=\"python\"] set var {orange blue red green} set var [lreplace $var 2 3 black white] puts $var [\/code] Result: [code language=\"python\"] orange blue black white [\/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":1296,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/01\/133-create-vectors-and-planes-using-tcl-in-hypermesh-2-2-2-2\/","url_meta":{"origin":1307,"position":4},"title":"#230 Length of List in tcl","author":"gantovnik","date":"2022-01-03","format":false,"excerpt":"The syntax for length of list is [code language=\"python\"] llength listName [\/code] Example: [code language=\"python\"] set var {orange blue red green} puts [llength $var] [\/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":1294,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/01\/133-create-vectors-and-planes-using-tcl-in-hypermesh-2-2-2\/","url_meta":{"origin":1307,"position":5},"title":"#229 Appending Item to a List in tcl","author":"gantovnik","date":"2022-01-03","format":false,"excerpt":"The syntax for appending an item to a list is [code language=\"python\"] lappend listName value [\/code] Example: [code language=\"python\"] set var orange lappend var \"blue\" lappend var \"red\" lappend var \"green\" puts $var [\/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\/1307","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=1307"}],"version-history":[{"count":0,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1307\/revisions"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=1307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=1307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=1307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}