How to get the unmeshed parts by script?

Louis
Louis Member Posts: 16
10 Comments Name Dropper Photogenic
**
edited June 2023 in Structures

If mesh status is not Solved, how to get the unmeshed parts by script in Mechanical, Ansys Ls-dyna?

Best Answer

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 859
    500 Comments Photogenic Name Dropper Solution Developer Community of Practice Member
    ✭✭✭✭
    Answer ✓

    Hi @Louis , I'd loop on the different bodies and check those who have 0 elements (or 0 nodes) attached to them:

    bodies = ExtAPI.DataModel.Project.Model.Geometry.GetChildren(DataModelObjectCategory.Body, True)
    for body in bodies:
        if body.Suppressed is False:
            if body.Elements == 0:
                print ('Mesh was no generated for body named: '+str(body.Name))
    

Answers

  • Louis
    Louis Member Posts: 16
    10 Comments Name Dropper Photogenic
    **

    Pernelle,

    It works, thank you very much!

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 327
    25 Answers First Anniversary 100 Comments 25 Likes
    ✭✭✭✭

    FYI you can also look at the body object status in Mechanical. Below is a snippet of two bodies. One is meshed and the other is not. FullyDefined is the non-meshed body, while the one with a defined mesh has state of "Meshed"

    Object state is a good property for detailed state info on all objects.

    print Bodies[0].ObjectState
    FullyDefined

    print Bodies[1].ObjectState
    Meshed

  • rr_velazquez_esss
    rr_velazquez_esss Member Posts: 3
    First Comment
    **

    Hello Michael,

    I've not seen your response (plenty of bounced emails), but the solution works!

    Failed mesh -> Fully defined
    Meshed ok -> Meshed