Copy link to clipboard
Copied
I have hundreds of shapes filled with a pattern of lines. I am trying to figure out a way to clip the lines without ending up with the lines that have been converted to (outlines) closed shapes. It seems like a simple proceedure but Illustrator keeps converting them to closed shapes whenever I try any type of clipping or cropping technique.
I have attached a screen shot showing an example of the shape with tthe line. Any suggestions would be greatly appreciated.
Hi George,
this is what I did with CS3 trying to recreate your question
1. created the pattern and filled the polygon shape
2. Object...Expand...(Fill only)...Ok
3. Outline... in the Pathfinder palette
4. Stroke with 1 point...just to get visibility
now, I didn't end up with closed shapes as in your image. All I have is open unfilled paths, being the pattern of lines and the segments of the polygon cutter path. The good news is that the cutter segments are all one next to the other at the top of the
...Copy link to clipboard
Copied
Is this possible?
Copy link to clipboard
Copied
It's not really clear what you want to do. Do you mean to expand the fill and then clip the strokes to the path edge?
Copy link to clipboard
Copied
This graphic shows the current result that I am getting and the desired result.
Copy link to clipboard
Copied
George,
As you have discovered, Illustrator does not provide any decent means by which to cut multiple open unfilled paths without their becoming outlined. The only tool that can do it is the inaccuate Eraser tool. But it can't be told to follow a path; it is limited to either cutting a straight swath, or to the "path" you draw in inaccurate "free hand" mode. In both cases, it always cuts a swath (is incapable of cutting a zero-width swath). In both cases, it can unpredictably alter the shapes of the remaining portions.
The tedious LivePaint toy doesn't help in many-instance situations like this. Other oft-cited workarounds such as applying and then expanding clipping paths or opacity masks results in outlined strokes.
The only command in Illustrator that can correctly cut multiple open unfilled paths is the poorly-named Outline Pathfinder. But it has these poorly-designed behaviors:
* It leaves all the unwanted deadwood in place.
* It cuts the "cutting path" as well, and leaves its resulting segments in place.
* It removes all pre-existing strokes and fills. So that preempts potential workarounds such as using a different color or stroke weight for the cutting paths to facilitating selection and deletion after-the-fact. Nor do object names or notes pre-applied to the cutting path survive the Pathfinder operation.
The obvious need for a decent, straightforward path-cutting capability is one of several areas in which Illustrator feigns "sophistication" with a dizzying array of illogically-designed tools and commands--yet still fails to provide the most basic needed functionality. I've been complaining about this one (and others) for years.
Compare to Corel Draw, with which you can employ any path as a cutting path. When used, the pre-existing strokes/fills are maintained, strokes do not become outlined, and you have the option as to whether the cutting path remains.
Given that AI's scripting model does not provide calls for all the commands in the UI (not that it necessarily should--that's supposed to be what Actions is for), and given that it does not provide such prebuilt functions as determining path intersections, you would be left to "do the math" for the path shapes, were you to try to script such a feature. That would be an impractically ambititious task, compared to the relatively modest cost of a competitive side-grade to a program that already provides the needed functionality built-in.
Back to the horrible Outline Pathfinder: If you first fill the cutter path, the result of the Outline Pathfinder illogically applies the fill color to the portions of the cut paths that intersected the area of the cutter path. The stroke weight becomes set to zero (not even supposed to be allowed in Illustrator), but is visible and selectable by color. The outboard deadwood has its stroke attributes removed. So in some situations, pre-filling the cutter path could be a workaround for selecting and deleting the unwanted outboard deadwood. Unfortunately, the resulting segments of the cutter path itself also receives the same stroke color and weight as the "keeper" content, so you are still left with the problem of no way to differentiate the cutter path remnants for selection and deletion.
JET
Copy link to clipboard
Copied
Thanks for your detailed reply.
I resorted to executing an action with an Applescript to make this work. The problem that I am running into is the apple script wants to run through another iteration prior to the action completing. To solve this problem I was forced to put a timer in the Applescript and hope that the action completed before the next iteration. Unfortunately the time that it takes to go through one iteration of the action is dependant on the file size and as I try to scale this up to bigger files the Applescript fails. I can increase the timer to keep it from failing but to give you and idea it is currently taking more than five hours to complete the current file that I am working.
Copy link to clipboard
Copied
Hi George,
this is what I did with CS3 trying to recreate your question
1. created the pattern and filled the polygon shape
2. Object...Expand...(Fill only)...Ok
3. Outline... in the Pathfinder palette
4. Stroke with 1 point...just to get visibility
now, I didn't end up with closed shapes as in your image. All I have is open unfilled paths, being the pattern of lines and the segments of the polygon cutter path. The good news is that the cutter segments are all one next to the other at the top of the layers palette, followed by all the pattern lines.
5. Deselect everything
6. Select the first and last of the pattern lines and note their position in the layers palette
6A. to easily find their position go to layers palette menu and click on "locate object"
7. Select all pattern lines in the layers palette...
8. Collect in New Layer....in the Layers palette menu
9. Once the pattern lines are in its own layer, well the job is done
I hope it is of any help, this is my very first post!!! ....Still need a script to deal with hundreds of shapes?
CarlosCanto
Copy link to clipboard
Copied
Thanks for your help Carlos, that works.
Copy link to clipboard
Copied
CarlosCanto wrote:
I hope it is of any help, this is my very first post!!! ....Still need a script to deal with hundreds of shapes?
@ CarlosCanto,
That was an impressive "first" post. So given all you have shown with your impressive coding abilities in posts since that, did you ever or could you script a solution for this type of thing? Thanks in advance for any feeback if you see this. Sorry for the blast from the past. 😉
Copy link to clipboard
Copied
wow W_J_T that's definitely a blast from the past, we've come a long way since then, I'm glad the OP didn't ask for a scripted solution, I don't know why I offered, back then I would have looked like a fool coming up empty handed...come to think of it, 4 years forward, I don't think I could manage to pull it off, specially since much of the scripting DOM remains exactly the same.
apart from the heavy use of Math to work on Line to Bezier intersections, these days I would try to apply PathFinder Effects stored in Graphic Styles along with the Expand Menu command to see what we're left with, and see if there's anything we can grab do the "clean up", I'm not sure if it will work, I don't have CS6 to play with...
...why don't you try something, and let us know if we can be of any help, it should be fun.
Copy link to clipboard
Copied
Thanks for responding Carlos. Well if you say it's still not doable via scripting then drumroll, no surprise. Too bad it's the AI scripting DOM that more times than not causes the issues and restrictions, Damn the DOM. 😉 For the example shown in this thread, your method is pretty straight forward, for other more complex ones it could maybe get pretty tedious (but alot of times worthwhile outcomes do). LIke you mention some of it could maybe be automated. Oh well, I saw the thread and was just curious. Again great first post, I bet if it could be done via scripting you could have pulled it off even back then 😉
Maybe I will make some t-shirts:
I Love
Illustrator Scripting
but ...
"Damn the DOM"
Copy link to clipboard
Copied
Eureka Eureka!! I think I got something...what can you do with the menu play thingy in CS6?, can you call Effect->PathFinder->Outline? and more importantly can you call Object->Expand Appearance?
...if you can, great, if you can't, no biggy, what we CAN do is record those two steps into an action, play the action and presto!! plus the actual script before and after the action call. CS5 and older, no choice but to use AS or VB to play the action, CS6 and up can play the action with JS.