We’re putting the final touches on our new badges platform. Badge issuance remains temporarily paused, but all completions are being recorded and will be fulfilled once the platform is live. Thank you for your patience.

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)