ExtendedScript - apply arrowheads to a path object
Hello to all the nice people!
For more than a week I'm stuck with the problem of how to apply arrowheads to my path object. I can apply color or swatch color, I can define width, overprint, dashes, but I can't figure out arrowheads (specifically I want to apply "Arrow 1" style from Illustrator native library). Asked ChatGPT hundred times with no results that would work, searched Google and Github. No luck. Below is a snippet in which I define a function to use it later with several path objects. Could someone please show a way to do this task or at least suggest a resource in which I could search for proper commands and arguments.
Thanks in advance!
// Define a path object Style3 (arrows)
var pathStyle3 = {
strokeColor: doc.swatches.getByName("Keyline").color,
strokeDashes: [],
strokeWidth: 0.1 * mm,
filled: false
};
// Function to apply the path style to a path item
function applyPathStyle3(pathItem, pathStyle3) {
pathItem.strokeColor = pathStyle3.strokeColor;
pathItem.strokeDashes = pathStyle3.strokeDashes;
pathItem.strokeWidth = pathStyle3.strokeWidth;
pathItem.strokeOverprint = true;
pathItem.filled = pathStyle3.filled;
}
