The Artwork Tree
The Artwork Tree
Section titled “The Artwork Tree”The content of an Illustrator document is called the artwork tree. Artwork is represented by the following objects:
compound path itemgraph itemgroup itemlegacy text itemmesh itemnon native itempath itemplaced itemplugin itemraster itemsymbol item(see Dynamic Objects)text frame
Your scripts can access and manipulate art objects through collections in the document and layer objects.
There are two types of art-object collections:
- Collection objects that correspond to each individual artwork object type, such as the
graph itemsobject or themesh itemsobject. - The
page itemsobject, which includes art objects of all types.
Also, you can use the group item object to reference a grouped set of art items.
You can create new art objects using the make command (AppleScript) or add method of an artwork item collection object. For example, to create a new path item object:
| Language | Command |
|---|---|
| AppleScript | set myPathItem to make new path item in current document |
| JavaScript | var myPathItem = activeDocument.pathItems.add(); |
| VBScript | Set myPathItem = appRef.ActiveDocument.PathItems.Add() |
The following artwork collections do not allow the creation of new objects using the make command or add method:
graph itemsobjectmesh itemsobjectplugin itemsobjectlegacy text itemsobject
For details on creating objects of these types, see the Adobe lllustrator CC Scripting Reference for your language.
Art styles
Section titled “Art styles”Your script can apply a graphic style to artwork using the graphic style object. To apply a graphic style, use the graphic styles property of the document object to access the apply to method of the graphic style object.
Similarly, the brush object allows you to specify the brush to apply to artwork. You access any brush through the brushes collection object, which is a property of the document object.
Color objects
Section titled “Color objects”Your script can apply a color, pattern or gradient to a path item object, using the fill color or stroke color properties:
- Scripts can define new color swatches using the
makecommand or add method of theswatchesobject. Your script also can create a new spot color, using themakecommand oraddproperty of thespotsobject. - You can define the attributes of an ink object using the
ink infoobject, which is aninkobject property. You accessinkobjects through theink listproperty of thedocumentobject.
The following objects allow you to create colors within defined color spaces:
- The
RGB colorobject, using the range 0.0 to 255.0 for the each of the three individual color values. - The
CMYK colorobject, using the percentage values 0.0 through 100.0 for each of the four individual color values. - The
grayscale colororLAB colorobjects, using the same range and number of values that you use in the Illustrator application.