


{"id":309676,"date":"2023-10-02T14:54:50","date_gmt":"2023-10-02T14:54:50","guid":{"rendered":"\/forum\/forums\/topic\/create-mesh-element-named-selection-in-act\/"},"modified":"2023-10-02T14:54:50","modified_gmt":"2023-10-02T14:54:50","slug":"create-mesh-element-named-selection-in-act","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/create-mesh-element-named-selection-in-act\/","title":{"rendered":"Create Mesh Element Named Selection in ACT"},"content":{"rendered":"<p>I am trying to create an ACT which defines load. The user would choose geometry with scoping. The ACT would then make named selection from the chosen geometry (which would be face or multiple faces for example). Then using worksheet, other named selection would be created, selecting all elements which belong to the first name selection. The element named selection would be then used for applying the load with APDL commands (sfe). I have this code<\/p>\n<div>\n<div>scoping = load.Properties [&#8220;Geometry&#8221;].Value<\/div>\n<div>\n<div>selectedIds = scoping.Ids<\/div>\n<div>ExtAPI.SelectionManager.ClearSelection()<\/div>\n<div>mySel = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)<\/div>\n<div>mySel.Ids = selectedIds<\/p>\n<div>\n<div>area = ExtAPI.DataModel.Project.Model.AddNamedSelection()<\/div>\n<div>area.Location = mySel<\/div>\n<div>area.Name = &#8220;load_area&#8221;<\/div>\n<\/div>\n<p><\/p>\n<div>\n<div>elements = ExtAPI.DataModel.Project.Model.AddNamedSelection()<br \/>elements.Name = &#8220;elements&#8221;<\/div>\n<div>elements.ScopingMethod = GeometryDefineByType.Worksheet<\/div>\n<div>criteria = elements.GenerationCriteria<\/div>\n<div>&nbsp;<\/div>\n<div># First row<\/div>\n<div>criteria.Add(None)<\/div>\n<div>criterion_1 = criteria[0]<\/div>\n<div>criterion_1.EntityType = SelectionType.GeoFace<\/div>\n<div>criterion_1.Criterion = SelectionCriterionType.NamedSelection<\/div>\n<div>criterion_1.Operator = SelectionOperatorType.Equal<\/div>\n<div>criterion_1.Value = area<\/div>\n<div>&nbsp;<\/div>\n<div># Second row<\/div>\n<div>criteria.Add(None)<\/div>\n<div>criterion_2 = criteria[1]<\/div>\n<div>criterion_2.Action = SelectionActionType.Convert<\/div>\n<div>criterion_2.EntityType = SelectionType.MeshElement<\/div>\n<div>elements.Generate()<\/p>\n<p>when I run this code in Mechanical, it works just fine but when the code is run inside the ACT, it does not work. It creates the first named selection but then there is an error (ValueError: This property is parameterized and is read-only.) at the line<\/p>\n<div>\n<div>elements.ScopingMethod = GeometryDefineByType.Worksheet<\/p>\n<\/div>\n<div>What is the problem and how can I resolve it?<\/div>\n<\/div>\n<p>The same problem was happening also when I tried to create nodal named selection like this:<\/p>\n<div>area = ExtAPI.DataModel.Project.Model.AddNamedSelection()<\/div>\n<div>area.Location = mySel<\/div>\n<div>area.Name = &#8220;load_area&#8221;<\/p>\n<div>area.CreateNodalNamedSelection()<\/p>\n<p>Again, was working fine in Mechanical scripting, does not work when run in ACT.<\/p><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"template":"","class_list":["post-309676","topic","type-topic","status-closed","hentry","topic-tag-act","topic-tag-mechanical"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["62335","170445"],"_bbp_author_ip":["96.7.218.223"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["2156"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["309676"],"_bbp_forum_id":["27791"],"_bbp_engagement":["62335","170445"],"_bbp_voice_count":["2"],"_bbp_reply_count":["3"],"_bbp_last_reply_id":["310979"],"_bbp_last_active_id":["310979"],"_bbp_last_active_time":["2023-10-11 06:01:07"]},"test":"anezka-michalkovavutbr-cz"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/309676","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\/309676\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=309676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}