How to generate mesh on selected body with and without looping?

Chemsdine CHEMAI
Chemsdine CHEMAI Member, Employee Posts: 201
100 Likes 100 Comments First Anniversary Ansys Employee
✭✭✭✭
edited August 2023 in Structures

How to generate mesh on selected body with and without looping?

Tagged:

Best Answer

  • Chemsdine CHEMAI
    Chemsdine CHEMAI Member, Employee Posts: 201
    100 Likes 100 Comments First Anniversary Ansys Employee
    ✭✭✭✭
    edited August 2023 Answer ✓

    While looping one can use the following code :

    currentIds = ExtAPI.SelectionManager.CurrentSelection.Ids
    for id in currentIds :
      geoBody = ExtAPI.DataModel.GeoData.GeoEntityById(id)
      treeBody = ExtAPI.DataModel.Project.Model.Geometry.GetBody(geoBody)
      treeBody.GenerateMesh()
    

    and without looping (after activating all tree objects) :

    cmd="""DS.Script.doModelPreviewMesh();"""
    ds=ExtAPI.Application.ScriptByName("jscript").ExecuteCommand(cmd)
    

Answers