Hi
How do I delete all the objects on a certain layer which is hidden by code?
You could try the open source Python DelAll component from here:
mMaterial_bake_to_layer_2020Jan30a.gh (39.5 KB)
import rhinoscriptsyntax as rs
import scriptcontext as sc
from Rhino import RhinoDoc
if (delete):
try:
sc.doc = RhinoDoc.ActiveDoc
for aLayer in layer:
if rs.IsLayer(aLayer):
objects = rs.ObjectsByLayer(aLayer, False)
if (objects and len(objects) > 0):
rs.DeleteObjects(objects)
print('{0} deleted [{1}]'.format(len(objects), aLayer))
finally: #restore original Grasshopper document as default
sc.doc = ghdoc
4 Likes