Graphics Reference
In-Depth Information
What went wrong?
This seems like it will work, but after you compile the code, you notice
that there is still a thin “skin” on the bottom of the ring. Drag the object
around in the viewer with your mouse to rotate it and see the model from
multiple angles Figure C-3 .
The inside cylinder has not completely removed the material. This is
because both cylinders are created at the same point (0,0,0) and do not
completely intersect.
Figure C-3. Difference with onionskin
The (0,0,0) point in 3D space is also called the “origin”. If any
of the positioning terms used in this section are confusing,
refer to the discussion of the Cartesian coordinate system in
“The Gantry” (page 44) for a refresher.
Center equals true
If you add the center attribute to the code and set it to true , you can
make sure that both shapes are centered. This will ensure that the cyl-
inder that creates the negative space in the center of the ring penetrates
the positive cylinder you are using to create the ring band.
Your code should now look like this:
difference() {
cylinder(h=6,r=18,center=true); // outside of ring
cylinder(h=20,r=16,center=true); // inside of ring
Compile the code
Press F5 to compile and view the model. You should now see a basic ring
shape as shown in Figure C-4 .
Search WWH ::

Custom Search