3d printers don't have particularly powerful computers. The 3d modeling and slicing (creating a plan to generate the model using the printer) is done on a PC. The printer just knows how to move the axes, heat the filament, etc.
If the 3d printer has to be able to recognize gun shapes and refuse to print them, it will need a much more powerful processor. And even then, what's the point? It's unworkable.
The person is going to be sitting at home with their own 3d printer. If it refuses to print something because it sees it as a gun part, the user can go over to their computer and modify the shape until the 3d printer no longer recognizes it. If the algorithm to detect a gun part is very strict, it will end up also blocking things that aren't gun parts, especially gun-like props.
If someone doesn't feel like fiddling with the shapes they're trying to print until the printer obeys, they can probably just install their own software. Some commercial printers will make that harder, but Amazon is a multi-billion dollar company and can't keep people from installing their own firmware on Kindles. There's no way that a smaller printer company will be able to lock down their printers. In addition, there are the open source printers, that are explicitly designed so that you can install your own firmware. I assume California is going to make that illegal -- a move that the closed-source printer companies will love.
If the law were passed, it might stop a hobbyist who wanted to try out printing a gun part just to see if they could. (Even though that's already illegal.) But, it won't stop anybody doing it as a business who can invest the time to get around the ban. So, all you'd do is hurt regular users while only mildly inconveniencing the main people you're trying to stop.