


{"id":349707,"date":"2024-02-07T15:45:08","date_gmt":"2024-02-07T15:45:08","guid":{"rendered":"\/forum\/forums\/reply\/349707\/"},"modified":"2024-02-07T16:00:59","modified_gmt":"2024-02-07T16:00:59","slug":"349707","status":"publish","type":"reply","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/349707\/","title":{"rendered":"Reply To: Mechanical Scripting: Pressure Import componentwise"},"content":{"rendered":"<p>&lt;p&gt;&nbsp;&lt;\/p&gt;&lt;p&gt;Hello,&lt;\/p&gt;&lt;p&gt;thank you for your support.&lt;\/p&gt;&lt;p&gt;The first part works, but I still cannot change the components of the pressure. When I try to add it to the code like that:&lt;\/p&gt;&lt;p&gt;&nbsp;&lt;\/p&gt;<\/p>\n<pre>&lt;span style=\"font-size: 12pt;\"&gt;<em>mechScriptCmds=\"\"\"\nwbAnalysisName = '{3}'\nfor item in ExtAPI.DataModel.AnalysisList:\n&nbsp; &nbsp; if item.SystemCaption == wbAnalysisName:\n&nbsp; &nbsp; &nbsp; &nbsp; analysis = item\nmycaption = analysis.SystemCaption\nExtAPI.Log.WriteMessage(mycaption)\nwith Transaction():\n&nbsp; &nbsp; import glob\n&nbsp; &nbsp; import os\n&nbsp; &nbsp; DataPath = r'{0}'\n&nbsp; &nbsp; DataExtension = '{1}'\n&nbsp; &nbsp; allfiles = glob.glob1(DataPath,\"*.\" + DataExtension)\n&nbsp; &nbsp; allfiles.sort(key=lambda f: int(''.join(filter(str.isdigit, f))))\n&nbsp; &nbsp; numfilestoload = len(allfiles)\n&nbsp; &nbsp; importedloadobjects = [child for child in analysis.Children if child.DataModelObjectCategory.ToString() == \"ImportedLoadGroup\"]\n&nbsp; &nbsp; usedimportedloadobj = importedloadobjects[-1]\n&nbsp; &nbsp; importedPres = usedimportedloadobj.AddImportedPressure()&lt;br&gt;&lt;span style=\"background-color: rgb(251, 238, 184);\"&gt;    DefineByProp = importedPres.PropertyByName('PROPID_DefineByType')&lt;\/span&gt;&lt;br&gt;&lt;span style=\"background-color: rgb(251, 238, 184);\"&gt;    DefineByProp = 0 &nbsp; &nbsp;# 0=\"Components\", 2=\"Normal To\"&lt;\/span&gt;&lt;br&gt;  &nbsp; namedsel_importedload = ExtAPI.DataModel.GetObjectsByName('{2}')[0]\n&nbsp; &nbsp; importedPres.Location = namedsel_importedload\n&nbsp; &nbsp; table = importedPres.GetTableByName(\"\")\n&nbsp; &nbsp; for i in range(numfilestoload-1):\n&nbsp; &nbsp; &nbsp; &nbsp; table.Add(None)\n&nbsp; &nbsp; for i in range(numfilestoload):\n&nbsp; &nbsp; &nbsp; &nbsp; table[i][0] = \"File\"+str(i+1)+\":\"+str(allfiles[i])&lt;br&gt;&lt;span style=\"background-color: rgb(251, 238, 184);\"&gt;&nbsp; &nbsp; &nbsp; &nbsp; table[i][1] = \"File\"+str(i+2)+\":\"+str(allfiles[i+1])&lt;\/span&gt;&lt;br&gt;&lt;span style=\"background-color: rgb(251, 238, 184);\"&gt;&nbsp; &nbsp; &nbsp; &nbsp; table[i][2] = \"File\"+str(i+3)+\":\"+str(allfiles[i+2])&lt;\/span&gt;&lt;br&gt;  &nbsp; &nbsp; &nbsp; table[i][3] = (i+1)*100&lt;br&gt;  &nbsp; importedPres.ImportLoad()\n\"\"\".format(DataPath,DataExtension,namedSelectionUsed,systemName)\nmodel2 = system2.GetContainer(ComponentName=\"Model\")&nbsp;\nmodel2.SendCommand(Language=\"Python\", Command=mechScriptCmds) &lt;br&gt;<\/em>&lt;\/span&gt;<\/pre>\n<p>&lt;p&gt;&nbsp;&lt;\/p&gt;&lt;p&gt;When I run it nothing happens. I have of course tried several writing variations, but it doesn&rsquo;t work. The components are apparently not turned on and therefore no further columns are created.&lt;\/p&gt;&lt;p&gt;I also tried it like that, but it also doesnt work&hellip; I have seen this spelling several times, but never for imported pressure&lt;\/p&gt;&lt;p&gt;&nbsp;&lt;\/p&gt;<\/p>\n<pre>&lt;span style=\"background-color: rgb(251, 238, 184);\"&gt;&lt;span style=\"font-size: 12pt; background-color: rgb(251, 238, 184);\"&gt;<em>&lt;span class=\"n\"&gt;ImportedPres&lt;\/span&gt;<\/em>&lt;\/span&gt;&lt;span style=\"font-size: 12pt; background-color: rgb(251, 238, 184);\"&gt;<em>&lt;span class=\"o\"&gt;.&lt;\/span&gt;&lt;span class=\"n\"&gt;DefineBy&lt;\/span&gt; &lt;span class=\"o\"&gt;=&lt;\/span&gt; &lt;span class=\"n\"&gt;LoadDefineBy&lt;\/span&gt;&lt;span class=\"o\"&gt;.&lt;\/span&gt;&lt;span class=\"n\"&gt;Components&lt;\/span&gt;<\/em>&lt;\/span&gt;&lt;\/span&gt;<\/pre>\n<p>&lt;p&gt;&nbsp;&lt;\/p&gt;&lt;p&gt;Best regards&lt;\/p&gt;&lt;p&gt;Dayana&lt;\/p&gt;&lt;p&gt;&nbsp;&lt;\/p&gt;<\/p>\n<pre>&nbsp;<\/pre>\n","protected":false},"template":"","class_list":["post-349707","reply","type-reply","status-publish","hentry"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Hello,thank you for your support.The first part works, but I still cannot change the components of the pressure. When I try to add it to the code like that: mechScriptCmds=&quot;&quot;&quot; wbAnalysisName = &#039;{3}&#039; for item in ExtAPI.DataModel.AnalysisList: if item.SystemCaption == wbAnalysisName: analysis = item mycaption = analysis.SystemCaption ExtAPI.Log.WriteMessage(mycaption)\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/349707\/\" \/>\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=\"Reply To: Mechanical Scripting: Pressure Import componentwise | Ansys Learning Forum\" \/>\n\t\t<meta property=\"og:description\" content=\"Hello,thank you for your support.The first part works, but I still cannot change the components of the pressure. When I try to add it to the code like that: mechScriptCmds=&quot;&quot;&quot; wbAnalysisName = &#039;{3}&#039; for item in ExtAPI.DataModel.AnalysisList: if item.SystemCaption == wbAnalysisName: analysis = item mycaption = analysis.SystemCaption ExtAPI.Log.WriteMessage(mycaption)\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/349707\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2024-02-07T15:45:08+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2024-02-07T16:00:59+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Reply To: Mechanical Scripting: Pressure Import componentwise | Ansys Learning Forum\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Hello,thank you for your support.The first part works, but I still cannot change the components of the pressure. When I try to add it to the code like that: mechScriptCmds=&quot;&quot;&quot; wbAnalysisName = &#039;{3}&#039; for item in ExtAPI.DataModel.AnalysisList: if item.SystemCaption == wbAnalysisName: analysis = item mycaption = analysis.SystemCaption ExtAPI.Log.WriteMessage(mycaption)\" \/>\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\\\/reply\\\/349707\\\/#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\\\/forums\\\/reply\\\/349707\\\/#listItem\",\"name\":\"Reply To: Mechanical Scripting: Pressure Import componentwise\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/reply\\\/349707\\\/#listItem\",\"position\":2,\"name\":\"Reply To: Mechanical Scripting: Pressure Import componentwise\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum#listItem\",\"name\":\"Home\"}}]},{\"@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\\\/reply\\\/349707\\\/#webpage\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/reply\\\/349707\\\/\",\"name\":\"Reply To: Mechanical Scripting: Pressure Import componentwise | Ansys Learning Forum\",\"description\":\"Hello,thank you for your support.The first part works, but I still cannot change the components of the pressure. When I try to add it to the code like that: mechScriptCmds=\\\"\\\"\\\" wbAnalysisName = '{3}' for item in ExtAPI.DataModel.AnalysisList: if item.SystemCaption == wbAnalysisName: analysis = item mycaption = analysis.SystemCaption ExtAPI.Log.WriteMessage(mycaption)\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/reply\\\/349707\\\/#breadcrumblist\"},\"datePublished\":\"2024-02-07T15:45:08+00:00\",\"dateModified\":\"2024-02-07T16:00:59+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":"Reply To: Mechanical Scripting: Pressure Import componentwise | Ansys Learning Forum","description":"Hello,thank you for your support.The first part works, but I still cannot change the components of the pressure. When I try to add it to the code like that: mechScriptCmds=\"\"\" wbAnalysisName = '{3}' for item in ExtAPI.DataModel.AnalysisList: if item.SystemCaption == wbAnalysisName: analysis = item mycaption = analysis.SystemCaption ExtAPI.Log.WriteMessage(mycaption)","canonical_url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/349707\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/349707\/#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\/forums\/reply\/349707\/#listItem","name":"Reply To: Mechanical Scripting: Pressure Import componentwise"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/349707\/#listItem","position":2,"name":"Reply To: Mechanical Scripting: Pressure Import componentwise","previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum#listItem","name":"Home"}}]},{"@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\/reply\/349707\/#webpage","url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/349707\/","name":"Reply To: Mechanical Scripting: Pressure Import componentwise | Ansys Learning Forum","description":"Hello,thank you for your support.The first part works, but I still cannot change the components of the pressure. When I try to add it to the code like that: mechScriptCmds=\"\"\" wbAnalysisName = '{3}' for item in ExtAPI.DataModel.AnalysisList: if item.SystemCaption == wbAnalysisName: analysis = item mycaption = analysis.SystemCaption ExtAPI.Log.WriteMessage(mycaption)","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/#website"},"breadcrumb":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/349707\/#breadcrumblist"},"datePublished":"2024-02-07T15:45:08+00:00","dateModified":"2024-02-07T16:00:59+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":"Reply To: Mechanical Scripting: Pressure Import componentwise | Ansys Learning Forum","og:description":"Hello,thank you for your support.The first part works, but I still cannot change the components of the pressure. When I try to add it to the code like that: mechScriptCmds=&quot;&quot;&quot; wbAnalysisName = '{3}' for item in ExtAPI.DataModel.AnalysisList: if item.SystemCaption == wbAnalysisName: analysis = item mycaption = analysis.SystemCaption ExtAPI.Log.WriteMessage(mycaption)","og:url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/349707\/","article:published_time":"2024-02-07T15:45:08+00:00","article:modified_time":"2024-02-07T16:00:59+00:00","twitter:card":"summary_large_image","twitter:title":"Reply To: Mechanical Scripting: Pressure Import componentwise | Ansys Learning Forum","twitter:description":"Hello,thank you for your support.The first part works, but I still cannot change the components of the pressure. When I try to add it to the code like that: mechScriptCmds=&quot;&quot;&quot; wbAnalysisName = '{3}' for item in ExtAPI.DataModel.AnalysisList: if item.SystemCaption == wbAnalysisName: analysis = item mycaption = analysis.SystemCaption ExtAPI.Log.WriteMessage(mycaption)"},"aioseo_meta_data":{"post_id":"349707","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 17:01:05","updated":"2026-08-20 04:32:27","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\tReply To: Mechanical Scripting: Pressure Import componentwise\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/innovationspace.ansys.com\/forum"},{"label":"Reply To: Mechanical Scripting: Pressure Import componentwise","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/349707\/"}],"acf":[],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies\/349707","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/reply"}],"version-history":[{"count":1,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies\/349707\/revisions"}],"predecessor-version":[{"id":349708,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies\/349707\/revisions\/349708"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=349707"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}