If statement to delete a layer

Hello Guys,

how to use if statement to delete other layers except for the “Default” one.

Hi,
In python you would do it like so:

import rhinoscriptsyntax as rs

layerNames = rs.LayerNames()
for layer in layerNames:
    if layer != "Default":
        rs.PurgeLayer(layer)
1 Like

thanx mate… it’s gonna help