The obvious answer is "use the Shape Builder" tool, but... The problem is that I actually have a blob of ~5000 shapes that all need to be welded together as one, and drawing all the lines across all the shapes needed to connect Shape Builder is incredibly tedious. What I really want is "just automate Shape Builder and weld together every selected space that is the same fill color." Is there a way to do that?
2 Answers
Select all shapes that you want make one. Then in the Pathfinder panel (Window >> Pathfinder) click shape mode "Unite". Holes (=compound paths) will survive and the common stroke, too. Your example is united in less than 1 second including the selection. (Note: The Pathfinder Panel has nothing to do with Effects >> Pathfinder.)
If there happens to be differently colored objects here and there that you want to keep separate, you can select one red shape and take the rest along by Select > Same > Fill Color.
ADD: If we watch the example more careful and assume that there's no error we noticet that white shapes have lost their strokes.
That's no problem, if they were separate objects. One can select all white and remove the black stroke. But if they were holes, a little tinkering is needed:
After uniting the red shapes the holes are intact. They must become strokeless separate objects. They must be done all at the same time because there's maybe hundreds of them.
Draw a big strokeless white rectangle, arrange it to back. I made an yellow rectangle to make it visible.
Duplicate (=copy and paste in place) the red shape, subtract the top red shape from the rectangle in pathfinder, ungroup the result, delete the outer remainder of the rectangle
Copy the pieces in the holes (select by the same color) to the clipboard, change their color to red in the drawing
Unite the red shape and the hole fills
Paste in place the pieces from the clipboard
-
1I would like to point out that you can also do box selection if you hold Shift down with shape builder. Though yes in this c ase Pathfinder is the way to go. Though combining all same colors is called Merge which is closer to what OP asks. Merge however will not work all that well with stroked things.– joojaaCommented Mar 24, 2018 at 14:51
-
This is a very complete answer. Thank you. I will make a slight edit to stress the difference between the Pathfinder Panel and Effects >> Pathfinder.– SRMCommented Mar 25, 2018 at 7:17
Select all your shapes... then Pathfinder Panel > Merge
Merge will combine all objects with the same fill color into one object. If you select objects with different fill colors, each separate fill color will result in separate merged objects. You may need to reapply any stroke after the operation.
For more descriptions regarding the Pathfinder Operations see here: In Pathfinder window, what is the difference between a shape mode and a pathfinder?
The Shape Builder tool was added later to illustrator as an "on-the-fly" pathfinder tool. It essentially does what the Pathfinder panel options do, but more as a brush than a single button click.
-
But unlike pathfinder it can actually remove strokes, as strokes ;)– joojaaCommented Mar 24, 2018 at 16:38
-
This answer is false. I cannot reply with an image so I will edit my question to show -- nothing happens when I select objects and choose merge.– SRMCommented Mar 25, 2018 at 7:11
-
Oh. Wait. "Pathfinder PANEL". What is that? (goes searching) Ah. Totally different than "Effects >> Pathfinder >> Merge." Thank you.– SRMCommented Mar 25, 2018 at 7:15
-
1@SRM the effect can also do this if you apply it to a group or layer– joojaaCommented Mar 25, 2018 at 14:48
-
Glad you found it @SRM The Panel (View >Pathfinder) does things much differently than the Effects Menu item. I actually rarely use the menu effects for Pathfinder.– ScottCommented Mar 25, 2018 at 15:57