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

Options
Chemsdine CHEMAI
Chemsdine CHEMAI Member, Employee Posts: 201
First Anniversary Ansys Employee Solution Developer Community of Practice Member 5 Likes
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
    First Anniversary Ansys Employee Solution Developer Community of Practice Member 5 Likes
    edited August 2023 Answer ✓
    Options

    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)