Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

Inspecting Mesh Metrics in python

    • Jason Newton
      Subscriber

      I'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.

    • 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 help

      Erik 

       

       

    • ErKo
      Ansys Employee

      Actually 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)+"; ")

       

    • Jason Newton
      Subscriber

      Is 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?

Viewing 3 reply threads
  • The topic ‘Inspecting Mesh Metrics in python’ is closed to new replies.
[bingo_chatbox]