We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.

Ansys Learning Forum Forums Discuss Simulation 3D Design Select all objects in Layer Reply To: Select all objects in Layer

David Hills
Subscriber

An Ansys engineer has helped me to close this issue. The resulting code is:

 

def fillSelected(layer_curves):
    #fill the curves in the layer. this creates a new surf body
    selection = Selection.Create(layer_curves)
    secondarySelection = Selection.Empty()
    options = FillOptions()
    result = Fill.Execute(selection, secondarySelection, options, FillMode.ThreeD)

allCurves = GetRootPart().GetDescendants[IDesignCurve]()
for layer in Layers.GetAllLayers():
    layer_curves=[i for i in allCurves if i.Layer==layer]
    if not len(layer_curves)==0:
        Layers.Activate(layer.GetName())
        fillSelected(layer_curves)