Jes' Codex

jes5199 of blog
Posts I Like

OK, so (for @keystricken’s birthday, [hi, Mon!]) I made a thing (with the help of Shapeways’s Selective Laser Sintering machine)

sundial

Which is really just a physical projection of a 3D model I made in CAD:

which was really challenging since I had never really used 3D CAD before at all.

after some flailing about, I came up with a process that looked like this:

  1. Draw something on paper
  2. Scan it in
  3. Use The GIMP’s filters and levels a to turn it into a monochrome (like seriously just black and white, not greyscale) image.
  4. Use Inkscape’s “Trace Bitmap” command to turn the drawings into SVG vector graphics
  5. Import the SVG into FreeCAD “as geometry”
  6. Notice that FreeCAD has mysteriously failed to correctly understand some of the shapes
  7. curse, reopen the SVG in Inkscape, stare at the control points of the paths until I notice that there’s two points on the same pixel (don’t ask me how I can see that), delete one, and save again
  8. Import the SVG into FreeCAD “as geometry”
  9. Extrude the geometry into solids
  10. Notice that FreeCAD has failed to understand that white shapes inside of black shapes are actually “holes”
  11. Use the FreeCAD “Boolean Difference” function to generate new solids that are black shapes with the white shapes subtracted … one pair at a time.
  12. Get confused as hell, and try to backtrack even though “Undo” always seems to be disabled
  13. Cut and paste these solids into the main document
  14. Using my high-school algebra, figure out what angle to rotate the solids to
  15. Notice that every pasted object seems to have a new and different understanding of where the point 0,0,0 is, so that math on the coordinates is meaningless.
  16. Try to use the mouse to move a shape: either mysteriously fling an object way, way outside the visible scope of the document, or accidentally hit “ESC” while dragging the object (which is not ‘cancel’ like my muscle memory suggests, but rather “please crash the program”)
  17. Give up on the mouse and painstakingly, manually move each object into an X/Y/Z coordinate triple using the numeric entry boxes that puts it into a place that doesn’t look completely wrong.
  18. (Eventually) export the CAD model as VRML
  19. Try to open the VRML file in Meshworks
  20. Meshwork says it’s not VRML! Run `file` on the file
  21. Realize that FreeCAD helpfully gzips files, sometimes, without warning.
  22. gunzip the file
  23. Open the VRML file in Meshworks
  24. drag it around in Meshworks, and marvel at how it’s both easier to manipulate and harder to see details on, compared to FreeCAD
  25. Export the model to STL
  26. Upload the STL file to Shapeways
  27. Wait for an automated email
  28. Holy crap it worked.
  29. Give Shapeways some money
  30. Wait a couple weeks

I think I can probably do better in the future. It seems like it should be possible to make a toolchain that does (image)->Trace->Extrude->Rotate->Translate->Export without human intervention.

If I had that, I’d actually work on writing a program that solved the interesting parts of the sundial (most of which I solved on paper for this prototype)

  1. Solar noon is always north/up, but what clock time that is locally depends on how far east or west you are from the central meridian of your time zone. The clock dial is rotated by a number of degrees that’s your time zone’s central longitude minus your actual longitude.
  2. In order to have evenly spaced shadows for each hour (see Equatorial Sundial), the dial should be inclined to an angle that’s 90 degrees minus your longitude. That means that your lower gnomon (which doubles as the support) should be at a length that can be calculated using trigonometry (uh, the cotangent of your latitude times the radius of the dial, I think)
  3. The top dial is your “summer” dial and the lower dial is your “winter” dial. A nice cheat is to have the top dial already offset by 15 degrees so that it is set to Daylight Savings Time
  4. The lower dial runs counter-clockwise. In this prototype, I cheated and just mirrored the lower dial. Mirrored Roman Numerals are actually sort of evil, though, since IV becomes VI, etc.