0
Offset Path method?

/t5/illustrator-discussions/offset-path-method/td-p/1161431
Nov 21, 2008
Nov 21, 2008
Copy link to clipboard
Copied
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)
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explore related tutorials & articles
Community Expert
,
/t5/illustrator-discussions/offset-path-method/m-p/1161432#M237695
Jan 03, 2009
Jan 03, 2009
Copy link to clipboard
Copied
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).
I made basically the same inquiry some time back and it didnt turn up any such method (edit).
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/illustrator-discussions/offset-path-method/m-p/1161433#M237696
Feb 17, 2009
Feb 17, 2009
Copy link to clipboard
Copied
I think the Appearance Panel is not scriptable.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/illustrator-discussions/offset-path-method/m-p/1161434#M237697
Feb 17, 2009
Feb 17, 2009
Copy link to clipboard
Copied
I wish there is a way (in scripting) to get object properties and manipulate it, just like actually using Illustrator Appearance Panel.
Cheers,
Cheers,
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/illustrator-discussions/offset-path-method/m-p/1161435#M237698
Feb 18, 2009
Feb 18, 2009
Copy link to clipboard
Copied
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!
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!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/illustrator-discussions/offset-path-method/m-p/1161436#M237699
Feb 18, 2009
Feb 18, 2009
Copy link to clipboard
Copied
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.
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.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/illustrator-discussions/offset-path-method/m-p/1161437#M237700
Feb 18, 2009
Feb 18, 2009
Copy link to clipboard
Copied
@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.
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.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Advocate
,
/t5/illustrator-discussions/offset-path-method/m-p/1161438#M237701
Feb 18, 2009
Feb 18, 2009
Copy link to clipboard
Copied
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.
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.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/illustrator-discussions/offset-path-method/m-p/1161439#M237702
Feb 19, 2009
Feb 19, 2009
Copy link to clipboard
Copied
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?
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?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/illustrator-discussions/offset-path-method/m-p/1161440#M237704
Feb 19, 2009
Feb 19, 2009
Copy link to clipboard
Copied
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.
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.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/illustrator-discussions/offset-path-method/m-p/1161441#M237707
Feb 19, 2009
Feb 19, 2009
Copy link to clipboard
Copied
Totally correct, again.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/illustrator-discussions/offset-path-method/m-p/1161442#M237708
Mar 24, 2009
Mar 24, 2009
Copy link to clipboard
Copied
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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/illustrator-discussions/offset-path-method/m-p/1161443#M237709
Mar 25, 2009
Mar 25, 2009
Copy link to clipboard
Copied
Andy, thats some good workaround, thanks for sharing it!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/illustrator-discussions/offset-path-method/m-p/1161444#M237710
Mar 26, 2009
Mar 26, 2009
Copy link to clipboard
Copied
Dr Woohoo knows his stuff!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/illustrator-discussions/offset-path-method/m-p/1161445#M237711
Mar 31, 2009
Mar 31, 2009
Copy link to clipboard
Copied
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.
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.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

