1 Reply Latest reply on Jan 7, 2017 8:15 AM by Silly-V

    Duplicate an outline path?


      I have a client who has some Styles they're still using from the pre-CS5 era which have "add arrowhead" appearance styles, but these no longer work in Illustrator CC 2015.3 (actually, existing paths are rendered correctly, they just can't duplicate/move/re-apply). The styles basically implement a solid path with an arrowhead, and an outline/border of a different color. This wasn't possible to replicate in Illustrator CC 2015.3 as arrowheads didn't align correctly, but we can replicate it in Illustrator CC 2017 by converting the path with arrowhead to an outline and duplicating it (solid filling one, and applying an outline stroke to the other).


      It's a more involved process than just a style (their old style applied multiple strokes with multiple "add arrowhead" appearances, so it was implemented entirely as a style), but I believe it's scriptable.


      I seem to reasonably be able to convert a selected path (with an arrowhead, in this case) to an outline as follows:

      app.executeMenuCommand("Live Outline Stroke");


      However, I can't seem to then be able to reliably duplicate that pathGroup to then apply different appearances to each. If I iterate over the pathItems in the newly-selected groupItem and duplicate as follows:

      var newPath = aPath.duplicate(theGroup, ElementPlacement.PLACEATEND);

      I end up with a copy of the originally-selected path (though I've verified it's a groupItem) with some apparently empty additional groupItems.


      I must admit that while I am a JavaScript developer and can find my way around Illustrator, I'm not an Illustrator pro and so don't quite understand some of the gotchas (esp. since Adobe's JavaScript reference documentation doesn't have a whole lot in the way of examples). What might I be missing here?