From 868730fec75d5f3871eb02644f1b489d0cae026f Mon Sep 17 00:00:00 2001 From: Elmom Date: Sat, 8 Jan 2011 15:37:56 +0200 Subject: [PATCH] Added a general ngon and improved some api docs --- shapes.scad | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/shapes.scad b/shapes.scad index b4b1ea7..ae8eac6 100644 --- a/shapes.scad +++ b/shapes.scad @@ -9,6 +9,7 @@ // 2D Shapes //ellipse(width, height); //egg_outline(width=5, length=7); +//ngon(sides, radius, center=false); // 3D Shapes //box(width, height, depth); @@ -16,8 +17,9 @@ //cone(height, radius); //ellipticalCylinder(width, height, depth); //ellipsoid(width, height); -//tube(height, radius, wall); -//ovalTube(width, height, depth, wall); +//tube(height, radius, wall, center = false); +//tube2(height, ID, OD, center = false); +//ovalTube(width, height, depth, wall, center = false); //hexagon(height, depth); //octagon(height, depth); //dodecagon(height, depth); @@ -78,6 +80,14 @@ module tube(height, radius, wall, center = false) { } } +// wall is wall thickness +module tube2(height, ID, OD, center = false) { + difference() { + cylinder(h=height, r=OD/2, center=center); + cylinder(h=height, r=ID/2, center=center); + } +} + // wall is wall thickness module ovalTube(height, rx, ry, wall, center = false) { difference() { @@ -86,6 +96,11 @@ module ovalTube(height, rx, ry, wall, center = false) { } } +// The orientation might change with the implementation of circle... +module ngon(sides, radius, center=false){ + rotate([0, 0, 360/sides/2]) circle(r=radius, $fn=sides, center=center); +} + // size is the XY plane size, height in Z module hexagon(size, height) { boxWidth = size/1.75;