


{"id":396838,"date":"2024-12-09T18:26:08","date_gmt":"2024-12-09T18:26:08","guid":{"rendered":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/importing-a-cfd-pressure-load-to-mechanical-using-scripting\/"},"modified":"2024-12-09T18:26:08","modified_gmt":"2024-12-09T18:26:08","slug":"importing-a-cfd-pressure-load-to-mechanical-using-scripting","status":"publish","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/importing-a-cfd-pressure-load-to-mechanical-using-scripting\/","title":{"rendered":"Importing a CFD pressure load to Mechanical using Scripting"},"content":{"rendered":"<p>&lt;p&gt;I have a Workbench system as shown:&nbsp;&lt;\/p&gt;&lt;p&gt;<img decoding=\"async\" src=\"https:\/\/innovationspace.ansys.com\/forum\/wp-content\/uploads\/sites\/2\/2024\/12\/09-12-2024-1733768478-mceclip0.png\" \/>&lt;\/p&gt;&lt;p&gt;A Fluent file provides a CFD pressure load to a wing model. To import this manually, I go to Mechanical &gt; Static Structural &gt; Imported Load (B3) and Insert Pressure. In the settings dropdown I then select which CFD surface I want as shown below, then apply that to the skin of my wing.&lt;\/p&gt;&lt;p&gt;<img decoding=\"async\" src=\"https:\/\/innovationspace.ansys.com\/forum\/wp-content\/uploads\/sites\/2\/2024\/12\/09-12-2024-1733768617-mceclip1.png\" \/>&lt;\/p&gt;&lt;p&gt;I wish to automate this process for many wing models. However, I cannot find the function in Mechanical scripting to call a given &#8216;CFD Surface&#8217; and import the associated pressure as a load. I tried using the &#8216;Record&#8217; function and setting it up manually, which gives this code, but it gives an error &#8216;AttributeError: &#8216;NoneType&#8217; object has no attribute &#8216;AddImportedPressure&#8221;:&lt;\/p&gt;&lt;p&gt;#region Context Menu Action&lt;br&gt;imported_load_group_140 = DataModel.GetObjectById(140)&lt;br&gt;imported_pressure_141 = imported_load_group_140.AddImportedPressure()&lt;br&gt;#endregion&lt;\/p&gt;&lt;p&gt;#region Details View Action&lt;br&gt;selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)&lt;br&gt;selection.Ids = [30]&lt;br&gt;imported_pressure_141.Location = selection&lt;br&gt;#endregion&lt;\/p&gt;&lt;p&gt;imported_load = DataModel.GetObjectById(141)&lt;br&gt;imported_load.ImportLoad()&lt;br&gt;#&nbsp;&lt;\/p&gt;&lt;p&gt;&nbsp;&lt;\/p&gt;&lt;p&gt;Can anyone help me debug this code??&lt;\/p&gt;<\/p>\n","protected":false},"template":"","class_list":["post-396838","topic","type-topic","status-publish","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_forum_id":["27791"],"_bbp_topic_id":["396838"],"_bbp_author_ip":["152.78.0.24"],"_bbp_last_reply_id":["396897"],"_bbp_last_active_id":["396897"],"_bbp_last_active_time":["2024-12-10 08:25:35"],"_bbp_reply_count":["1"],"_bbp_reply_count_hidden":["0"],"_bbp_voice_count":["2"],"_bbp_engagement":["482200","58821"],"_btv_view_count":["449"],"_bbp_topic_status":["unanswered"],"_bbp_subscription":["58821"]},"test":"dc3g20soton-ac-uk"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/396838","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\/396838\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=396838"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}