


{"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":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Hi,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:1.Open Ansys WB2.Import SolidWorks geometry into the project schematic3.Open SpaceClaim and run script to generate name selections.4. Open Mechanical and : click in &quot;Generate\" \/>\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-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\/\" \/>\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 develop a script to \u201cGenerate mesh\u201d and \u201cWrite input file\u201d in mechanical scripting? | Ansys Learning Forum\" \/>\n\t\t<meta property=\"og:description\" content=\"Hi,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:1.Open Ansys WB2.Import SolidWorks geometry into the project schematic3.Open SpaceClaim and run script to generate name selections.4. Open Mechanical and : click in &quot;Generate\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2021-01-19T09:29:11+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2021-01-19T09:29:11+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"How to develop a script to \u201cGenerate mesh\u201d and \u201cWrite input file\u201d in mechanical scripting? | Ansys Learning Forum\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Hi,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:1.Open Ansys WB2.Import SolidWorks geometry into the project schematic3.Open SpaceClaim and run script to generate name selections.4. Open Mechanical and : click in &quot;Generate\" \/>\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-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\\\/#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\\\/how-to-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\\\/#listItem\",\"name\":\"How to develop a script to &#8220;Generate mesh&#8221; and &#8220;Write input file&#8221; in mechanical scripting?\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/how-to-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\\\/#listItem\",\"position\":3,\"name\":\"How to develop a script to &#8220;Generate mesh&#8221; and &#8220;Write input file&#8221; in mechanical scripting?\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/topics\\\/#listItem\",\"name\":\"Topics\"}}]},{\"@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-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\\\/#webpage\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/how-to-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\\\/\",\"name\":\"How to develop a script to \\u201cGenerate mesh\\u201d and \\u201cWrite input file\\u201d in mechanical scripting? | Ansys Learning Forum\",\"description\":\"Hi,I'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:1.Open Ansys WB2.Import SolidWorks geometry into the project schematic3.Open SpaceClaim and run script to generate name selections.4. Open Mechanical and : click in \\\"Generate\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/how-to-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\\\/#breadcrumblist\"},\"datePublished\":\"2021-01-19T09:29:11+00:00\",\"dateModified\":\"2021-01-19T09:29:11+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 develop a script to \u201cGenerate mesh\u201d and \u201cWrite input file\u201d in mechanical scripting? | Ansys Learning Forum","description":"Hi,I'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:1.Open Ansys WB2.Import SolidWorks geometry into the project schematic3.Open SpaceClaim and run script to generate name selections.4. Open Mechanical and : click in \"Generate","canonical_url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\/","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-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\/#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\/how-to-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\/#listItem","name":"How to develop a script to &#8220;Generate mesh&#8221; and &#8220;Write input file&#8221; in mechanical scripting?"},"previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\/#listItem","position":3,"name":"How to develop a script to &#8220;Generate mesh&#8221; and &#8220;Write input file&#8221; in mechanical scripting?","previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/topics\/#listItem","name":"Topics"}}]},{"@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-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\/#webpage","url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\/","name":"How to develop a script to \u201cGenerate mesh\u201d and \u201cWrite input file\u201d in mechanical scripting? | Ansys Learning Forum","description":"Hi,I'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:1.Open Ansys WB2.Import SolidWorks geometry into the project schematic3.Open SpaceClaim and run script to generate name selections.4. Open Mechanical and : click in \"Generate","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/#website"},"breadcrumb":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\/#breadcrumblist"},"datePublished":"2021-01-19T09:29:11+00:00","dateModified":"2021-01-19T09:29:11+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 develop a script to \u201cGenerate mesh\u201d and \u201cWrite input file\u201d in mechanical scripting? | Ansys Learning Forum","og:description":"Hi,I'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:1.Open Ansys WB2.Import SolidWorks geometry into the project schematic3.Open SpaceClaim and run script to generate name selections.4. Open Mechanical and : click in &quot;Generate","og:url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\/","article:published_time":"2021-01-19T09:29:11+00:00","article:modified_time":"2021-01-19T09:29:11+00:00","twitter:card":"summary_large_image","twitter:title":"How to develop a script to \u201cGenerate mesh\u201d and \u201cWrite input file\u201d in mechanical scripting? | Ansys Learning Forum","twitter:description":"Hi,I'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:1.Open Ansys WB2.Import SolidWorks geometry into the project schematic3.Open SpaceClaim and run script to generate name selections.4. Open Mechanical and : click in &quot;Generate"},"aioseo_meta_data":{"post_id":"51412","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 22:55:50","updated":"2024-10-28 22:55:50","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\tHow to develop a script to \u201cGenerate mesh\u201d and \u201cWrite input file\u201d in mechanical scripting?\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":"How to develop a script to &#8220;Generate mesh&#8221; and &#8220;Write input file&#8221; in mechanical scripting?","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-develop-a-script-to-generate-mesh-and-write-input-file-in-mechanical-scripting\/"}],"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":["5990"],"_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}]}}