I’ve recently been doing some playing around with a Makerbot Replicator 2, which has been pretty nifty. Before I got my hands on the 3D printer, though, I wanted to learn more about the STL file format that seems to be used by all of them. I did some reading, and figured out that there are basically two styles of STL file – binary and text. I wrote an STL file loader in XNA, just to see how difficult it was to parse the files. (It’s been a while since I have done something like that, and was itching to do it). You can read about the STL file format here. I’ve hacked together a small STL file loader in XNA, which you can find here. The included STL files came from Thingiverse. The included code should be reasonably straightforward. The only tricky bit was getting XNA to render inside a Winforms app. (Digging through the XNA examples, I hacked apart the one windows form example and got it working). That, and the camera code is pretty screwed up, so feel free to ignore/replace it. (I was experimenting with some 3D camera movement at the same time). Also, the various triangles are randomly colored, just to make it easy to see everything that is being loaded.