Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.

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

dave.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)

[bingo_chatbox]