ScriptSpot

Forum topic · Scripts Wanted

Create Layer

By ubikstudio · 2014-12-24

Description

Hello,

i try to do a littel scrip but without success ..this is why i ask for your help

i want the script to create somes layers with specific names ex " 0_CAD , 1_VOLUME, 3_FLOOR.." with spesific layer color and for one of them "show frozen in gray disabled"

thats all....

thanks a lot for your help

i wish you a merry christmas and a happy new year

Comments (1)

barigazy · 2014-12-24

Here is your code


fn createLayers names: wirecolors: frozenGray: =
(
	local lMgr = layerManager, layers = #()
	if lMgr.count > 1 do for i = 1 to lMgr.count-1 do append layers (lMgr.getlayer i).name
	if isKindOf names array and names.count > 0 do
	for n = 1 to names.count where findItem layers names[n] == 0 do
	(
		node = lMgr.newlayerfromname names[n]
		node.wirecolor = wirecolors[n]
		setProperty node #showFrozenInGray frozenGray[n]
	)
)
createLayers names:#("0_CAD", "1_VOLUME", "3_FLOOR", "4_WALLS", "5_WINDOWS", "6_DOORS", "7_TREES") \
wirecolors:#([63,178,7], [40,7,206], [224,109,10], [238,35,131], [35,97,238], [0,73,10], [106,30,3]) \
frozenGray:#(on, on, off, on, on, on, off)