-
-
Save danuw/a44108aaf514eb64ec1a0e390a65c582 to your computer and use it in GitHub Desktop.
Chocolate 3D Template
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
/// Save this file as `choco.scad` and generate the stl using `openscad -o choco.stl -D 'quality="production"' choco.scad` | |
// text_on_cube.scad - Example for text() usage in OpenSCAD | |
echo(version=version()); | |
font = "Liberation Sans"; //["Liberation Sans", "Liberation Sans:style=Bold", "Liberation Sans:style=Italic", "Liberation Mono", "Liberation Serif"] | |
shape_height = 2; | |
cube_size = 18; | |
letter_size = 5; | |
letter_height = 2; | |
o = cube_size / 2 - letter_height / .5; | |
// source https://github.com/radavis/openscad/blob/master/heart.scad | |
module flat_heart() { | |
square(20); | |
translate([10, 20, 0]) | |
circle(10); | |
translate([20, 10, 0]) | |
circle(10); | |
} | |
module letter(l) { | |
// Use linear_extrude() to make the letters 3D objects as they | |
// are only 2D shapes when only using text() | |
linear_extrude(height = letter_height) { | |
text(l, size = letter_size, font = font, halign = "center", valign = "center", $fn = 16); | |
} | |
} | |
union() { | |
//linear_extrude(height= shape_height) | |
//color("gray") circle(r=cube_size); | |
linear_extrude(height = shape_height) | |
rotate(45, 0,0) translate([-12, -12, 0]) flat_heart(); | |
translate([0, 0, shape_height]) union(){ | |
translate([0, o, 0]) letter("LOVE"); | |
translate([0, -o, 0]) letter("YOU"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment