function CleanUpLayers=
(
/*
set the (default) layer as the current one and delete all empty layers
*/
local nLayers = LayerManager.Count
local defaultLayer = LayerManager.GetLayer(0)
defaultLayer.current = true
local layers = #()
for i= 1 to nLayers do append layers (LayerManager.GetLayer(i-1))
for layer in layers do
(
layer.nodes &nodes
if ( layer.name != "0" and nodes.count == 0 ) then
LayerManager.deleteLayerByName layer.name
)
)