How to get the unmeshed parts by script?

Options
Louis
Louis Member Posts: 16
First Comment Photogenic Name Dropper
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: 810
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Answer ✓
    Options

    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
    First Comment Photogenic Name Dropper
    Options

    Pernelle,

    It works, thank you very much!

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 283
    First Anniversary First Comment 5 Likes Ansys Employee
    Options

    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
    Options

    Hello Michael,

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

    Failed mesh -> Fully defined
    Meshed ok -> Meshed