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.
mmb's picture

want to delete Layer along with its content

hello

i want to delete some layers along with its content which contain geometry, light, cameras.

thanks for the Help!

miauu's picture

.

(
	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 
			(
				delete theNodes
				LayerManager.deleteLayerbyname layerName
			)
			else 
			(
				LayerManager.deleteLayerbyname layerName
			)
		)
	)
	--	"replace "Layer001","Layer003","Layer007" with the names of the layers you watn to delete. Add as many names as you want."
	layersToDeleteArr = #("Layer001","Layer003","Layer007")
	for o in layersToDeleteArr do
	(
		deleteLayerByName o
	)
)
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.