If a pathItem has a brush is there a way to access this properties to see what brush is applied to the pathItem. Here is my code thus far:
The code is meant to loop through all pathItems find a specific brush that is applied to a pathItem and update it to a new brush.
Thanks for any help.
#target illustrator
/***************************************************************************************** ****************************************
@Param takes a specified brush name
@Return returns an index of the specified brush name
****************************************************************************************** ***************************************/
function getIndex(brush_name)
{
for (var i = 0; i < app.activeDocument.brushes.length; i++)
{
if(app.activeDocument.brushes[i].name == brush_name)
{
return i
}
}
}
/***************************************************************************************** ****************************************
Loop through the pathItems and update the pathItem with a new brush
****************************************************************************************** ***************************************/
function changeBrush()
{
var brush_index_01 = getIndex("brush_01");
var brush_index_02 = getIndex("brush_02");
var brush_index_03 = getIndex("brush_03");
for (var j = app.activeDocument.pathItems.length - 1; j >= 0; j--)
{
if(app.activeDocument.pathItems[j].layer.name == "Callouts")
{
var selected_item = app.activeDocument.pathItems[j];
selected_item.selected = true;
app.activeDocument.brushes[old_doted_arrow].applyTo(selected_item);
}
}
app.redraw();
}
function main()
{
changeBrush()
}
main();