{"id":2235,"date":"2024-06-30T05:57:27","date_gmt":"2024-06-30T12:57:27","guid":{"rendered":"https:\/\/gantovnik.com\/bio-tips\/?p=2235"},"modified":"2024-06-30T05:57:28","modified_gmt":"2024-06-30T12:57:28","slug":"432-hypermesh-tcl-script-to-mark-and-print-all-adjacent-element-ids","status":"publish","type":"post","link":"https:\/\/gantovnik.com\/bio-tips\/2024\/06\/432-hypermesh-tcl-script-to-mark-and-print-all-adjacent-element-ids\/","title":{"rendered":"#432 Hypermesh tcl script to mark and print all adjacent element IDs"},"content":{"rendered":"<p><a href=\"https:\/\/gantovnik.com\/bio-tips\/2024\/06\/432-hypermesh-tcl-script-to-mark-and-print-all-adjacent-element-ids\/ex432\/\" rel=\"attachment wp-att-2236\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/06\/ex432.png?resize=1060%2C539&#038;ssl=1\" alt=\"\" width=\"1060\" height=\"539\" class=\"alignnone size-full wp-image-2236\" srcset=\"https:\/\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/06\/ex432.png 1060w, https:\/\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/06\/ex432-980x498.png 980w, https:\/\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/06\/ex432-480x244.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1060px, 100vw\" \/><\/a><\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n*createmark elements 1 &quot;all&quot;\r\n*numbersmark elements 1 0\r\n*clearmark elems 1\r\n*clearmark elems 2\r\n*createmarkpanel elems 1 &quot;Select elements&quot;\r\nset selected &#x5B;hm_getmark elems 1]\r\n*setoption force_text_black=1\r\n*setoption element_color_mode=2\r\n*numbersmark elements 1 1\r\nforeach ID $selected {\r\n     puts &quot;Selected elements ID:   $ID&quot;\r\n     #select attached\r\n     *createmark elems 1 $ID\r\n     *findmark elems 1 1 1 elems 0 2\r\n     puts &quot;Attached elements IDs: &#x5B;hm_getmark elems 2]&quot;\r\n     *numbersmark elements 2 1\r\n}\r\n<\/pre>\n<p>Output:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nSelected elements ID:   27\r\nAttached elements IDs: 17 18 22 25 26 28 30 32\r\nSelected elements ID:   47\r\nAttached elements IDs: 37 38 45 46 48 85 87 95\r\nSelected elements ID:   76\r\nAttached elements IDs: 65 66 73 74 75 105 106 112\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>*createmark elements 1 &quot;all&quot; *numbersmark elements 1 0 *clearmark elems 1 *clearmark elems 2 *createmarkpanel elems 1 &quot;Select elements&quot; set selected &#x5B;hm_getmark elems 1] *setoption force_text_black=1 *setoption element_color_mode=2 *numbersmark elements 1 1 foreach ID $selected { puts &quot;Selected elements ID: $ID&quot; #select attached *createmark elems 1 $ID *findmark elems 1 1 1 elems 0 2 [&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":[24,27],"tags":[23,43],"class_list":["post-2235","post","type-post","status-publish","format-standard","hentry","category-hypermesh","category-tcl","tag-hypermesh","tag-tcl"],"modified_by":"gantovnik","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8bH0k-A3","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":2017,"url":"https:\/\/gantovnik.com\/bio-tips\/2024\/01\/402-find-edge-nodes-of-mesh-and-create-node-sets-for-each-edge-using-tcl-script-in-hypermesh\/","url_meta":{"origin":2235,"position":0},"title":"#402 Find edge nodes of mesh and create node sets for each edge loop using tcl script in HyperMesh","author":"gantovnik","date":"2024-01-07","format":false,"excerpt":"Assume we have this model: The script will find all edges and create set of nodes for each edge: [code language=\"python\"] *clearmark comps 1 *clearmark elems 1 *createmark elems 1 \"by comps\" 1 # hm_getedgeloops = Returns surface and element entities of specific connection types. # looptype=2 get all closed\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\/01\/ex402_3.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/01\/ex402_3.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/01\/ex402_3.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1701,"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-3\/","url_meta":{"origin":2235,"position":1},"title":"#322 Check types of selected elements in HyperMesh using tcl","author":"gantovnik","date":"2022-12-07","format":false,"excerpt":"[code language=\"python\"] # check types of selected elements using tcl *createmarkpanel elems 1 'Select Elems' set elems [hm_getmark elems 1] *clearmark elems 1 foreach eid $elems { set typename [hm_getentityvalue elems $eid typename 1] puts [format \"eid=%6d Typename=%s\" $eid $typename] } [\/code] Output: [code language=\"python\"] #eid= 9172 Typename=CQUAD4 #eid= 9162\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":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":2235,"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":771,"url":"https:\/\/gantovnik.com\/bio-tips\/2020\/11\/130-use-a-panel-to-add-entities-to-a-mark-in-tcl-in-hypermesh\/","url_meta":{"origin":2235,"position":3},"title":"#130 Use a panel to add entities to a mark in tcl in HyperMesh","author":"gantovnik","date":"2020-11-06","format":false,"excerpt":"#130 Use a panel to add entities to a mark in tcl in HyperMesh To create a mark of elements in a panel: *createmarkpanel elems 1 \"Please select the elements\" hm_getmark elems 1 To create a mark of elements in a panel using 2D faces as the default selection mode:\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":947,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/09\/171-delete-the-difference-between-the-elements-on-marks-1-and-2-in-hypermesh-tcl\/","url_meta":{"origin":2235,"position":4},"title":"#171 Delete the difference between the elements on marks 1 and 2 in HyperMesh tcl","author":"gantovnik","date":"2021-09-01","format":false,"excerpt":"#171 Delete the difference between the elements on marks 1 and 2 in HyperMesh tcl. *markdifference determines the difference between two marks and stores the results in the first mark. *createmark elems 1 1 2 3 4 *createmark elems 2 4 5 6 7 *markdifference elems 1 elems 2 *deletemark\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":1265,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/12\/133-create-vectors-and-planes-using-tcl-in-hypermesh-2\/","url_meta":{"origin":2235,"position":5},"title":"#227 Delete all elements using tcl in HyperMesh","author":"gantovnik","date":"2021-12-14","format":false,"excerpt":"To delete all of the elements in the model: [code language=\"python\"] *createmark elems 1 \"all\" *deletemark elems 1 [\/code] To delete the elements 50, 51, and 52 from a database: [code language=\"python\"] *createmark elems 1 \"50 51 52\" *deletemark elems 1 [\/code]","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\/2235","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=2235"}],"version-history":[{"count":3,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/2235\/revisions"}],"predecessor-version":[{"id":2242,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/2235\/revisions\/2242"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=2235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=2235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=2235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}