


{"id":390037,"date":"2024-10-16T13:42:21","date_gmt":"2024-10-16T13:42:21","guid":{"rendered":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/difference-between-23r2-and-24r2-in-mechanical-scripting-behaviour\/"},"modified":"2024-10-16T13:56:31","modified_gmt":"2024-10-16T13:56:31","slug":"difference-between-23r2-and-24r2-in-mechanical-scripting-behaviour","status":"publish","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/difference-between-23r2-and-24r2-in-mechanical-scripting-behaviour\/","title":{"rendered":"Difference between 23R2 and 24R2 in Mechanical Scripting Behaviour"},"content":{"rendered":"<p>&lt;p&gt;Hello everyone,&lt;br&gt;I work with Mechanical and workbench Scripting a lot .&lt;br&gt;Specifically, I run calculations in Mechanical using gitlab runner to planify the execution of my tests.&lt;\/p&gt;&lt;p&gt;My scripts all follow the same structure , that i will simplify here.&lt;br&gt;A first Bash Script calls a Main Journal using the following flags :&lt;br&gt;#################&lt;br&gt;&#8221;%AWP_ROOT242%\\Framework\\bin\\Win64\\RunWB2.exe&#8221; -B -R &#8220;%CI_PROJECT_DIR%\\MainJournal.wbjn&#8221;&lt;br&gt;#################&lt;\/p&gt;&lt;p&gt;MainJournal.wbjn :&lt;br&gt;#################&lt;br&gt;# Setup Environment variables&lt;br&gt;&#8230;&lt;br&gt;# setup files&lt;br&gt;&#8230;&lt;br&gt;# Run script&lt;br&gt;RunScript(FilePath=Another_journal.wbjn)&lt;br&gt;#################&lt;\/p&gt;&lt;p&gt;&nbsp;&lt;\/p&gt;&lt;p&gt;&lt;br&gt;Another_journal.wbjn does operations that are specific to every calculation i run.&lt;\/p&gt;&lt;p&gt;Another_journal.wbjn :&nbsp;&lt;br&gt;#################&lt;br&gt;# More setup&lt;br&gt;&#8230;&lt;br&gt;# load model&lt;br&gt;Unarchive(ArchivePath=&#8221;Model.wbpz&#8221;, ProjectPath=&#8221;Model_name.wbpj&#8221;)&lt;br&gt;system1 = GetSystem(Name=&#8221;SYS&#8221;)&lt;br&gt;container1 = system1.GetContainer(ComponentName=&#8221;Setup&#8221;)&lt;br&gt;container1.Edit()&lt;br&gt;Simulation.RunScript(FilePath=&#8221;Macro_file.py&#8221;, IsMeshing=False, ModelName=&#8221;Model&#8221;)&lt;br&gt;#################&lt;\/p&gt;&lt;p&gt;In 23 R2, this worked flawlessly.&nbsp;&lt;\/p&gt;&lt;p&gt;However, when we updated from Ansys 23R2 to Ansys 24R2, all my scripts stopped working.&nbsp;&lt;br&gt;I have narrowed the failure to the container1.Edit() line. my scripts would just stop there, and do nothing.&lt;br&gt;Through trial and error, i realized that i could simply remove that .edit() line and most of my scripts would still work.&lt;br&gt;Not all though. For example , i cannot use legend.Reset() specifically, as well as some other things like OnClick callbacks linked to Mechanical Interface buttons do not work .&lt;br&gt;I understand that this is a very limited use case, but could anyone point me to what changed between versions 23 and 24 with the container.edit() function ?&lt;br&gt;Additionnally, what could i do to re-add the .Edit() line ?&lt;br&gt;Any help would be greatly appreciated&lt;\/p&gt;&lt;p&gt;&lt;br&gt;PS: &nbsp;If someone could tell me how to format a block of text as code i would appreciate it too !&lt;\/p&gt;<\/p>\n","protected":false},"template":"","class_list":["post-390037","topic","type-topic","status-publish","hentry","topic-tag-python-ironpython-1","topic-tag-macros-scripting-2"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["470933","200"],"_bbp_author_ip":["156.28.6.11"],"_btv_view_count":["164"],"_bbp_topic_status":["unanswered"],"_edit_last":["470933"],"_bbp_revision_log":["a:3:{i:390040;a:2:{s:6:\"author\";i:470933;s:6:\"reason\";s:10:\"formatting\";}i:390041;a:2:{s:6:\"author\";i:470933;s:6:\"reason\";s:0:\"\";}i:390045;a:2:{s:6:\"author\";i:470933;s:6:\"reason\";s:40:\"I'm terrible at editing with this editor\";}}"],"_bbp_likes_count":["1"],"_bbp_topic_id":["390037"],"_bbp_forum_id":["27791"],"_bbp_engagement":["200","470933"],"_bbp_voice_count":["2"],"_bbp_reply_count":["1"],"_bbp_last_reply_id":["390620"],"_bbp_last_active_id":["390620"],"_bbp_last_active_time":["2024-10-21 11:26:14"]},"test":"antoine-crestani-extsafrangroup-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/390037","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":3,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/390037\/revisions"}],"predecessor-version":[{"id":390045,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/390037\/revisions\/390045"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=390037"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}