Link in Zwischenablage kopieren
Kopiert
So blends have some annoying, unconfigurable behavior: if you have open paths in your blend then Illustrator won't automatically create a blend spine, and it insists on checking "knockout group" on the blend, which I almost never want.
I have a script that attempts to work around this. It saves the open/closed state of every selected path, makes them all closed, calls object>blend>make, unchecks knockout group, and attempts to restore the original open/closed state (but this doesn't seem to take any more).
Then it calls object>blend options. Because I almost inevitably do that after creating a blend. And this is where things get weird: the instant I start poking at the options in that window, everything my script did is *undone*. What the heck is going on here?
(And why does my loop that is supposed to restore the open/closed state of each path not seem to do anything half the time, either?)
// blend properly
#target Illustrator
#targetengine main
function Main(curDoc, sel, amountofselectedobjects) {
// we just fail silently if <2 paths are selected,
// just like the normal blend operation
if (amountofselectedobjects >= 2) {
firstPath = sel[0];
pathClosed = new Array();
// record closed/open state of all paths, close them all
for (var i = 0; i < amountofselectedobjects; i++) {
pathClosed [i] = sel[i].closed;
sel[i].closed = true;
// alert (pathClosed[i]);
}
app.executeMenuCommand('Path Blend Make');
// Illustrator thinks blends should default to having 'knockout group' turned on and I never want this.
firstPath.parent.parent.artworkKnockout = KnockoutState.DISABLED;
// attempt to restore closed/open status
// why does everything stay closed
// even though my diagnostic alert returns a few 'false'es
for (var i = 0; i < amountofselectedobjects; i++) {
sel[i].closed = pathClosed [i] ;
alert (pathClosed[i]);
}
// I would like to immediately pop up the blend options but for some reason
// this undoes the blend creation when I start cursoring around
// in the blend options window, wtf.
app.executeMenuCommand('Path Blend Options');
}
}
// initial setup: check for open document, fail quietly or invoke main function
if ( app.documents.length > 0 ) {
var curDoc = app.activeDocument;
var sel = curDoc.selection; // get selection Pageitems
var amountofselectedobjects = sel.length;
Main(curDoc, sel, amountofselectedobjects);
}
(also happy slightly belated seventh birthday to my uservoice request regarding this behavior)
Thanks for any wisdom y'all have to bring to this problem. 🙂
redraw the canvas to commit your changes right before you show the options
app.redraw();
function Main(curDoc, sel, amountofselectedobjects) {
// we just fail silently if <2 paths are selected,
// just like the normal blend operation
if (amountofselectedobjects >= 2) {
firstPath = sel[0];
pathClosed = new Array();
// record closed/open state of all paths, close them all
for (var i = 0; i < amountofselectedobjects; i++) {
pathClosed [i] = sel[i].closed;
sel[i].closed = true;
...
Link in Zwischenablage kopieren
Kopiert
redraw the canvas to commit your changes right before you show the options
app.redraw();
function Main(curDoc, sel, amountofselectedobjects) {
// we just fail silently if <2 paths are selected,
// just like the normal blend operation
if (amountofselectedobjects >= 2) {
firstPath = sel[0];
pathClosed = new Array();
// record closed/open state of all paths, close them all
for (var i = 0; i < amountofselectedobjects; i++) {
pathClosed [i] = sel[i].closed;
sel[i].closed = true;
// alert (pathClosed[i]);
}
app.executeMenuCommand('Path Blend Make');
// Illustrator thinks blends should default to having 'knockout group' turned on and I never want this.
firstPath.parent.parent.artworkKnockout = KnockoutState.DISABLED;
// attempt to restore closed/open status
// why does everything stay closed
// even though my diagnostic alert returns a few 'false'es
for (var i = 0; i < amountofselectedobjects; i++) {
sel[i].closed = pathClosed [i] ;
alert (pathClosed[i]);
}
app.redraw();
// I would like to immediately pop up the blend options but for some reason
// this undoes the blend creation when I start cursoring around
// in the blend options window, wtf.
app.executeMenuCommand('Path Blend Options');
}
}
// initial setup: check for open document, fail quietly or invoke main function
if ( app.documents.length > 0 ) {
var curDoc = app.activeDocument;
var sel = curDoc.selection; // get selection Pageitems
var amountofselectedobjects = sel.length;
Main(curDoc, sel, amountofselectedobjects);
}
Link in Zwischenablage kopieren
Kopiert
Thanks, that did the trick! ❤️
Link in Zwischenablage kopieren
Kopiert
by the way, I don't see the no-spine problem while blending open paths. I'm on Windows 11, Illustrator 29.6. So you might streamline your script if you don't have the problem either.
Link in Zwischenablage kopieren
Kopiert
Mac 14.7, Illustrator 29.3, and I've been having the no-spline problem for years. Still have it. Maybe it finally got fixed somewhere in the last few point releases. That'd be a nice surprise! That's the whole reason this script exists.
(Or maybe it isn't fixed, I just checked the 29.7 prerelease sitting on my machine and it's still doing this. Oh joy, do I feel like doing the nuke-my-prefs dance to see if that fixes it. I do not. Maybe the next time this script breaks. 🙂 )
Link in Zwischenablage kopieren
Kopiert
weird, perhaps it's a Mac only issue? I haven't seen other people report on it. Also, your UserVoice post didn't get much traction.
Does it happen if you blend open paths manually?
Link in Zwischenablage kopieren
Kopiert
I have so many ultra-specific uservoice posts and none of them ever get traction, sometimes I wonder why I bother even posting them.
If "select two open paths and do object>blend>make" counts as "blending manually" then yes it happens, the entire reason I wrote a script in the first place was to automate the super-annoying process of "make blend, swear at lack of spline, undo, close a path, make blend, open path".
Link in Zwischenablage kopieren
Kopiert
yeah that's what I meant, using the Menu Options to make the blend.
this is what I get blending an open path and a close one, there's a spine
Link in Zwischenablage kopieren
Kopiert
No spine is only when all of them are open paths. There are 4 situations when you don't get a spine.
Link in Zwischenablage kopieren
Kopiert
I see it now, two open object blends yield no spine indeed.
Link in Zwischenablage kopieren
Kopiert
Once upon a time, I seem to recall that I always got a spline, no matter what. Then it changed. I can't tell you when it changed as this was long before any versions that will still run on a modern Mac; the oldest one I can run right now is 2019 and it does this. If I was going to make a guess as to when it stopped working it'd probably be CS6, when the UI rewrite broke some other stuff like the wonderful Export panel we used to have.
I could be wrong, I could very well get a Classic Mac emulator up and running and fire up Illustrator 8 (my first version) and discover that it, too, does this, and that I was sighing and manually adding a blend spline to open-path blends for the entire time I've been using this thing until I finally wrote the first version of this script a couple years ago. 🙂
Link in Zwischenablage kopieren
Kopiert
In 2004 I participated in a quiz, run by an Adobe staff person on their personal blog. So I assume they have checked all their questions with the devs.
The 4 cases of no spine were one of the questions:
A) If there are at least three paths selected, and at least one of them is an open, unstroked, unfilled path, and at least two of them are not, then the open unpainted path is used as an initial spine and the other objects are moved onto it.
B) If the bounding box of the anchor points of each object encloses the bounding box of the anchor points of all the objects above it in the stacking order, then no spine path is created. (This is the ‘nested objects’ case.)
C) all centers are enclosed in the intersection that is built by of all objects
D) If all of the objects are open paths.
Link in Zwischenablage kopieren
Kopiert
Dang, I only knew about D because it's annoying me for 90% of the blends I create, thanks!
A is actually kinda useful, or would be if it was actually *documented* anywhere outside of places like "the heads of a handful of experts". I just checked it with three open, filled paths and one open, invisible path and it does indeed work this way. (If it's documented anywhere it's sure not in the manual page on blends, at least.)
I think B might cover some of the places my D-workaround script mysteriously fails. Possibly C too though I'm not quite parsing that sentence.
I can definitely see A being useful, I can sorta see B being something someone who is not me would like, but omfg D just drives me up the wall. I'm amending that lonely uservoice request to actually add those behaviors to the documentation, because shipping a copy of Monika's brain with every copy of Illustrator is not exactly feasible, and maybe have switches for them too...
Link in Zwischenablage kopieren
Kopiert
so what's the scenario you work on the most? is it D? can you post a mock up of the blends you usually work with
I'm working on a better version of your script for scenario D now
Link in Zwischenablage kopieren
Kopiert
D is definitely the reason this script exists in the first place!
If the optimization you're thinking of is to make it only close/open the first path, don't bother - it used to do that and I decided to just make it close and restore all the paths the last time I was making blends that (presumably) were triggering conditions B or C along with D. It's unnecessary but it really feels like it's defending against someone wandering into this ancient section of Illu's code and deciding to "improve" this undocumented "feature" by "helpfully" not creating a spline when any open paths are getting blended; this script does exactly what I need it to do and can happily fade into the background of my personal setup until I accidentally discover a fifth no-spline scenario that not even Monika knows about. 😄
If you know of a way to turn the blend spline of 3+ blended objects into a curved path instead of straight lines joining their centers and have that URGE TO HACK screaming at you now, that's something I do the vast majority of the time when I make a blend and was halfway thinking of investigating the possibility of while I was thinking about this script. I don't want it just enough that I'd want a "curve the spline? nope/[yeah]" requestor to pop up, with "yeah" as the default. But really you've done more than enough by suggesting app.redraw().
There's a few examples of the sorts of blends I do a lot in the attached file. There are paths that will probably make you wonder why they're open; the answer is that I mostly draw lots of open paths with my stylus and the Pencil tool and never bother going back to close them unless I have a reason for it. And the Pencil's auto-close is way over-enthusiastic for someone who tends to draw hands as multiple shapes for each finger and the palm. 🙂
Link in Zwischenablage kopieren
Kopiert
one thing led me another, and couldn't do what I wanted to do, publishing the script is pending...on other news, I think I should be able to open the paths as you originally asked.
I think it's also possible to convert the corner point to smooth point in a 3 object blend...but getting the right angle and length of the handles would be more involved.
...by the way there's no attachment of yours
Link in Zwischenablage kopieren
Kopiert
The script I have works fine to open the paths back up now that I've got app.refresh in it! 🙂
http://egypt.urnash.com/media/blogs.dir/1/files/2025/08/blendsamples.ai_.zip though
Link in Zwischenablage kopieren
Kopiert
I'm using that A scenario all the time.
Have made a video about it, after I got annoyed with these "blend two circles along the word hello" tutorials that were using the replace spine command all the time.
Link in Zwischenablage kopieren
Kopiert
seriously, A's incredibly thoughtful behavior and I hope I can remember it the next time I need it!
Link in Zwischenablage kopieren
Kopiert
Link in Zwischenablage kopieren
Kopiert
@CarlosCanto schrieb:
oh ok, but A is a feature right? not a bug
I'm pretty certain that it's a feature. Basically a no-brainer feature.
Link in Zwischenablage kopieren
Kopiert
thanks Monika, that's a very comprehensive list I wasn't aware of
Weitere Inspirationen, Events und Ressourcen finden Sie in der neuen Adobe Community
Jetzt ansehen