Symbols
Symbols
Section titled “Symbols”app.activeDocument.symbols
Description
Section titled “Description”The collection of Symbol objects in the document.
Properties
Section titled “Properties”Symbols.length
Section titled “Symbols.length”app.activeDocument.symbols.length
Description
Section titled “Description”Number of elements in the collection.
Number; read-only.
Symbols.parent
Section titled “Symbols.parent”app.activeDocument.symbols.parent
Description
Section titled “Description”The object’s container.
Object; read-only.
Symbols.typename
Section titled “Symbols.typename”app.activeDocument.symbols.typename
Description
Section titled “Description”The class name of the object.
String; read-only.
Methods
Section titled “Methods”Symbols.add()
Section titled “Symbols.add()”app.activeDocument.symbols.add(sourceArt[, registrationPoint])
Description
Section titled “Description”Returns a symbol object created from the source art item, any of the following:
- CompoundPathItems
- GroupItems
- MeshItems
- NonNativeItems
- PageItems
- PathItems
- RasterItems
- SymbolItems
- TextFrameItems
The default registration point is SymbolRegistrationPoint.SYMBOLCENTERPOINT
.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
sourceArt | PageItem | Source art to create symbol from |
registrationPoint | SymbolRegistrationPoint, optional | Registration point to use |
Returns
Section titled “Returns”Symbols.getByName()
Section titled “Symbols.getByName()”app.activeDocument.symbols.getByName(name)
Description
Section titled “Description”Get the first element in the collection with the provided name.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
name | String | Name of element to get |
Returns
Section titled “Returns”Symbols.index()
Section titled “Symbols.index()”app.activeDocument.symbols.index(itemKey)
Description
Section titled “Description”Gets an element from the collection.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
itemKey | String, Number | String or number key |
Returns
Section titled “Returns”Symbols.removeAll()
Section titled “Symbols.removeAll()”app.activeDocument.symbols.removeAll()
Description
Section titled “Description”Deletes all elements in the collection.
Returns
Section titled “Returns”Nothing.
Example
Section titled “Example”Creating a symbol
Section titled “Creating a symbol”// Creates a path item from each graphic style// then adds each item as a new symbol
var docRef = documents.add();var y = 750;var x = 25;
var iCount = docRef.graphicStyles.length;
for (var i=0; i<iCount; i++) {
var pathRef = docRef.pathItems.rectangle( y, x, 20, 20 ); docRef.graphicStyles[i].applyTo(pathRef);
// are we at bottom? if ( (y-=60) <= 60 ) { y = 750; // go back to the top. x+= 200 }
redraw(); docRef.symbols.add(pathRef);}