Brush
app.activeDocument.brushes[index]
Description
Section titled “Description”A brush in an Illustrator document. Brushes are contained in documents. Additional brushes may be created by the user within Illustrator. You can access brushes within a script, but you cannot create them.
Properties
Section titled “Properties”Brush.name
Section titled “Brush.name”app.activeDocument.brushes[index].name
Description
Section titled “Description”The name of the brush
String
Brush.parent
Section titled “Brush.parent”app.activeDocument.brushes[index].parent
Description
Section titled “Description”The document that contains this brush.
Document; read-only.
Brush.typename
Section titled “Brush.typename”app.activeDocument.brushes[index].typename
Description
Section titled “Description”The class name of the referenced object.
String; read-only.
Methods
Section titled “Methods”Brush.applyTo()
Section titled “Brush.applyTo()”app.activeDocument.brushes[index].applyTo(artItem)
Description
Section titled “Description”Applies the brush
to a specific art item.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
artItem | PageItem | Art item to apply brush to |
Returns
Section titled “Returns”Nothing.
Example
Section titled “Example”Applying a Brush
Section titled “Applying a Brush”// Duplicates and groups all items in the current selection,// then applies the same brush to each item in the group
if (app.documents.length > 0) { var docSelection = app.activeDocument.selection; if (docSelection.length > 0) { var newGroup = app.activeDocument.groupItems.add();
for (var i = 0; i < docSelection.length; i++) { var newItem = docSelection[i].duplicate(); newItem.moveToBeginning(newGroup); }
var brush = app.activeDocument.brushes[1]; brush.applyTo(newGroup); }}