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

Looking for Javascript commands for path finder operation?

Engaged ,
Sep 01, 2021 Sep 01, 2021

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.

TOPICS
Scripting , Tools
2.4K
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

correct answers 1 Correct answer

Guide , Sep 01, 2021 Sep 01, 2021

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   
...
Translate
Adobe
Guide ,
Sep 01, 2021 Sep 01, 2021

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

 

 

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
Engaged ,
Sep 01, 2021 Sep 01, 2021

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.

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 ,
Sep 01, 2021 Sep 01, 2021

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

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
Engaged ,
Sep 01, 2021 Sep 01, 2021

Thanks for the answer. But that are bad news 😞

– Jens.

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
Engaged ,
Sep 01, 2021 Sep 01, 2021
LATEST

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