Copy link to clipboard
Copied
Hello all,
I am looking for the commands in javascript to use the functions of the pathfinder in the script like Union or Delete Hidden Surface. Where can I find a documentation of these commands?
Thanks for the help in advance.
Jens.
1 Correct answer
There is no counterpart to the pathfinder panel in ExtendScript. The closest there is are menu commands for the pathfinder effect (Effect > Pathfinder). These are applied to a selected group, so the paths need selecting and grouping before, and apply effects, so they need expanding after. E.g.
app.executeMenuCommand("group");
app.executeMenuCommand("Live Pathfinder Add");
app.executeMenuCommand("expandStyle");
app.executeMenuCommand("ungroup");
// Add Live Pathfinder Add
// Intersect
...
Explore related tutorials & articles
Copy link to clipboard
Copied
There is no counterpart to the pathfinder panel in ExtendScript. The closest there is are menu commands for the pathfinder effect (Effect > Pathfinder). These are applied to a selected group, so the paths need selecting and grouping before, and apply effects, so they need expanding after. E.g.
app.executeMenuCommand("group");
app.executeMenuCommand("Live Pathfinder Add");
app.executeMenuCommand("expandStyle");
app.executeMenuCommand("ungroup");
// Add Live Pathfinder Add
// Intersect Live Pathfinder Intersect
// Exclude Live Pathfinder Exclude
// Subtract Live Pathfinder Subtract
// Minus Back Live Pathfinder Minus Back
// Divide Live Pathfinder Divide
// Trim Live Pathfinder Trim
// Merge Live Pathfinder Merge
// Crop Live Pathfinder Crop
// Outline Live Pathfinder Outline
// Hard Mix Live Pathfinder Hard Mix
// Soft Mix Live Pathfinder Soft Mix
// Trap Live Pathfinder Trap
Copy link to clipboard
Copied
Thanks for this list. It works only with objects in a group and it's only an optical chance, the forms/objects are still the old ones.
Copy link to clipboard
Copied
There doesn't seem to be any nice API for pathfinder. Two options are available that I know of.
1. ExecuteMenuCommand
For example:
app.executeMenuCommand("group");
app.executeMenuCommand("Live Pathfinder Add");
app.executeMenuCommand("expandStyle");
app.executeMenuCommand("ungroup");
There is a list of commands here, and I'm sure other places.
2. Live Effects > Pathfinder
I have a github repo that includes some helper scripts for using Live Effects.
- Mark
Copy link to clipboard
Copied
Thanks for the answer. But that are bad news 😞
– Jens.
Copy link to clipboard
Copied
Thanks for your helps. Here is my script, that I made with:
// Simplify the currently selected object and preserve its name
// Preliminaries // Vorbereitungen
var docRef = app.activeDocument;
var selectedObjects = docRef.selection;
var vName = selectedObjects[0].name;
// Remove invisible paths // Entferne nicht sichtbare Pfade
app.executeMenuCommand("group");
app.executeMenuCommand("Live Pathfinder Minus Back");
app.executeMenuCommand("expandStyle");
app.executeMenuCommand("ungroup");
// Assign the old name to the new object // Weise dem neuen Objekt den alten Namen zu
selectedObjects = docRef.selection;
selectedObjects[0].name = vName;

