HW00 - james-bern/CS345 GitHub Wiki
TODO
- This week, you will create DXF's and STL's "by-hand" (in a text editor).
- Bring your completed HW to Lab next week as printed screenshots of your geometry in
viewer
.- HINT: viewer draws triangles that are facing the wrong way (see notes below) in red
- A-
- Large 8.5x11" print-out of the emoji of your choosing
- DXF of Pac-Man
- Pac-Man's mouth is a circular sector of 55 degrees.
- Pac-Man is symmetric about the y-axis.
- Pac-Man is centered at the origin.
- STL of an equilateral square pyramid
- The pyramid's side length is 25 (mm).
- The base of the pyramid is axis-aligned and centered at the origin.
- The tip of the pyramid lies on the positive y-axis.
- HINT: The base of the pyramid should be made of two triangles.
- A
- DXF of a Pac-Man Ghost
- HINT: Use two Arc's for each eye;
viewer
does not support Circle's.
- HINT: Use two Arc's for each eye;
- STL of a 3D letter A
- HINT: Make sure your mesh follows Rule #1 explained in the notes below.
- DXF of a Pac-Man Ghost
- A+
- DXF of the fourth iteration of the Koch Snowflake
- NOTE: Iteration 0 is an equilateral triangle.
- NOTE: You should write a computer program to generate the DXF, but you may NOT call any external libraries.
- DXF of the fourth iteration of the Koch Snowflake
- A++
- DXF of the fourth iteration of the Koch Anti-Snowflake
NOTE
- In this class, we'll work 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 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 natively 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...โจviewerโจ), which is in this repo (click CS345 in upper left and clone or download zip).
- NOTE: only works for Line's and Arc's
- run
viewer.bat
by double clicking or in a Terminal- Windows:
viewer.bat
- Mac:
./viewer.bat
- Windows:
- Even if you went the LAYOUT route, go ahead and make sure this works. ๐
- However, if you're on Windows (or Mac with Parallels), you can install LAYOUT, which can view DXF's.
- 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.)
viewer
can also view STLโs- Additionally, your computer probably CAN (at least sort of) 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 itโs somewhat scuffed in general)
- 3D Viewer on Windows (make sure to press
- 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)
- There are actually two STL specifications.
HINT
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 edge.
- 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). ๐๐ In viewer, this means no triangles are red