Skip to main content
johnb44672
Inspiring
May 1, 2018
Answered

use "object -> path -> divide objects below" via script & make selections?

  • May 1, 2018
  • 1 reply
  • 1414 views

Hi all,

I've really tried to seek out existing answers before posting, but I've had some difficulty in finding answers to these two. I saw one, but it didn't make sense to my newly-scripting mind.

If it's of importance, I'm using javascript.

I have my script selecting a particular line to use the "object --> path --> divide objects below" menu item with, which works fine in the AI GUI.

Scripting, however, I can't find a way to call that. Even creating an action doesn't seem to 'record' selecting that menu item.

Is there a way to have this ran via scripting?

I know there are PathFinder alternatives, but the results I was getting (especially with Divide) wasn't the result I'm needing in a 'razor' cut.

And secondly,

Once sliced, I'd really like to select a range of objects within certain x,y coordinates and group them, especially since layer names get dropped when you divide them. I'm not sure if this can be done either?

I have the javascript reference manual, but am having a difficult time finding my way to the right commands...and at times getting the syntax to stick.

Thank you for your help...and I hope this isn't horribly fundamental or dumb sounding!

John

This topic has been closed for replies.
Correct answer pixxxelschubser

Hi johnb44672

select the line (above your shape) and run this snippet (required version CS6+)

app.executeMenuCommand('Knife Tool2');

app.executeMenuCommand('group');

The shape should be divided now, the line doesn't exists anymore and the resulting two parts of the shape are grouped.

Is that, what you wanted? If so

Have fun

1 reply

pixxxelschubser
Community Expert
Community Expert
May 1, 2018

please show something

johnb44672
Inspiring
May 1, 2018

If I use the AI GUI, I can have it divide the layers no problem. Each layer will be divided correctly down the middle from the line. If I use pathfinder, however, the 'starburst' cuts out of the box as well, which is not what I'm looking to have happen.

After the cut from the line, I would ideally be able to group the "screen left" and also the "screen right" shapes, respective to the line.

Hope that helps explain. 

pixxxelschubser
Community Expert
pixxxelschubserCommunity ExpertCorrect answer
Community Expert
May 1, 2018

Hi johnb44672

select the line (above your shape) and run this snippet (required version CS6+)

app.executeMenuCommand('Knife Tool2');

app.executeMenuCommand('group');

The shape should be divided now, the line doesn't exists anymore and the resulting two parts of the shape are grouped.

Is that, what you wanted? If so

Have fun