Added a general ngon and improved some api docs

This commit is contained in:
Elmom 2011-01-08 15:37:56 +02:00
parent d21103e652
commit 868730fec7

View file

@ -9,6 +9,7 @@
// 2D Shapes // 2D Shapes
//ellipse(width, height); //ellipse(width, height);
//egg_outline(width=5, length=7); //egg_outline(width=5, length=7);
//ngon(sides, radius, center=false);
// 3D Shapes // 3D Shapes
//box(width, height, depth); //box(width, height, depth);
@ -16,8 +17,9 @@
//cone(height, radius); //cone(height, radius);
//ellipticalCylinder(width, height, depth); //ellipticalCylinder(width, height, depth);
//ellipsoid(width, height); //ellipsoid(width, height);
//tube(height, radius, wall); //tube(height, radius, wall, center = false);
//ovalTube(width, height, depth, wall); //tube2(height, ID, OD, center = false);
//ovalTube(width, height, depth, wall, center = false);
//hexagon(height, depth); //hexagon(height, depth);
//octagon(height, depth); //octagon(height, depth);
//dodecagon(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 // wall is wall thickness
module ovalTube(height, rx, ry, wall, center = false) { module ovalTube(height, rx, ry, wall, center = false) {
difference() { 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 // size is the XY plane size, height in Z
module hexagon(size, height) { module hexagon(size, height) {
boxWidth = size/1.75; boxWidth = size/1.75;