Last active
December 10, 2015 14:50
-
-
Save jwygralak67/4450435 to your computer and use it in GitHub Desktop.
Using the Subtract transformation in CoffeeScad to create a thru-hole or a hollow object.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to create a hole | |
# First, create the object we want to put a hole in | |
disc = new Cylinder | |
d: 100 | |
h: 10 | |
center: true | |
# Next, create a cylinder the size of the hole | |
hole = new Cylinder | |
d: 25 | |
h: 11 | |
center: true | |
# Finally, using the subtract transformation, subtract | |
# the cylinder from the disc, leaving a disc with a | |
# hole in the middle | |
holeyDisc = disc.subtract(hole) | |
return holeyDisc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to create a hollow box | |
# First, create a rectangle the size of the box. | |
box = new Cube | |
size: [60,40,20] | |
center: [0,0,10] # Move the box up so it sits on the XY plane | |
# Next, create a rectangle the size of the inside. | |
hole = new Cube | |
size: [55,35,18] | |
center: [0,0,11.5] # This size and position will leave a 2.5 unit thick wall and bottom. | |
# Finally, using the subtract transformation, subtract | |
# the inside from the outside | |
box = box.subtract(hole) | |
return box |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment