• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Duplicate an outline path?

New Here ,
Jan 06, 2017 Jan 06, 2017

Copy link to clipboard

Copied

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");

app.executeMenuCommand("expandStyle");

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?

TOPICS
Scripting

Views

429

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Valorous Hero ,
Jan 07, 2017 Jan 07, 2017

Copy link to clipboard

Copied

LATEST

How are you iterating over the path items in your new group after the expansion? When expanded, a stroke with arrowheads produces one path item which is the line and two group items each of which contain one path which is the arrowhead triangle.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines