Skip to content

Commit

Permalink
Merge pull request #4385 from Paulwhy2/hull-example
Browse files Browse the repository at this point in the history
Add a hull example to basic examples.

Closes #355.
  • Loading branch information
t-paul committed Oct 18, 2022
2 parents 570b3a9 + e4fd82d commit 3d02e2d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
25 changes: 25 additions & 0 deletions examples/Basics/hull.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Hull Example
// The hull of a toy sailboat
$fs = .1;
hull(){
#translate([0,30,2.5]) sphere(1); //bow
#translate([0,10,-1]) cube([20,1,8],true); //1st bulkhead
#translate([0,10,-5]) cube([1,1,8],true); //1st keel
#translate([0,-8,-1]) cube([20,1,8],true); //2nd bulkhead
#translate([0,-8,-5]) cube([1,1,8],true); //2nd keel
#translate([0,-30,1]) cube([16,1,4],true); //stern
}
cylinder(40,1,1); //Mast


// written by Paul Young, 2022
// paulwhy.2@gmail.com

// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to the
// public domain worldwide. This software is distributed without any
// warranty.
//
// You should have received a copy of the CC0 Public Domain
// Dedication along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
3 changes: 2 additions & 1 deletion examples/examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"roof.scad",
"rotate_extrude.scad",
"text_on_cube.scad",
"projection.scad"
"projection.scad",
"hull.scad"
],
"Functions": [
"echo.scad",
Expand Down
22 changes: 22 additions & 0 deletions tests/regression/dumptest-examples/hull-expected.csg
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
hull() {
# multmatrix([[1, 0, 0, 0], [0, 1, 0, 30], [0, 0, 1, 2.5], [0, 0, 0, 1]]) {
sphere($fn = 0, $fa = 12, $fs = 0.1, r = 1);
}
# multmatrix([[1, 0, 0, 0], [0, 1, 0, 10], [0, 0, 1, -1], [0, 0, 0, 1]]) {
cube(size = [20, 1, 8], center = true);
}
# multmatrix([[1, 0, 0, 0], [0, 1, 0, 10], [0, 0, 1, -5], [0, 0, 0, 1]]) {
cube(size = [1, 1, 8], center = true);
}
# multmatrix([[1, 0, 0, 0], [0, 1, 0, -8], [0, 0, 1, -1], [0, 0, 0, 1]]) {
cube(size = [20, 1, 8], center = true);
}
# multmatrix([[1, 0, 0, 0], [0, 1, 0, -8], [0, 0, 1, -5], [0, 0, 0, 1]]) {
cube(size = [1, 1, 8], center = true);
}
# multmatrix([[1, 0, 0, 0], [0, 1, 0, -30], [0, 0, 1, 1], [0, 0, 0, 1]]) {
cube(size = [16, 1, 4], center = true);
}
}
cylinder($fn = 0, $fa = 12, $fs = 0.1, h = 40, r1 = 1, r2 = 1, center = false);

0 comments on commit 3d02e2d

Please sign in to comment.