Mechanical scripting: nodes associated with a named selection?

Erik Kostson
Erik Kostson Member, Employee Posts: 87
First Answer Name Dropper First Anniversary Ansys Employee
edited June 2023 in Structures

Using mechanical scripting in python, how can I access the nodes associated with a named selection?

Tagged:

Best Answer

  • Erik Kostson
    Erik Kostson Member, Employee Posts: 87
    First Answer Name Dropper First Anniversary Ansys Employee
    Answer ✓

    Below is a script that does this:

    ns=model.NamedSelections.Children
    f=ns[0].Location.Ids
    meshData = ExtAPI.DataModel.Project.Model.Analyses[0].MeshData
    faceMesh = meshData.MeshRegionById(f[0])
    nodes=faceMesh.NodeIds