-
-
December 8, 2022 at 11:03 pm
Jason Newton
SubscriberI'd like to learn how to access the mesh metrics value arrays in python , also getting topology arrays such as vertex values and/or indices. There seems to be a lot of capability of interacting with the mesher's entities but I wasn't able to figure out where the data I would like to inspect lived.
Â
When using the macro recorder I did notice with making selections that face IDs or edge IDs would be populated to supply to the selection APIs but I couldn't figure out any way to inspect the faces in other ways, say by visiting topology related arrays.
-
December 9, 2022 at 8:30 am
ErKo
Ansys EmployeeÂ
Â
Hi
Â
One can get and set the meshmetric (mesh) in the Mechanical UI.
To set the aspectratio:
mesh=ExtAPI.DataModel.Project.Model.Mesh
mesh.MeshMetric=MeshMetricType.AspectRatio
Â
To get the maximum aspect ratio given in the mesh metric details in the UI:
El_qua_max=mesh.MaximumÂ
Min:
El_qua_min=mesh.Minimum
Hope this is of helpErikÂ
Â
Â
-
December 12, 2022 at 12:29 pm
ErKo
Ansys EmployeeActually a faster way is to get these direct in the geometry tree:
Â
geometry = ExtAPI.DataModel.Project.Model.Geometry
bodies = geometry.GetChildren(DataModelObjectCategory.Body, True)
for body in bodies:
  name = body.Name
  print(str(name)+"; ")
  print(str(body.Minimum)+"; ")
  print(str(body.Maximum)+"; ")
  print(str(body.Average)+"; ")Â
-
December 13, 2022 at 12:46 am
Jason Newton
SubscriberIs there any way to make a selection of meshed faces that have scores <= some threshold? I can see from the histogram panel for mesh metrics that if I click on it I get neighborhoods of the geometry where meshing did poorly and needs investigation. I'm opened to non python routes for that. Most typically it seems applying some sizing controls to these selected neighborhoods works pretty well and is part of my immediate goals to more or less capture that process in a script.
Â
Baking up a step - is there any way to get the list of vertices, edges, and faces in python?
-
- The topic ‘Inspecting Mesh Metrics in python’ is closed to new replies.
-
6084
-
1906
-
1436
-
1308
-
1021
© 2026 Copyright ANSYS, Inc. All rights reserved.