{"id":159562,"date":"2022-09-26T09:33:10","date_gmt":"2022-09-26T09:33:10","guid":{"rendered":"\/knowledge\/forums\/topic\/discovery-spaceclaim-scripting-examples\/"},"modified":"2023-08-16T06:32:38","modified_gmt":"2023-08-16T06:32:38","slug":"discovery-spaceclaim-scripting-examples","status":"publish","type":"topic","link":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/discovery-spaceclaim-scripting-examples\/","title":{"rendered":"Discovery SpaceClaim &#8211; Scripting examples"},"content":{"rendered":"<div class=\"attachments -clamp\"><span class=\"attachments__item \"><a style=\"color: #1e6ddc; font-weight: bold; text-decoration: none;\" href=\"https:\/\/ansys13.ansys.com\/KnowledgeArticles\/Discovery\/create_ns_midpoint_option.zip\">create_ns_midpoint_option.zip<\/a><\/span><br \/>\n<span class=\"attachments__item \"><a style=\"color: #1e6ddc; font-weight: bold; text-decoration: none;\" href=\"https:\/\/ansys13.ansys.com\/KnowledgeArticles\/Discovery\/create_ns_ray_option.zip\">create_ns_ray_option.zip<\/a><\/span><br \/>\n<span class=\"attachments__item \"><a style=\"color: #1e6ddc; font-weight: bold; text-decoration: none;\" href=\"https:\/\/ansys13.ansys.com\/KnowledgeArticles\/Discovery\/model.zip\">model.zip<\/a><\/span><\/div>\n<div class=\"cfa topic__text formatted\">\n<p>Please find attached a couple of Discovery SpaceClaim scripts which create Named Selection groups &#8211; inlet, outlet, wall and fluid, for the attached model. These scripts use logic to identify the faces (inlet, outlet) based on their location in the model shown below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-157301\" src=\"\/knowledge\/wp-content\/uploads\/sites\/4\/2022\/08\/bb.png\" alt=\" width=\"893\" height=\"452\" \/><\/p>\n<p>Script &#8220;<strong>create-ns-midpoint-option.py<\/strong>&#8221; shows how to loop through bodies and its faces to identify face midpoint, compare it with center coordinates of inlet and outlet.<\/p>\n<p>Script &#8220;<strong>create-ns-ray-option.py<\/strong>&#8221; shows the use of Selection option &#8220;Ray&#8221; for selecting faces with know locations.<\/p>\n<\/div>\n","protected":false},"template":"","class_list":["post-159562","topic","type-topic","status-publish","hentry","topic-tag-scripting","topic-tag-spaceclaim"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_wp_page_template":["default"],"_bbp_last_active_time":["09-19-2022  20:20:00"],"_bbp_forum_id":["159540"],"_edit_lock":["1664369924:77457"],"_edit_last":["77457"],"_bbp_topic_id":["159562"],"_btv_view_count":["6586"],"family":["Discovery Products"],"application_name":["SpaceClaim"],"product_version":["2021R2"],"_bbp_likes_count":["1"]},"test":"solution"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics\/159562","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics\/159562\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/media?parent=159562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}