specfic layer delete fuction

hi friends
i come here again for help
i am seeking layer delete function

example :

layer name is good-roof

i would like to delete that with script

can you help me again pls

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

Delete Layer By Name

This is your code (function):

fn deleteLayerByName layerName = 
(
	--set 0-layer to be current
	(layermanager.getlayer 0).current = true
	--find layer that you need to delate
	layerToDelete = LayerManager.getLayerFromName layerName
	if layerToDelete == undefined then (messagebox ("Layer *"+layerName+"* don't exist!!!") title:"DeleteLayerByName" beep:false) else
	(
		layerToDelete.nodes &theNodes -- check if layer is empty then delete it
		if theNodes.count != 0 then (messagebox ("Layer *"+layerName+"* is not empty!!!") title:"DeleteLayerByName" beep:false)
		else (LayerManager.deleteLayerbyname layerName)
	)
)
deleteLayerByName "good-roof"

barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.