homework 00 - james-bern/CS345 GitHub Wiki

Summary

Let's experience two important filetypes, the DXF and the STL! πŸ™‚πŸ‘

We will see these over and over for the next few weeks.

Specification

  • A- Level
    • In a text editor, create a dxf of a (2D; z = 0) equilateral triangle.
    • In a text editor, create an stl of a (2D) square.
  • A Level
    • In a text editor, create a dxf of Pac-Man (see teaser image).
    • In a text editor, create a watertight stl of a rectangular pyramid.
  • A+ Level:
    • In a text editor, create a 2D dxf of one of the ghosts from Pac-Man (see teaser image).
      • Include eyeballs and pupils.
      • Make sure its feet are nicely rounded.
    • In a text editor, create an stl of a little house.
      • The roof should extend beyond the walls (see teaser image).

Submission Checklist

Submit the following physical objects at the beginning of lecture on tuesday:

  • Handwritten names of all group members.
  • 1x printed screenshots of your highest level dxf in either dxfviewer or LAYOUT
  • 3x printed screenshots (1x in 3D Viewer/Preview; 1x in Bambu Studio; 1x MeshLabJS) of your highest level stl

Notes

  • You can think in inches (in) if you like, but I personally think in millimeters (mm).

    • There are 25.4 millimeters per inch.
    • Our 3D-printer's print volume is 256mm x 256mm x 256mm.
    • Our waterjet's cut area is 304mm x 304mm (roughly the size of the grid in dxfviewer).
  • We will use the STL file format to store 3D meshes made of triangles.

    • There are actually two STL specifications. The ASCII STL is the human-readable one.
    • Here are some more complete examples.
    • You're welcome to write (0, 0, 0) for the normals (if you try this in Windows 3D Viewer, there won't be any lighting; this is fine.)
    • Your computer probably CAN natively view (draw; render; visualize) STL's.
      • 3D Viewer on Windows (make sure to press Ctrl + 1 to see the edges)
      • Preview on Mac (unfortunately, no way to see the edges)
    • Also try Bambu Studio, which is what we will use for 3D-printing.
    • Also try MeshLabJS (make sure to click Rendering and then show mesh edges)
  • We will use the DXF file format to store 2D sketches made of line segments and arcs (circular segments).

    • The DXF spec is quite large; please only use LINE and ARC (this is all my viewer supports anyway). πŸ™‚πŸ‘
    • Here are some simple example dxf files.
    • Unfortunately, your computer almost certainly CANNOT view DXF's. Also, GOOD LUCK finding a viewer online. ☹️
      • However, if you're on Windows (or Mac with Parallels), you can install LAYOUT, which can view DXF's.
        • You'll want to do this eventually; why not now! πŸ™‚
      • And I've written a (very forgiving) DXF viewer for you (called...✨dxfviewer✨), which is in this repo (click CS345 in upper left and clone or download zip).
        • dxfviewer.exe is for Windows; dxfviewer.app is for Mac πŸ™‚πŸ‘
        • Even if you went the LAYOUT route, go ahead and make sure this works. πŸ™‚

Hints

STL

I will break down this description from Wikipedia.

An STL file describes a raw, unstructured triangulated surface by the unit normal and vertices (ordered by the right-hand rule2(https://en.wikipedia.org/wiki/STL_(file_format)#cite_note-loc-2)) of the triangles using a three-dimensional Cartesian coordinate system.7

Triangle mesh

A triangle mesh used in an STL has to follow certain rules (technically, it must be manifold and watertight). (Note: Sometimes, you may get lucky, and Bambu Studio will "figure it out," but you probably shouldn't rely on this.)

  • Here are a couple valid-looking triangle meshes.
    • Note how triangle corners only touch other corners (you never have a corner touching the middle of an edge.)
    • We can't be 100% sure just seeing them from one angle, but it looks like each mesh is a single watertight shell with no holes or "zero thickness" walls running through the middle (each mesh is like an eggshell or "skin;" PS check out Keenan Crane's cow)
  • Rule #1: Triangle's corners should touch only other triangles corners (not the middle of edges.)
    • The left mesh's orange triangle's top edge's corners touch the middle of the red triangle's bottom mesh.
  • Rule #2: The overall mesh should form a single, watertight "shell" (like an eggshell or "skin.") (Details: You can also have like...two eggs, side by side, but you can't have an egg with two compartments.)
    • The left mesh is not a single shell; it has two "compartments" that touch along a plane.

Vertex order (triangle "handedness")

In graphics/3D-printing a triangle has a front side (front face) and a back side (back face). Which side is which is defined by the order of triangle's vertices (NOT dependent on the STL's "facet normal," which should just affect lighting/color in the viewer). The red arrow in this screenshot is an outward-facing normal, which happens to be pointing towards us. We are looking at the front face of the triangle (if the triangle was part of a mesh, we would be looking at the outside of the mesh). The direction of the arrow can be found using a right-hand rule (curl your right hand's fingers from 1 -> 2 -> 3; your thumb points in the direction of the arrow.)

The way your triangles are facing is used to determine the inside vs. outside of the STL. Many viewers will only draw the outside of the STL (front faces of triangles). Good practice is to have all your triangles oriented/facing the right way (outward-facing normals point out of the part instead of into it). πŸ™‚πŸ‘