From 3aa8ba99be7f23ccabd490c8d633f311df5b7a94 Mon Sep 17 00:00:00 2001 From: traverseda Date: Fri, 15 Feb 2013 17:02:36 -0400 Subject: [PATCH 1/5] Added my libtriangles, plus the "examples" folder --- examples/example.libtriangles.scad | 10 ++ examples/example.stl | 240 +++++++++++++++++++++++++++++ libtriangles.scad | 58 +++++++ 3 files changed, 308 insertions(+) create mode 100644 examples/example.libtriangles.scad create mode 100644 examples/example.stl create mode 100644 libtriangles.scad diff --git a/examples/example.libtriangles.scad b/examples/example.libtriangles.scad new file mode 100644 index 0000000..05390ec --- /dev/null +++ b/examples/example.libtriangles.scad @@ -0,0 +1,10 @@ +use <../libtriangles.scad>; + +//all of these follow the (X,Y,Z) syntax + +translate(v = [0, 0, 0])eqlpyramid(10,20,30); +translate(v = [20, 0, 0]) rightpyramid(10,20,30); +translate(v = [40, 0, 0]) cornerpyramid(10,20,30); +translate(v = [60, 0, 0]) rightprism(10,20,30); +translate(v = [80, 0, 0]) eqlprism(10,20,30); + diff --git a/examples/example.stl b/examples/example.stl new file mode 100644 index 0000000..f3adc29 --- /dev/null +++ b/examples/example.stl @@ -0,0 +1,240 @@ +solid OpenSCAD_Model + facet normal -0.986394 0 0.164399 + outer loop + vertex 0 20 0 + vertex 0 0 0 + vertex 5 10 30 + endloop + endfacet + facet normal 0 -0.948683 0.316228 + outer loop + vertex 5 10 30 + vertex 0 0 0 + vertex 10 0 0 + endloop + endfacet + facet normal -0 -0 -1 + outer loop + vertex 0 0 0 + vertex 0 20 0 + vertex 10 0 0 + endloop + endfacet + facet normal 0 0 -1 + outer loop + vertex 10 0 0 + vertex 0 20 0 + vertex 10 20 0 + endloop + endfacet + facet normal -0 0.948683 0.316228 + outer loop + vertex 10 20 0 + vertex 0 20 0 + vertex 5 10 30 + endloop + endfacet + facet normal 0.986394 -0 0.164399 + outer loop + vertex 10 20 0 + vertex 5 10 30 + vertex 10 0 0 + endloop + endfacet + facet normal -0.986394 0 0.164399 + outer loop + vertex 20 20 0 + vertex 20 0 0 + vertex 25 20 30 + endloop + endfacet + facet normal 0 -0.83205 0.5547 + outer loop + vertex 25 20 30 + vertex 20 0 0 + vertex 30 0 0 + endloop + endfacet + facet normal -0 -0 -1 + outer loop + vertex 20 0 0 + vertex 20 20 0 + vertex 30 0 0 + endloop + endfacet + facet normal 0 0 -1 + outer loop + vertex 30 0 0 + vertex 20 20 0 + vertex 30 20 0 + endloop + endfacet + facet normal -0 1 0 + outer loop + vertex 30 20 0 + vertex 20 20 0 + vertex 25 20 30 + endloop + endfacet + facet normal 0.986394 -0 0.164399 + outer loop + vertex 30 20 0 + vertex 25 20 30 + vertex 30 0 0 + endloop + endfacet + facet normal -1 0 0 + outer loop + vertex 40 20 0 + vertex 40 0 0 + vertex 40 20 30 + endloop + endfacet + facet normal 0 -0.83205 0.5547 + outer loop + vertex 40 20 30 + vertex 40 0 0 + vertex 50 0 0 + endloop + endfacet + facet normal -0 -0 -1 + outer loop + vertex 40 0 0 + vertex 40 20 0 + vertex 50 0 0 + endloop + endfacet + facet normal 0 0 -1 + outer loop + vertex 50 0 0 + vertex 40 20 0 + vertex 50 20 0 + endloop + endfacet + facet normal -0 1 0 + outer loop + vertex 50 20 0 + vertex 40 20 0 + vertex 40 20 30 + endloop + endfacet + facet normal 0.948683 -0 0.316228 + outer loop + vertex 50 20 0 + vertex 40 20 30 + vertex 50 0 0 + endloop + endfacet + facet normal -1 -0 -0 + outer loop + vertex 60 0 0 + vertex 60 0 30 + vertex 60 20 0 + endloop + endfacet + facet normal -1 0 0 + outer loop + vertex 60 20 0 + vertex 60 0 30 + vertex 60 20 30 + endloop + endfacet + facet normal 0 -1 0 + outer loop + vertex 60 0 30 + vertex 60 0 0 + vertex 70 0 0 + endloop + endfacet + facet normal -0 -0 -1 + outer loop + vertex 60 0 0 + vertex 60 20 0 + vertex 70 0 0 + endloop + endfacet + facet normal 0 0 -1 + outer loop + vertex 70 0 0 + vertex 60 20 0 + vertex 70 20 0 + endloop + endfacet + facet normal -0 1 0 + outer loop + vertex 70 20 0 + vertex 60 20 0 + vertex 60 20 30 + endloop + endfacet + facet normal 0.948683 -0 0.316228 + outer loop + vertex 60 20 30 + vertex 60 0 30 + vertex 70 0 0 + endloop + endfacet + facet normal 0.948683 -0 0.316228 + outer loop + vertex 70 20 0 + vertex 60 20 30 + vertex 70 0 0 + endloop + endfacet + facet normal -0.986394 0 0.164399 + outer loop + vertex 80 0 0 + vertex 85 0 30 + vertex 80 20 0 + endloop + endfacet + facet normal -0.986394 0 0.164399 + outer loop + vertex 80 20 0 + vertex 85 0 30 + vertex 85 20 30 + endloop + endfacet + facet normal 0 -1 0 + outer loop + vertex 85 0 30 + vertex 80 0 0 + vertex 90 0 0 + endloop + endfacet + facet normal -0 -0 -1 + outer loop + vertex 80 0 0 + vertex 80 20 0 + vertex 90 0 0 + endloop + endfacet + facet normal 0 0 -1 + outer loop + vertex 90 0 0 + vertex 80 20 0 + vertex 90 20 0 + endloop + endfacet + facet normal -0 1 0 + outer loop + vertex 90 20 0 + vertex 80 20 0 + vertex 85 20 30 + endloop + endfacet + facet normal 0.986394 -0 0.164399 + outer loop + vertex 85 20 30 + vertex 85 0 30 + vertex 90 0 0 + endloop + endfacet + facet normal 0.986394 -0 0.164399 + outer loop + vertex 90 20 0 + vertex 85 20 30 + vertex 90 0 0 + endloop + endfacet +endsolid OpenSCAD_Model diff --git a/libtriangles.scad b/libtriangles.scad new file mode 100644 index 0000000..40e4876 --- /dev/null +++ b/libtriangles.scad @@ -0,0 +1,58 @@ +//todo, make library work with negative lengths by adding triangles to the inside of every surface. basicaly copy and paste the current triangles set and reverse the first and last digit of every triangle. In 4 character traingles switcht the middle ones around as well. + +module rightpyramid(rightpyramidx, rightpyramidy, rightpyramidz) { + polyhedron ( points = [[0,0,0], + [rightpyramidx, 0, 0], + [0, rightpyramidy, 0], + [rightpyramidx, rightpyramidy, 0], + [rightpyramidx/2, rightpyramidy, rightpyramidz]], + + triangles = [[0,1,2],[2,1,3],[4,1,0],[3,1,4],[2,3,4],[0,2,4]]); + +} + +module cornerpyramid(cornerpyramidx, cornerpyramidy, cornerpyramidz) { + polyhedron ( points = [[0,0,0], + [cornerpyramidx, 0, 0], + [0, cornerpyramidy, 0], + [cornerpyramidx, cornerpyramidy, 0], + [0, cornerpyramidy, cornerpyramidz]], + + triangles = [[0,1,2],[2,1,3],[4,1,0],[3,1,4],[2,3,4],[0,2,4]]); + +} + +module eqlpyramid(eqlpyramidx, eqlpyramidy, eqlpyramidz) { + polyhedron ( points = [[0,0,0], + [eqlpyramidx, 0, 0], + [0, eqlpyramidy, 0], + [eqlpyramidx, eqlpyramidy, 0], + [eqlpyramidx/2, eqlpyramidy/2, eqlpyramidz]], + + triangles = [[0,1,2],[2,1,3],[4,1,0],[3,1,4],[2,3,4],[0,2,4]]); + +} + + +module rightprism(rightprismx,rightprismy,rightprismz){ + polyhedron ( points = [[0,0,0], + [rightprismx,0,0], + [rightprismx,rightprismy,0], + [0,rightprismy,0], + [0,rightprismy,rightprismz], + [0,0,rightprismz]], + triangles = [[0,1,2,3],[5,1,0],[5,4,2,1],[4,3,2],[0,3,4,5]]); +} + + + +module eqlprism(rightprismx,rightprismy,rightprismz){ + polyhedron ( points = [[0,0,0], + [rightprismx,0,0], + [rightprismx,rightprismy,0], + [0,rightprismy,0], + [rightprismx/2,rightprismy,rightprismz], + [rightprismx/2,0,rightprismz]], + triangles = [[0,1,2,3],[5,1,0],[5,4,2,1],[4,3,2],[0,3,4,5]]); +} + From 913733d22b65bc8ea0170cce3b22523a2fe303cb Mon Sep 17 00:00:00 2001 From: traverseda Date: Fri, 15 Feb 2013 17:03:59 -0400 Subject: [PATCH 2/5] Cleaned up the examples folder --- examples/example.stl | 240 ------------------------------------------- 1 file changed, 240 deletions(-) delete mode 100644 examples/example.stl diff --git a/examples/example.stl b/examples/example.stl deleted file mode 100644 index f3adc29..0000000 --- a/examples/example.stl +++ /dev/null @@ -1,240 +0,0 @@ -solid OpenSCAD_Model - facet normal -0.986394 0 0.164399 - outer loop - vertex 0 20 0 - vertex 0 0 0 - vertex 5 10 30 - endloop - endfacet - facet normal 0 -0.948683 0.316228 - outer loop - vertex 5 10 30 - vertex 0 0 0 - vertex 10 0 0 - endloop - endfacet - facet normal -0 -0 -1 - outer loop - vertex 0 0 0 - vertex 0 20 0 - vertex 10 0 0 - endloop - endfacet - facet normal 0 0 -1 - outer loop - vertex 10 0 0 - vertex 0 20 0 - vertex 10 20 0 - endloop - endfacet - facet normal -0 0.948683 0.316228 - outer loop - vertex 10 20 0 - vertex 0 20 0 - vertex 5 10 30 - endloop - endfacet - facet normal 0.986394 -0 0.164399 - outer loop - vertex 10 20 0 - vertex 5 10 30 - vertex 10 0 0 - endloop - endfacet - facet normal -0.986394 0 0.164399 - outer loop - vertex 20 20 0 - vertex 20 0 0 - vertex 25 20 30 - endloop - endfacet - facet normal 0 -0.83205 0.5547 - outer loop - vertex 25 20 30 - vertex 20 0 0 - vertex 30 0 0 - endloop - endfacet - facet normal -0 -0 -1 - outer loop - vertex 20 0 0 - vertex 20 20 0 - vertex 30 0 0 - endloop - endfacet - facet normal 0 0 -1 - outer loop - vertex 30 0 0 - vertex 20 20 0 - vertex 30 20 0 - endloop - endfacet - facet normal -0 1 0 - outer loop - vertex 30 20 0 - vertex 20 20 0 - vertex 25 20 30 - endloop - endfacet - facet normal 0.986394 -0 0.164399 - outer loop - vertex 30 20 0 - vertex 25 20 30 - vertex 30 0 0 - endloop - endfacet - facet normal -1 0 0 - outer loop - vertex 40 20 0 - vertex 40 0 0 - vertex 40 20 30 - endloop - endfacet - facet normal 0 -0.83205 0.5547 - outer loop - vertex 40 20 30 - vertex 40 0 0 - vertex 50 0 0 - endloop - endfacet - facet normal -0 -0 -1 - outer loop - vertex 40 0 0 - vertex 40 20 0 - vertex 50 0 0 - endloop - endfacet - facet normal 0 0 -1 - outer loop - vertex 50 0 0 - vertex 40 20 0 - vertex 50 20 0 - endloop - endfacet - facet normal -0 1 0 - outer loop - vertex 50 20 0 - vertex 40 20 0 - vertex 40 20 30 - endloop - endfacet - facet normal 0.948683 -0 0.316228 - outer loop - vertex 50 20 0 - vertex 40 20 30 - vertex 50 0 0 - endloop - endfacet - facet normal -1 -0 -0 - outer loop - vertex 60 0 0 - vertex 60 0 30 - vertex 60 20 0 - endloop - endfacet - facet normal -1 0 0 - outer loop - vertex 60 20 0 - vertex 60 0 30 - vertex 60 20 30 - endloop - endfacet - facet normal 0 -1 0 - outer loop - vertex 60 0 30 - vertex 60 0 0 - vertex 70 0 0 - endloop - endfacet - facet normal -0 -0 -1 - outer loop - vertex 60 0 0 - vertex 60 20 0 - vertex 70 0 0 - endloop - endfacet - facet normal 0 0 -1 - outer loop - vertex 70 0 0 - vertex 60 20 0 - vertex 70 20 0 - endloop - endfacet - facet normal -0 1 0 - outer loop - vertex 70 20 0 - vertex 60 20 0 - vertex 60 20 30 - endloop - endfacet - facet normal 0.948683 -0 0.316228 - outer loop - vertex 60 20 30 - vertex 60 0 30 - vertex 70 0 0 - endloop - endfacet - facet normal 0.948683 -0 0.316228 - outer loop - vertex 70 20 0 - vertex 60 20 30 - vertex 70 0 0 - endloop - endfacet - facet normal -0.986394 0 0.164399 - outer loop - vertex 80 0 0 - vertex 85 0 30 - vertex 80 20 0 - endloop - endfacet - facet normal -0.986394 0 0.164399 - outer loop - vertex 80 20 0 - vertex 85 0 30 - vertex 85 20 30 - endloop - endfacet - facet normal 0 -1 0 - outer loop - vertex 85 0 30 - vertex 80 0 0 - vertex 90 0 0 - endloop - endfacet - facet normal -0 -0 -1 - outer loop - vertex 80 0 0 - vertex 80 20 0 - vertex 90 0 0 - endloop - endfacet - facet normal 0 0 -1 - outer loop - vertex 90 0 0 - vertex 80 20 0 - vertex 90 20 0 - endloop - endfacet - facet normal -0 1 0 - outer loop - vertex 90 20 0 - vertex 80 20 0 - vertex 85 20 30 - endloop - endfacet - facet normal 0.986394 -0 0.164399 - outer loop - vertex 85 20 30 - vertex 85 0 30 - vertex 90 0 0 - endloop - endfacet - facet normal 0.986394 -0 0.164399 - outer loop - vertex 90 20 0 - vertex 85 20 30 - vertex 90 0 0 - endloop - endfacet -endsolid OpenSCAD_Model From bdee716f59ce432a4b91bba5e47e0fd04604135a Mon Sep 17 00:00:00 2001 From: traverseda Date: Sat, 16 Feb 2013 13:27:27 -0400 Subject: [PATCH 3/5] Changes examples/example.libtriangles.scad to test_libtriangles.scad --- examples/example.libtriangles.scad => test_libtriangles.scad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename examples/example.libtriangles.scad => test_libtriangles.scad (91%) diff --git a/examples/example.libtriangles.scad b/test_libtriangles.scad similarity index 91% rename from examples/example.libtriangles.scad rename to test_libtriangles.scad index 05390ec..b58ce56 100644 --- a/examples/example.libtriangles.scad +++ b/test_libtriangles.scad @@ -1,4 +1,4 @@ -use <../libtriangles.scad>; +use ; //all of these follow the (X,Y,Z) syntax From 3671d2139a5ea3bacae4f276aebf0d9e64ddb89e Mon Sep 17 00:00:00 2001 From: traverseda Date: Sat, 16 Feb 2013 13:36:56 -0400 Subject: [PATCH 4/5] Added licensing stuff. --- libtriangles.scad | 4 +++- test_libtriangles.scad | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libtriangles.scad b/libtriangles.scad index 40e4876..d5f207e 100644 --- a/libtriangles.scad +++ b/libtriangles.scad @@ -1,4 +1,6 @@ -//todo, make library work with negative lengths by adding triangles to the inside of every surface. basicaly copy and paste the current triangles set and reverse the first and last digit of every triangle. In 4 character traingles switcht the middle ones around as well. +//Copyright (C) 2013 Alex Davies +//License: LGPL 2.1 or later +//todo, make library work with negative lengths by adding triangles to the inside of every surface. basicaly copy and paste the current triangles set and reverse the first and last digit of every triangle. In 4 character traingles switcht the middle ones around as well. Not sure if that' actually useful though. module rightpyramid(rightpyramidx, rightpyramidy, rightpyramidz) { polyhedron ( points = [[0,0,0], diff --git a/test_libtriangles.scad b/test_libtriangles.scad index b58ce56..21b123c 100644 --- a/test_libtriangles.scad +++ b/test_libtriangles.scad @@ -1,3 +1,5 @@ +//Copyright (C) 2013 Alex Davies +//License: LGPL 2.1 or later use ; //all of these follow the (X,Y,Z) syntax From 0356f2f2d4e2655ac7d2456d46c55e63de671787 Mon Sep 17 00:00:00 2001 From: traverseda Date: Sat, 16 Feb 2013 15:12:12 -0400 Subject: [PATCH 5/5] Removed test_libtriangles. I was under the mistaken impression is provided a set of examples, so you could see at a glance the result of the code. This doesn't really need a test function. --- test_libtriangles.scad | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 test_libtriangles.scad diff --git a/test_libtriangles.scad b/test_libtriangles.scad deleted file mode 100644 index 21b123c..0000000 --- a/test_libtriangles.scad +++ /dev/null @@ -1,12 +0,0 @@ -//Copyright (C) 2013 Alex Davies -//License: LGPL 2.1 or later -use ; - -//all of these follow the (X,Y,Z) syntax - -translate(v = [0, 0, 0])eqlpyramid(10,20,30); -translate(v = [20, 0, 0]) rightpyramid(10,20,30); -translate(v = [40, 0, 0]) cornerpyramid(10,20,30); -translate(v = [60, 0, 0]) rightprism(10,20,30); -translate(v = [80, 0, 0]) eqlprism(10,20,30); -