The goal I have SVG files (created elsewhere) which have a bunch of elements in them, many of which share a straight edge with one another. In Illustrator, I want to merge all those parts*.
*I want to merge elements for various reasons, among others because Illustrator's anti-aliasing rendering shows seams between flush edges, similar to in-browser SVG rendering. I realise that disabling anti-aliasing and switching to CPU rendering works. I also realise that exporting to bitmap using art-optimized setting will hlep you get rid of the seams. The point is that I am looking for a workable solution to get rid of the seams within Illustrator, plus I'd like to merge those parts anyway.
What I expect to work
Open the SVG
Select all elements
Choose Pathfinder > Merge
Expected result: all shapes with touching edges (straight lines with identical endpoint positions) will be merged one shape
What happens Sometimes, two straight edges will merge properly, sometimes they don't (see examples below). In the simple example with the kite shapes, both sets of triangles share one edge and has identical endpoints (hence an identical edge). For some reason, the right one will properly merge, while the left one doesn't. The shape that works happens to have whole numbers for the endpoint x and y position, and the left one has decimal numbers (see attached SVG); that said, as you can see from the more complex case, the merges sometimes work and sometimes they don't for positions with decimals.
I've run a lot of variations and haven't gotten consistent results. For some files, some edges fail to merge when I merge all shapes in one go, but works when I first merge the offending parts. In other cases, neither works.
Live paint round-trip helps?
When turn the whole artwork into a Live Paint and then expand back, I seem to get better (though not perfect) results. I don't know why, but I'm guessing numbers are subtly changed along the way, or the resulting shape isn't in the same Adobe Illustrator format anymore as before. Note that using a regular "Expand" on the shapes before merging has no effect.
The question Can someone help me figure out:
What is causing this unpredictable failing of merging edges?
What steps to follow in Illustrator to get good results every time? (Live Paint helps, but I'm hoping for a flawless result)
Failing step 2, maybe someone has suggestions on how I can prepare my SVG files? As the simple example SVG shows, there is nothing special going on the in SVG itself, so it's something about the values?
Any other workaround you may have. Preferrably not inaccurate methods like adding a stroke or offset.