I am using Illustrator to create complex pen-plotter drawings that typically involve a lot of cross-hatched shading. I am looking for a way to automate one of the most needlessly laborious parts of this process.
At present, to fill an area with parallel lines (I will refer to them as hatch-lines,) I first create the hatch-lines using the blend tool. I expand the blend, then I place a shape on top to delineate the area I want to cut, and I use the Shape Builder tool to delete the unnecessary parts of each hatch-line individually, using the alt-click. I am looking for a way to automate this process. (See Image 1).
Unfortunately the Pathfinder tool does not do quite what I want. The Divide command can erase lines outside of a shape, but only if the shape is simple, without "undercuts." It does not seem to be able to erase lines inside of a shape. (See Image 2).
I need to actually sever the paths at the desired locations (where they intersect the shape's outline) and delete the unwanted parts of the path (either inside or outside the shape, depending on the context.). I can't simply "mask" the image by layering filled shapes on top, because these are vector files for pen plotter, and all vectors will be plotted whether or not they are obscured.
Does anyone know a solution? Would it be possible to write a script which could perform these behaviors? Please let me know if any further clarification or elaboration is needed. If I could automate this task it would save hours or even days of alt-clicking per drawing!
I was able to successfully use your action not only in your example file, but also in a a file of my own-- Very exciting! I understand how some of the steps function, but not all of them. I will keep playing with it to understand better. Thank you!
An old Pathfinder trick should do the cropjob (check the pics).
I use CS5, but it should work exactly the same on CC.
For the Action: put the blend on a new layer & lock all other layers, then run the action.
Note all answers up to now (except scripts) work for straight lines, not for Curved lines inside the crop area, so the question is only partially solved.
As for scripts, there's Serg Osokin's free script called Splitpath. (it's for >CS6 & i have CS5, but i'm sure it works great).
Note also it wouldn't be difficult for Adobe to add a tool or feature doing this cutting-of-lines, and it has been asked regularly, so why they don't is a mystery. And clean, trimmed lines are superior to clipped lines: see comment on pic2 for demonstrating this.