python-2.7ansys

Is there an equivalent to ESLL in ANSYS ACT?


I'm looking for an ACT command that selects all elements that are connected to a line. In MAPDL this command was called ESLL. Currently my script, which saves the elements in a named selection, looks kind of clunky:

geo_body = geo_data.GeoEntityById (line_body) # Get geoEdgeWrapper id
tree_body = tree_geometrie.GetBody (geo_body) # get connected body in tree
sel.Ids = [geo_body.Id] # construct selection from id
## Results
namedSel = ExtAPI.DataModel.Project.Model.NamedSelections.AddNamedSelection ()
namedSel.Name = tree_body.Name + '_elements'
namedSel.ScopingMethod = GeometryDefineByType.Worksheet
namedSel.GenerationCriteria.Add (None)
namedSel.GenerationCriteria [0] .EntityType = SelectionType.GeoBody
namedSel.GenerationCriteria [0] .Criterion = SelectionCriterionType.Name
namedSel.GenerationCriteria [0] .Operator = SelectionOperatorType.Equal
namedSel.GenerationCriteria [0] .Value = tree_body.Name
namedSel.GenerationCriteria.Add (None)
namedSel.GenerationCriteria [1] .Action = SelectionActionType.Convert
namedSel.GenerationCriteria [1] .EntityType = SelectionType.MeshElement
namedSel.Generate ()

Solution

  • You can actually retrieve mesh data directly from geometric entities (using the Id). From your script, considering that you know the Id of your line body as 'line_body' var, you can do:

    # Get access to mesh data:
    meshGroup = ExtAPI.DataModel.MeshDataByName('Global')
    mesh_line = meshGroup.MeshRegionById(line_body)
    elem_line = mesh_line.Elements
    

    This will return list of element objects associated to the line body.

    Note that you can check name of meshes available in:

    meshGroup = ExtAPI.DataModel.MeshDataNames