Sg2.9
Special Eraser Tool for Comics
Recent RSS
Special Eraser Tool for Comics
From:  Chris Deutsch
Date:  12. October 2011, 15:42

I use Illustrator for drawing comics and I'd like to speed up the process with help from Scriptographer. I'll usually draw the lines through and remove the overhanging bits either with the Scissors Tool or the Pathfinder Outline, both of which are annoying to work with for so many paths.

[illustration1]

This is the functionality I'd like to create with Scriptographer: I select all relevant paths and draw a line through the part I wish to have removed.

[illustration2]

This is what my script does so far.

  • onMouseDrag I draw a path.
  • onMouseUp I check which selected paths intersect with the path I just drew.
  • I check where these paths intersect with other selected paths.
  • I weed out all intersections that are not right next to an intersection with the path I just drew and store the remaining data in a variable.
  • Then I would like to split the paths at these intersections.

Problem is: When I've split a path once, how do I split the remaining bit? The curveLocations I've gathered no longer apply to the new path.

[illustration3]

Any ideas how to solve this? Can I do multiple splits in one command?

Re: Special Eraser Tool for Comics
From:  Casey
Date:  12. October 2011, 20:08

Dont use the Pathfinder: outline... use divide...

Try this:
1. Select all objects
1a. Make sure the fill of all objects is set to no fill
2. Use the pathfinder tool: Divide (second row, second from the right)
2a. Make sure the pathfinder option "divide/outline will remove unpainted artwork" is unchecked
2b. You may have to recolor the stroke after dividing
3. Use the hollow arrow tool to select unwanted paths
4. delete

Re: Special Eraser Tool for Comics
From:  pqbd
Date:  12. October 2011, 20:27

When you use the split() method, Scriptographer will return a new path, and leave the excess as the original path.

But before you get too deep, have you tried using the Shape Builder tool in CS5? It handles polygons as well as paths.

Re: Special Eraser Tool for Comics
From:  Casey
Date:  12. October 2011, 21:10

I like the shape builder option too, because that would help him color the figure as well.. however, I dont think it'd work in all scenario's though... such as where his example characters jaw meets up with his neck. Divide + hollow arrow is the way to go imo.

Re: Special Eraser Tool for Comics
From:  Chris Deutsch
Date:  13. October 2011, 04:05

Thanks for the advice, but I've already tried that ^^. The 2nd pathfinder tool from the right in the 2nd row is called "Outline" for me, but functions exactly as you describe, and that's how I often split certain paths. The reason I don't use that on the whole drawing is that every path is split at every point it intersects with another path. This would be quite alright, if all my lines were uniform in weight, but I use Beautiful Strokes and calligraphic brushes to obtain more natural looking strokes. So it's important where the paths are split (see the 1st illustration attached). Similar problem exists with Shape Builder.

It's all doable already, of course, but this eraser tool I'm working on would help me save a lot of time.

I know Scriptographer returns a new path when using split(), but what do I do with that path? Splitting it with the curveLocations I got from the complete path's intersections would result in completely wrong points to split, wouldn't it? Or am I understanding curveLocation wrong? Isn't a curveLocation basically a number to determine the length of the path from it's beginning to that point?

Re: Special Eraser Tool for Comics
From:  pqbd
Date:  13. October 2011, 04:58

Not to be contrary, but the shape builder can subtract a single path between intersections without creating a new shape. Just hold down the alt key and mouseover the element you'd like to remove. It should become highlighted in red and leave the surrounding area unshaded.

Your tool seems doable though. Get the path sel[0] that intersects with cutPath at cutPoint. Get and sort the intersections of sel[0] and sel[1-3] and sort by length along sel[0]. Find out where the intersection of sel[0] and cutPath lies in that array. Get the previous intersection (as long at cutPoint isn't the first), and split sel[0]. Repeat until cutPath and sel[0] intersect only each other. Then remove both paths.

Re: Special Eraser Tool for Comics
From:  Chris Deutsch
Date:  13. October 2011, 06:20

OMG!!!! The shape builder functionality is exactly what I was trying to achieve!! And here I thought I knew illustrator ^^

Re: Special Eraser Tool for Comics
From:  Chris Deutsch
Date:  13. October 2011, 06:30

Yeah, I was afraid it might come down to some recursion. Well, I won't be needing any script after all. I guess I should read the updates more carefully next time. Thanks again, everyone!

Re: Special Eraser Tool for Comics
From:  Casey
Date:  14. October 2011, 15:41

1. you're right, that was the outline tool... I've just been calling it the wrong thing I guess.

2. news to me on the functionality of the shapebuilder tool with the alt key... that's pretty f'ing neat.

Good stuff

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Ideé replacer 02.07.11
by peko