我正在寻找一个 ACT 命令来选择连接到一条线的所有元素。在 MAPDL 中,此命令称为 ESLL。目前,我的脚本将元素保存在命名选择中,看起来有点笨拙:
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 ()