


{"id":51412,"date":"2021-01-19T09:29:11","date_gmt":"2021-01-19T09:29:11","guid":{"rendered":"\/forum\/forums\/topic\/how-to-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\/"},"modified":"2021-01-19T09:29:11","modified_gmt":"2021-01-19T09:29:11","slug":"how-to-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\/","title":{"rendered":"How to develop a script to &#8220;Generate mesh&#8221; and &#8220;Write input file&#8221; in mechanical scripting?"},"content":{"rendered":"<div class=\"Item-Body\">\n<div class=\"Message userContent\">\n<p>Hi,<\/p>\n<p>I&#039;m working on a parametric study where I need to run many simulations of the same geometry but different dimensions. The steps I follow to generate the simulation files are the following:<\/p>\n<p>1.Open Ansys WB<\/p>\n<p>2.Import SolidWorks geometry into the project schematic<\/p>\n<p>3.Open SpaceClaim and run script to generate name selections.<\/p>\n<p>4. Open Mechanical and : click in &quot;Generate mesh&quot; and click in &quot;Write iinput files&quot;. This last step will generate and input file that I need for running the simulation on a server.<\/p>\n<p>Step 1 to 3 I have already automated in the journal script (.wbjn file) which is attached on this post. I execute the journal script with the following command line :<\/p>\n<p>C:Program FilesANSYS Incv201Framework\binWin64&gt;RunWB2.exe -R &quot;C:UsersJSScriptsRunScript.wbjn&quot; -I<\/p>\n<p>Currently the step 4 which is open mechanical and generate mesh and input file are done manually. My goal is to write a script for these two tasks. I have used recording macro in mechanical scripting to generate the script which gives me the following lines for generating the mesh: <\/p>\n<p>#region Set current scoping selection<\/p>\n<p>currentSelection = ExtAPI.SelectionManager.CreateSelectionInfo(Ansys.ACT.Interfaces.Common.SelectionTypeEnum.GeometryEntities)<\/p>\n<p>currentSelection.Ids = []<\/p>\n<p>ExtAPI.SelectionManager.NewSelection(currentSelection)<\/p>\n<p>#endregion<\/p>\n<p>But when I try to use this script in other simulation it doesn&#039;t work. Also the recording macro doesn&#039;t work when I click on &quot;Write input file&quot;. <\/p>\n<p>I haven&#039;t been able to find some guidance to accomplish this on ACT customization suite. Do you have any advise on how to generate a mechanical script that can generate mesh and write input file? <\/p>\n<p><\/p>\n<\/p>\n<p>Thanks!<\/p>\n<p><\/p>\n<p><\/p>\n<\/p>\n<div data-embedjson=\"{&quot;url&quot;:&quot;https:\/\/us.v-cdn.net\/6032193\/uploads\/FYY7RZOYTCWN\/runscript.txt&quot;,&quot;name&quot;:&quot;RunScript.txt&quot;,&quot;type&quot;:&quot;text\/plain&quot;,&quot;size&quot;:1492,&quot;embedType&quot;:&quot;file&quot;}\">\n<a href=\"https:\/\/us.v-cdn.net\/6032193\/uploads\/FYY7RZOYTCWN\/runscript.txt\" download aria-label=\"RunScript.txt\"><br \/>\nRunScript.txt<br \/>\n<\/a><\/p>\n","protected":false},"template":"","class_list":["post-51412","topic","type-topic","status-closed","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_old_topic_id":["23680"],"_bbp_old_topic_author_name_id":["Anonymous"],"_bbp_old_is_topic_anonymous_id":["false"],"_bbp_old_closed_status_id":["publish"],"_bbp_author_ip":["???\u000e"],"_bbp_old_sticky_status_id":["normal"],"_bbp_likes_count":["0"],"_btv_view_count":["5348"],"_bbp_subscription":["302170"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["51412"],"_bbp_forum_id":["27791"],"_bbp_engagement":["200","170744","302170"],"_bbp_voice_count":["3"],"_bbp_reply_count":["4"],"_bbp_last_reply_id":["317600"],"_bbp_last_active_id":["317600"],"_bbp_last_active_time":["2023-11-14 14:09:02"]},"test":"josisandoval"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/51412","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\/51412\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=51412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}