I second the Exploratorium. It is more science oriented, but totally worth it. Some of the best hands-on science exhibits and demonstrations I have ever seen. They also have their own machine shop (closed to non-employees) which is visible from the floor, including a number of 10ee lathes. They also have a very, very old treadle lathe on the floor being used for some exhibit.
In 14 years living in SF, I've never once ridden a cable car. Unless you *really* want to, they are absolutely unnecessary for getting around town. Ride the buses (MUNI) for that. For getting to Oakland and the South Bay, ride BART.
There is the Musee Mecanique. From the website, "one of the world’s largest privately owned collections of mechanically operated musical instruments and antique arcade machines." I haven't been there for maybe 8 years, but when it did, it was well worth it.
Welcome to the Musee Mecanique - The Mechanical Musuem
If you like Mexican food of any sort, get yourself a super burrito (the one with more than rice, beans, and meat on it). If you're gonna be downtown, there's a good burrito place on the corner of 4th and Bryant. If you're in the mission, t doesn't matter where you go.
It's not a museum, but there is the old Portrero point (Pier 70) shipyard, which once upon a time had the machine shop warehouse unlocked. Unfortunately the only things left in there were the bridge cranes and a huge (48"+ swing) lathe. Similar story with Hunters Point Shipyard, but that one has also changed.
Flickr: Hunters Point Naval Shipyard
Potrero Point - Wikipedia, the free encyclopedia
If you know anyone who can take you on a tour, Lawrence Berkeley national Labs has a huge, quite impressive machine shop (so I'm told).