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

Offset Path method?

Guest
Nov 21, 2008 Nov 21, 2008
Hi there,

Does anyone know if there is a method in the Illustrator DOM that allows you to do the equivalent of the Offset Path command (found in the Object / Path menu of the Illustrator UI)? I am working with JavaScript (using the ESTK) and have both CS3 & CS4 but cannot find it anywhere in the documentation. If this does not exist, what would be the most appropriate / effective way to request that it be added to the DOM - I really need this feature for the project I am working on.

Many thanks,

Andy McDonald (Scotland)
TOPICS
Scripting
5.7K
Translate
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
Community Expert ,
Jan 03, 2009 Jan 03, 2009
Sorry to say that to the best of my limited knowledge of Illustrator-Scripting this is not scriptable.
I made basically the same inquiry some time back and it didnt turn up any such method (edit).
Translate
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
Guest
Feb 17, 2009 Feb 17, 2009
I think the Appearance Panel is not scriptable.
Translate
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
Guest
Feb 17, 2009 Feb 17, 2009
I wish there is a way (in scripting) to get object properties and manipulate it, just like actually using Illustrator Appearance Panel.

Cheers,
Translate
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
New Here ,
Feb 18, 2009 Feb 18, 2009
I'm new to scripting but old to AI.

An offset path could be achieved by duplicating the object and scaling it up or down. The maths to scale might involve converting between an overall size percentage change and the offset distance needed but pretty straight forward I would think. Has nothing to do with multiple stroke instances from how I interpreted your question.

Now you just need help with the scripting code!
Translate
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
Community Expert ,
Feb 18, 2009 Feb 18, 2009
WEP, as I understand it Offset Path and Scaling are two very different things.
If for example one had a form with a hole, Offset Path (with a positive value) would close that hole at some point, whereas Scaling would never close the hole.
Translate
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
New Here ,
Feb 18, 2009 Feb 18, 2009
@christoph

that's totally correct. object would have to separated into non-compound shapes and expanded and contracted according to inside/outside path quality. The script just got a whole lot more complicated...

still if wanting to do a whole lot of offsets and non-compound shapes are being used script should be fast.
Translate
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
Advocate ,
Feb 18, 2009 Feb 18, 2009
It has nothing to do with compound shapes. Simple shapes (squares, circles, octagons) will have the same effect when scaling as an offset path, but try the same to the letter 'S'. Doesn't work. Offset Path expands the shape in all directions perpendicularly.

Unfortunately, the methods available to the path item are limited. I don't think there is any way to work with the paths like you can in the UI other than the few methods that are available.
Translate
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
New Here ,
Feb 19, 2009 Feb 19, 2009
True. I was thinking about letter 'S' just after I posted.

The maths involved seems complex. Even if scripting could sample the anchor point co-ords (x,y) and move them, the mapping is not fully apparent to me.

I tried scaling various parts of the 'S' to match a +4 mm offset and there's no easy correlation.

Any ideas on the function? Can AI scripting move anchor points and curve handles?

Nodebox?
Translate
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
Community Expert ,
Feb 19, 2009 Feb 19, 2009
Well, any irregular shape will produce different results with Scaling instead of Offsetting, even rectangles (edit: with the exception of the square).
Doesnt it seem a bit strange though to have to try and mathematically recreate a function that already exists in Illustrator?
Albeit regrettably out of Scriptings reach, it seems.
Translate
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
New Here ,
Feb 19, 2009 Feb 19, 2009
Totally correct, again.
Translate
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
Guest
Mar 24, 2009 Mar 24, 2009
Hi again,

It seems I forgot to subscribe to my own forum topic - I just assumed there had been no response! With the help of Dr Woohoo, I managed to find a semi-workaround that suits my needs for the moment. Basically, you need to create a new Graphic Style using the Appearance panel (where you can access the Offset Path feature through the FX options) and save it. From there you can use 'document.graphicStyles.getByName("Graphic Style Name");' in conjunction with the applyTo() and mergeTo() methods. The only downside is that you do not have access to the offset amount as a variable therefore the value must be hard-coded when you create the graphic style (ie: a separate graphic style must be created for each offset amount you intend to use).

Hope this helps...

Cheers,

Andy McDonald
Translate
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
Community Expert ,
Mar 25, 2009 Mar 25, 2009
Andy, thats some good workaround, thanks for sharing it!
Translate
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
New Here ,
Mar 26, 2009 Mar 26, 2009
Dr Woohoo knows his stuff!
Translate
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
Community Expert ,
Mar 31, 2009 Mar 31, 2009
LATEST
Kind of a follow-up:
For some purposes I had to use the expanded results of the offset paths and couldnt find a direct way to Expand Appearance via JavaScript.
But I found I could force that by saving as an Illustrator 8-file with
flattenSaveOptions.compatibility = Compatibility.ILLUSTRATOR8;
flattenSaveOptions.flattenOutput = OutputFlattening.PRESERVEAPPEARANCE;
then close and open that and copy/paste the resulting elements back into the document.
Translate
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