# Layer Methods
# Layer
The Layer
method can be used to add, duplicate, edit, and remove layers.
The action performed is set by the mode
property value, which can be add
, addEdit
, duplicate
, edit
, or remove
.
For convenience, you can use the addLayer
, addEditLayer
, duplicateLayer
, editLayer
, and removeLayer
methods which automatically set the mode.
The default layer mode is addEdit
this mode will edit a layer if it exists and if it does not exist it will add the layer.
Besides the properties available in Layer Options, the layer can be moved relative to other layers, or tagged artwork.
# Layer Options
Layer Options
Use the name
or number
properties to target which layer to edit, duplicate or remove.
Set the layer's options using the name
, newName
, template
, locked
, visible
, print
, preview
, dim
and dimPercent
properties.
When adding a new layer you can use the name
property to set its name. When editing or duplicating a layer, use newName
to set the new name.
See layer color for details on setting the layers color.
# Location
Layers are by default added and duplicated above existing layers or, if provided above a targetLayer
or targetTagSearch
.
You can set the layer's exact location
, by providing a targetLayerName
, targetLayerNumber
and / or a targetTagSearch
.
Set the location
property's value to aboveAll
or belowAll
to place the layer at the top or bottom of the document.
Set the location
property's value to top
and bottom
to place the layer at the top or bottom of a layer or group.
Set the location
property's value to above
and below
to place the layer above or below a tagged target artwork or a layer.
The default value of location
is above
.
# Layer Color
Use the color
property to set the color of the layer, i.e. the color that shows next to the layer on the layer panel and the paths of the panel's artwork.
Hex, decimal values and named values can be provided to set the layer.
#ff0000
, ff0000
, f00
(6 or 3 digit hex values), 255, 0, 0,
(rgb values), 0 100 100 0
(cmyk) 50 127 50 lab
lab, red
(CSS named color or custom color name) all would set the layer color to red.
Named colors can be enabled and disabled in the settings tab. Named colors with spaces like, light blue
should be either quoted "light blue"
or written as lightBlue
(Not case sensitive), light-blue
or light_blue
.
# Removing Layers
To remove a layer, use the remove
mode or the removeLayer
method.
Set the number
or name
of the layer to be removed. The layer's sublayers and artwork will be deleted.
# Layer Properties
Property | Modes used with | Description |
---|---|---|
color | addEdit add duplicate edit | The layer color as shown in the layers panel and the layers artwork paths. Sample Values: #ff0000 , ff0000 , f00 (6 or 3 digit hex values), 255, 0, 0, (rgb values), 0 100 100 0 (cmyk) 50 127 50 lab lab, red (CSS named color or custom color name) |
dimPercent | addEdit add duplicate edit | The percentage that images should be dimmed, if set to -1 the images will not be dimmed. Valid Values: -1 10 , 50 , 70 |
location | addEdit add duplicate edit | The location where the layer should be relative to the target. Sample Values: aboveAll or belowAll to place the layer at the top or bottom of the document top and bottom place the layer at the top or bottom of a layer or group. above and below to place the layer at the above or below artwork or a layer. |
locked | addEdit add duplicate edit | Whether or not the layer is locked. Valid Values: true or false |
mode | addEdit add duplicate edit remove | When using the layer method, the mode, which sets the process to be done to the layers, must be set. When using addLayer , addEditLayer , duplicateLayer , editLayer , or removeLayer methods, the mode is set automatically. Valid Values: add addEdit [Default] duplicate edit remove |
name / layerName | addEdit add duplicate edit remove | The case sensitive name of the layer to be processed. Use either name or number and not both. Sample Values: Layer 1 , Images |
newName | addEdit add duplicate edit | The new name the layer should be called. Valid Values: true or false |
number / layerNumber | addEdit add duplicate edit remove | The index of the layer to be processed. Use either layerName or layerNumber and not both. Sample Values: 1 , 4 |
preview | addEdit add duplicate edit | Whether or not the layer should preview. Valid Values: true or false |
print | addEdit add duplicate edit | Whether or not the layer should print. Valid Values: true or false |
targetLayerName / parent | addEdit add duplicate edit | The name of the target layer, relative to which the location of the new or edited layer is given. Sample Values: Layer 1 , Images |
targetLayerNumber | addEdit add duplicate edit | The number of the target layer, relative to which the location of the new or edited layer is given. Sample Values: 1 , 4 |
targetTagSearch | addEdit add duplicate edit | The tagSearch relative to which the location of the new or edited layer is given. If a target layer is also provided, then the artwork matching the tagSearch in the given layer will be used. Sample Values: Layer 1 , Images |
template | addEdit add duplicate edit | Whether or not the layer is a template. Valid Values: true or false |
visible | addEdit add duplicate edit | Whether or not the layer is visible. Valid Values: true or false |
* | addEdit add duplicate edit remove | Set to false if you want the method to be skipped in a particular row. Valid Values: true or false |
skip | addEdit add duplicate edit remove | Set to true is you want the method to be skipped in a particular row. See * and Skip for details. Valid Values: true or false |
# Example Spreadsheet and Screenshots
# Spreadsheet using layer
and mode
* | ||||||||||||
layer | ||||||||||||
mode | name | newName | color | targetLayer | target | location | visible | locked | preview | template | dimPercentage | |
add | ||||||||||||
add | Gold | gold | Orange Layer | above | TRUE | |||||||
duplicate | Green Layer | Locked and Hidden | #bca | Blue Layer | blue | below | FALSE | TRUE | ||||
edit | Orange Layer | GrassGreen | Green Layer | bottom | FALSE | |||||||
edit | Green Layer | Gray Layer | grayscale 20 | TRUE | FALSE | 25 | ||||||
edit | Blue Layer | 0 0 255 | aboveAll | |||||||||
remove | Blue Layer |
Original Artwork
Original Artwork
Row 1 Artwork
Row 1 Panelmode: add
Row 2 Artwork
Row 2 Panelmode: add
name: Gold
color: gold
targetLayer: Orange Layer
location: above
template: true
Row 3 Artwork
Row 3 Panelmode: duplicate
name: Green Layer
newName: Locked and Hidden
color: #bca
targetLayer: Blue Layer
target: blue
location: above
visible: false
locked: true
Row 2 Artwork
Row 2 Panelmode: add
name: Gold
color: gold
targetLayer: Orange Layer
location: above
template: true
Row 3 Artwork
Row 3 Panelmode: duplicate
name: Green Layer
newName: Locked and Hidden
color: #bca
targetLayer: Blue Layer
target: blue
location: above
visible: false
locked: true
Row 4 Artwork
Row 4 Panelmode: edit
name: Orange Layer
color: GrassGreen
targetLayer: Green Layer
location: bottom
preview: false
Row 5 Artwork
Row 5 Panelmode: edit
name: Green Layer
newName: Gray Layer
color: grayscale 20
locked: true
print: false
dimPercentage: 25
Row 6 Artwork
Row 6 Panelmode: edit
name: Blue Layer
color: 0 0 255
location: aboveAll
Row 7 Artwork
Row 7 Panelmode: remove
name: Blue Layer
# Spreadsheet using addLayer
* | ||||
addLayer | ||||
name | color | targetLayer | location | template |
Gold | gold | Orange Layer | above | TRUE |
# Spreadsheet using addEditLayer
* | ||||
Comment | addEditLayer | |||
* | name | color | locked | visible |
Edits the "Red" layer if it exists, otherwise adds the new layer | Red | red | FALSE | TRUE |
Edits the "Layer 2" layer if it exists, otherwise adds the new layer | Layer 2 | #f80 | FALSE | FALSE |
Edits the "Gold" layer if it exists, otherwise adds the new layer | Gold | gold | TRUE | TRUE |
# Spreadsheet using duplicateLayer
* | |||||||
duplicateLayer | |||||||
name | newName | color | targetLayer | target | location | visible | locked |
Green Layer | Locked and Hidden | #bca | Blue Layer | blue | below | FALSE | TRUE |
# Spreadsheet using editLayer
* | ||||||||
editLayer | ||||||||
name | newName | color | targetLayer | location | locked | preview | dimPercentage | |
Orange Layer | GrassGreen | Green Layer | bottom | FALSE | ||||
Green Layer | Gray Layer | grayscale 20 | TRUE | FALSE | 25 | |||
Blue Layer | 0 0 255 | aboveAll |
# Spreadsheet using removeLayer
* | |
removeLayer | |
name | LayerNumber |
Blue Layer | |
1 |