


{"id":160509,"date":"2021-07-20T09:05:12","date_gmt":"2021-07-20T09:05:12","guid":{"rendered":"\/forum\/forums\/topic\/how-to-execute-spaceclaim-script-within-act\/"},"modified":"2022-05-31T19:31:25","modified_gmt":"2022-05-31T19:31:25","slug":"how-to-execute-spaceclaim-script-within-act","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-execute-spaceclaim-script-within-act\/","title":{"rendered":"How to execute SpaceClaim script within ACT?"},"content":{"rendered":"<div class=\"Item-Body\">\n<div class=\"Message userContent\">\n<p>Hello everyone<\/p>\n<p>I&#039;m having difficulties implementing my previously developed SpaceClaim script, into an ACT scripting environment. I want to roll out this script solution out to my colleagues, as this design\/analysis is quite repetitive and I thought an ACT (APP) would be quite suitable for the task.<\/p>\n<p>The SpaceClaim script works perfectly within the SpaceClaim scripting environment. I&#039;ve modified the IronPython SpaceClaim script slightly to work better with ACT by:<\/p>\n<ol>\n<li>Splitting it into two .py files, the <strong>script <\/strong>and the <strong>definition (def) <\/strong>I&#039;ve defined<\/li>\n<li>Modified the input geometry variables to extract the values from the user (see example below)<\/li>\n<\/ol>\n<p><code class=\"code codeInline\" spellcheck=\"false\">br_h.Add(step.Properties[&quot;Geometry\/br_h_top&quot;].Value)&nbsp;<\/code><\/p>\n<p><code class=\"code codeInline\" spellcheck=\"false\">br_h.Add(step.Properties[&quot;Geometry\/br_h_bot&quot;].Value)&nbsp;<\/code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p>&nbsp;<code class=\"code codeInline\" spellcheck=\"false\">AC_geo.Add(&#039;br_h&#039;,br_h)<\/code><\/p>\n<p><\/p>\n<\/p>\n<p>So far I&#039;ve achieved the following in ACT:<\/p>\n<ol>\n<li>Defining the steps<\/li>\n<li>Setting up the workbench interface (separate load cases)<\/li>\n<li>Opening SpaceClaim <\/li>\n<li>Defining the geometry input<\/li>\n<li>Extracting the geometrical values from 4., to be used further in the IronPython code.<\/li>\n<\/ol>\n<p>After that the ACT program crashes on a line where I define: <\/p>\n<p><code class=\"code codeInline\" spellcheck=\"false\">&nbsp;variable = Direction.Create(1,0,0)<\/code><\/p>\n<p>or:<\/p>\n<p><code class=\"code codeInline\" spellcheck=\"false\">variable&nbsp;= List[IComponent]()<\/code><\/p>\n<p>My conclusion is therefore that: <em>ACT does not recognize the internal SpaceClaim IronPython functions as default.<\/em><\/p>\n<p>I&#039;ve tried to define the following default <strong>definition <\/strong>that &quot;imports&quot; the default SpaceClaim IronPython definitions. ACT can call and run the <strong>definition <\/strong>, but it doesn&#039;t work&#8230;..<\/p>\n<p><code class=\"code codeInline\" spellcheck=\"false\">def script_import():<\/code><\/p>\n<p><code class=\"code codeInline\" spellcheck=\"false\">&nbsp;&nbsp;&#039;&#039;&#039;<\/code><\/p>\n<p><code class=\"code codeInline\" spellcheck=\"false\">&nbsp;&nbsp;This function imports SpaceClaim scripting for ACT<\/code><\/p>\n<p><code class=\"code codeInline\" spellcheck=\"false\">&nbsp;&nbsp;&#039;&#039;&#039;<\/code><\/p>\n<p><code class=\"code codeInline\" spellcheck=\"false\">&nbsp;&nbsp;import clr<\/code><\/p>\n<p><code class=\"code codeInline\" spellcheck=\"false\">&nbsp;&nbsp;clr.AddReference(&quot;Ansys.ACT.Interfaces&quot;)<\/code><\/p>\n<p><code class=\"code codeInline\" spellcheck=\"false\">&nbsp;&nbsp;import Ansys<\/code><\/p>\n<p><code class=\"code codeInline\" spellcheck=\"false\">&nbsp;&nbsp;clr.AddReference(&quot;SpaceClaim.Api.V19&quot;)<\/code><\/p>\n<p><code class=\"code codeInline\" spellcheck=\"false\">&nbsp;&nbsp;import SpaceClaim<\/code><\/p>\n<p><code class=\"code codeInline\" spellcheck=\"false\">&nbsp;&nbsp;clr.AddReference(&#039;SpaceClaim.Api.V19.Scripting&#039;)<\/code><\/p>\n<p><code class=\"code codeInline\" spellcheck=\"false\">&nbsp;&nbsp;from SpaceClaim.Api.V19 import Geometry<\/code><\/p>\n<p>&nbsp;<code class=\"code codeInline\" spellcheck=\"false\">&nbsp;from SpaceClaim.Api.V19 import Modeler<\/code><\/p>\n<p><code class=\"code codeInline\" spellcheck=\"false\">&nbsp;&nbsp;return<\/code><\/p>\n<p>I&#039;ve searched for days for some kind of solution online and in the ANSYS guides, but I cannot find my way around this problem. Do any of you have any suggestions?<\/p>\n<p><\/p>\n<\/p>\n<p><strong>Note<\/strong>: I cannot share the source code as it owned by the company I work for, but I can share some of if it would help<\/p>\n","protected":false},"template":"","class_list":["post-160509","topic","type-topic","status-closed","hentry","topic-tag-act","topic-tag-application-1","topic-tag-scripting","topic-tag-spaceclaim","topic-tag-workbench"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Hello everyoneI&#039;m having difficulties implementing my previously developed SpaceClaim script, into an ACT scripting environment. I want to roll out this script solution out to my colleagues, as this design\/analysis is quite repetitive and I thought an ACT (APP) would be quite suitable for the task.The SpaceClaim script works perfectly within the SpaceClaim scripting environment.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-execute-spaceclaim-script-within-act\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Ansys Learning Forum | Ansys Innovation Space\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"How to execute SpaceClaim script within ACT? | Ansys Learning Forum\" \/>\n\t\t<meta property=\"og:description\" content=\"Hello everyoneI&#039;m having difficulties implementing my previously developed SpaceClaim script, into an ACT scripting environment. I want to roll out this script solution out to my colleagues, as this design\/analysis is quite repetitive and I thought an ACT (APP) would be quite suitable for the task.The SpaceClaim script works perfectly within the SpaceClaim scripting environment.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-execute-spaceclaim-script-within-act\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2021-07-20T09:05:12+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2022-05-31T19:31:25+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"How to execute SpaceClaim script within ACT? | Ansys Learning Forum\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Hello everyoneI&#039;m having difficulties implementing my previously developed SpaceClaim script, into an ACT scripting environment. I want to roll out this script solution out to my colleagues, as this design\/analysis is quite repetitive and I thought an ACT (APP) would be quite suitable for the task.The SpaceClaim script works perfectly within the SpaceClaim scripting environment.\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/how-to-execute-spaceclaim-script-within-act\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/topics\\\/#listItem\",\"name\":\"Topics\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/topics\\\/#listItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/topics\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic-tag\\\/workbench\\\/#listItem\",\"name\":\"workbench\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic-tag\\\/workbench\\\/#listItem\",\"position\":3,\"name\":\"workbench\",\"item\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic-tag\\\/workbench\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/how-to-execute-spaceclaim-script-within-act\\\/#listItem\",\"name\":\"How to execute SpaceClaim script within ACT?\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/topics\\\/#listItem\",\"name\":\"Topics\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/how-to-execute-spaceclaim-script-within-act\\\/#listItem\",\"position\":4,\"name\":\"How to execute SpaceClaim script within ACT?\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic-tag\\\/workbench\\\/#listItem\",\"name\":\"workbench\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#organization\",\"name\":\"Ansys Learning Forum\",\"description\":\"Ansys Innovation Space\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/how-to-execute-spaceclaim-script-within-act\\\/#webpage\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/how-to-execute-spaceclaim-script-within-act\\\/\",\"name\":\"How to execute SpaceClaim script within ACT? | Ansys Learning Forum\",\"description\":\"Hello everyoneI'm having difficulties implementing my previously developed SpaceClaim script, into an ACT scripting environment. I want to roll out this script solution out to my colleagues, as this design\\\/analysis is quite repetitive and I thought an ACT (APP) would be quite suitable for the task.The SpaceClaim script works perfectly within the SpaceClaim scripting environment.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/how-to-execute-spaceclaim-script-within-act\\\/#breadcrumblist\"},\"datePublished\":\"2021-07-20T09:05:12+00:00\",\"dateModified\":\"2022-05-31T19:31:25+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#website\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/\",\"name\":\"Ansys Learning Forum\",\"description\":\"Ansys Innovation Space\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How to execute SpaceClaim script within ACT? | Ansys Learning Forum","description":"Hello everyoneI'm having difficulties implementing my previously developed SpaceClaim script, into an ACT scripting environment. I want to roll out this script solution out to my colleagues, as this design\/analysis is quite repetitive and I thought an ACT (APP) would be quite suitable for the task.The SpaceClaim script works perfectly within the SpaceClaim scripting environment.","canonical_url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-execute-spaceclaim-script-within-act\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-execute-spaceclaim-script-within-act\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum#listItem","position":1,"name":"Home","item":"https:\/\/innovationspace.ansys.com\/forum","nextItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/topics\/#listItem","name":"Topics"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/topics\/#listItem","position":2,"name":"Topics","item":"https:\/\/innovationspace.ansys.com\/forum\/topics\/","nextItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic-tag\/workbench\/#listItem","name":"workbench"},"previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic-tag\/workbench\/#listItem","position":3,"name":"workbench","item":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic-tag\/workbench\/","nextItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-execute-spaceclaim-script-within-act\/#listItem","name":"How to execute SpaceClaim script within ACT?"},"previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/topics\/#listItem","name":"Topics"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-execute-spaceclaim-script-within-act\/#listItem","position":4,"name":"How to execute SpaceClaim script within ACT?","previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic-tag\/workbench\/#listItem","name":"workbench"}}]},{"@type":"Organization","@id":"https:\/\/innovationspace.ansys.com\/forum\/#organization","name":"Ansys Learning Forum","description":"Ansys Innovation Space","url":"https:\/\/innovationspace.ansys.com\/forum\/"},{"@type":"WebPage","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-execute-spaceclaim-script-within-act\/#webpage","url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-execute-spaceclaim-script-within-act\/","name":"How to execute SpaceClaim script within ACT? | Ansys Learning Forum","description":"Hello everyoneI'm having difficulties implementing my previously developed SpaceClaim script, into an ACT scripting environment. I want to roll out this script solution out to my colleagues, as this design\/analysis is quite repetitive and I thought an ACT (APP) would be quite suitable for the task.The SpaceClaim script works perfectly within the SpaceClaim scripting environment.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/#website"},"breadcrumb":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-execute-spaceclaim-script-within-act\/#breadcrumblist"},"datePublished":"2021-07-20T09:05:12+00:00","dateModified":"2022-05-31T19:31:25+00:00"},{"@type":"WebSite","@id":"https:\/\/innovationspace.ansys.com\/forum\/#website","url":"https:\/\/innovationspace.ansys.com\/forum\/","name":"Ansys Learning Forum","description":"Ansys Innovation Space","inLanguage":"en-US","publisher":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/#organization"}}]},"og:locale":"en_US","og:site_name":"Ansys Learning Forum | Ansys Innovation Space","og:type":"article","og:title":"How to execute SpaceClaim script within ACT? | Ansys Learning Forum","og:description":"Hello everyoneI'm having difficulties implementing my previously developed SpaceClaim script, into an ACT scripting environment. I want to roll out this script solution out to my colleagues, as this design\/analysis is quite repetitive and I thought an ACT (APP) would be quite suitable for the task.The SpaceClaim script works perfectly within the SpaceClaim scripting environment.","og:url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-execute-spaceclaim-script-within-act\/","article:published_time":"2021-07-20T09:05:12+00:00","article:modified_time":"2022-05-31T19:31:25+00:00","twitter:card":"summary_large_image","twitter:title":"How to execute SpaceClaim script within ACT? | Ansys Learning Forum","twitter:description":"Hello everyoneI'm having difficulties implementing my previously developed SpaceClaim script, into an ACT scripting environment. I want to roll out this script solution out to my colleagues, as this design\/analysis is quite repetitive and I thought an ACT (APP) would be quite suitable for the task.The SpaceClaim script works perfectly within the SpaceClaim scripting environment."},"aioseo_meta_data":{"post_id":"160509","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"content","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":true,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2024-10-28 20:29:01","updated":"2024-10-28 20:29:01","ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/innovationspace.ansys.com\/forum\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/innovationspace.ansys.com\/forum\/topics\/\" title=\"Topics\">Topics<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic-tag\/workbench\/\" title=\"workbench\">workbench<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHow to execute SpaceClaim script within ACT?\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/innovationspace.ansys.com\/forum"},{"label":"Topics","link":"https:\/\/innovationspace.ansys.com\/forum\/topics\/"},{"label":"workbench","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic-tag\/workbench\/"},{"label":"How to execute SpaceClaim script within ACT?","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-execute-spaceclaim-script-within-act\/"}],"acf":[],"custom_fields":[{"0":{"_bbp_author_ip":[""],"_bbp_view_count":["236"],"_bbp_likes_count":["0","0"],"_bbp_forum_subforum_count":["0"],"_btv_view_count":["3198"],"_bbp_subscription":["231731"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["160509"],"_bbp_forum_id":["27789"],"_bbp_engagement":["22865","23650","213086"],"_bbp_voice_count":["3"],"_bbp_reply_count":["3"],"_bbp_last_reply_id":["186040"],"_bbp_last_active_id":["186040"],"_bbp_last_active_time":["2022-05-31 19:31:25"]},"test":"bjmelorsted-dk"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/160509","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/160509\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=160509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}