It seems like this should be super easy to spot by outfitting X-ray machines with computer vision that can compare shapes/outlines from the X-ray image with a massive catalog of 3D printed gun schematics. Of course this would only help with assembled guns, but it's a step in the right direction.
I suspect you'd end up having all the same problems that Antivirus software has (basically an arms race, I guess quite literally).