(Ansys Meshing) problem with selection IDs?

Hi,
I've just updated the version from 2021 R1 to 2024 R1, and it's become really annoying!!
I'm trying to record scripting using the Record button, and the recording process writes nothing when selecting the corresponding geometry. Expect from the inflation, for sizings, method, and named selections, there is no line generated automatically. I can recall that this was not the case in 2021R1.
For named selections, there is a command including object IDs, but for sizing, it is worse: nothing exists !!!
Is this a problem with my system or the meshing software itself?
(nothing exists in terms of geometry selections for all sizings:)
It could be possible to add "selection.IDs" lines (just like the inflation) but I cannot find the "selection.IDs" number for a specific geometry part. What should I do?
Any help would greatly be appreciated.
Answers
-
@EhsanBa , I could suggest that you can create a Named Selection for the geometry first and then use the Named Selection method to work with it.
1 -
@Naveen Kumar Begari
Thanks for your reply. But, since I'm doing an optimization project and the mesh should be regenerated numerous times, I cannot add named selections manually.I'm able to add such a line in my code (for example):
named_selection_37 = Model.AddNamedSelection() selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities) selection.Ids = [13, 14] named_selection_37.Location = selection
but the problem is I dunno how to obtain selection ID numbers for geometry's parts (i.e., like numbers 13 & 14 in the brackets above).
Best0 -
@EhsanBa ,
try with this...!!1 -
Thanks for your comment. But it didn't work for me.
I want to assign, for instance, a line as an "Inlet" Boundary condition, or apply sizing to a wall boundary. In this regard, I need selection IDs of this line or the wall geometry. ( in other words, I want to find the x value in this command: selection.Ids = [x]) .
The code you give me is only helpful when you assign these based on Object ID (not selection ID, which is a different thing). And since Object IDs are changing during the optimization, while selection IDs are not, I want to know how to obtain selection IDs of any particular geometry entity.
Kind Regards
0 -
For instance, in this code, the selection ID and Object ID have different values:
0 -
@EhsanBa ,
I am confused about the issue. In 24.1 for me the script recording for mesh sizing seems to do exactly what you want. The first snippet is recording a mesh sizing and setting the scoping. The second is inserting a new mesh sizing with geometry active in the graphics window and defaults to the current selections.So first, we seem to have different behavior in the recording. If you are not seeing this, I suggest contact your Ansys support team.
Second, even if you do get the Ids of the geometry, I am not sure how this is helpful in an optimization case. The internal geometry Ids are not very stable from case to case and are not recommended for designs intended to change/update like this. You should use Named Selection worksheet, and/or python code object that will run on geometry update to re-scope a named selection. Given this advice, you would then scope the mesh sizing object to the named selection object, which you can get by name or object id.
#region Details View Action sizing_59 = DataModel.GetObjectById(59) selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities) selection.Ids = [232] sizing_59.Location = selection #endregion #region Context Menu Action mesh_13 = Model.Mesh sizing_61 = mesh_13.AddSizing() selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities) selection.Ids = [783] sizing_61.Location = selection #endregion
1 -
@Mike.Thompson
Thanks for your reply.Yes, you're right. I realized that the problem was due to the Apply Selection pop-up:
However, if the entity is selected using the "Details of..." wizard, it would be no problem at all. I dunno it's a glitch or there's a fault in my system, but it doesn't matter anymore!
Thank you so much for your suggestion for using named selection worksheets. I will try that.
I have another question:
During the optimization process, a curve of the geometry should be updated in a specific interval, and the mesh must be regenerated. However, when I apply a small change in the geometry, there is a problem with scoping:So, I thought I must reset the mesh bloc in the workbench and regenerate the mesh from the very beginning. Do you think it's possible that by using a named selection worksheet, this problem would be solved, and there would be no need to regenerate the mesh from the beginning (i.e., the code would only include something like "mesh_1.GenerateMesh()") ?
0