From 06a460f75732a56d27e24f08b6028dbe099c0b3f Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Tue, 23 Apr 2019 15:59:43 -0700 Subject: [PATCH] Removed usage of upcube() --- README.md | 2 +- attachments.scad | 2 +- convex_hull.scad | 6 +----- foo.scad | 7 +++++++ geometry.scad | 3 ++- scripts/make_all_docs.sh | 2 +- shapes.scad | 10 +++++----- 7 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 foo.scad diff --git a/README.md b/README.md index d4001e7..882fef7 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ A lot of the features of this library are to allow shorter, easier-to-read, inte [`BOSL2/shapes.scad`](https://github.com/revarbat/BOSL2/wiki/shapes.scad) Examples | Raw OpenSCAD Equivalent ---------------------------------- | ------------------------------- -`upcube([10,20,30]);` | `translate([0,0,15]) cube([10,20,30], center=true);` +`cube([10,20,30], anchor=BOTTOM);` | `translate([0,0,15]) cube([10,20,30], center=true);` `cuboid([20,20,30], fillet=5, edges=EDGES_Z_ALL);` | `minkowski() {cube([10,10,20], center=true); sphere(r=5, $fn=32);}` `prismoid([30,40],[20,30],h=10);` | `hull() {translate([0,0,0.005]) cube([30,40,0.01], center=true); translate([0,0,9.995]) cube([20,30,0.01],center=true);}` `xcyl(l=20,d=4);` | `rotate([0,90,0]) cylinder(h=20, d=4, center=true);` diff --git a/attachments.scad b/attachments.scad index cec7de6..82f6007 100644 --- a/attachments.scad +++ b/attachments.scad @@ -58,7 +58,7 @@ function anchorpt(name, pos=[0,0,0], dir=UP, rot=0) = [name, pos, dir, rot]; // Usage: // find_anchor(anchor, h, size, [size2], [shift], [edges], [corners]); // Description: -// Generates a list of typical anchors. +// Returns anchor data for the given vector or anchor name. // Arguments: // anchor = Vector or named anchor string. // h = Height of the region. diff --git a/convex_hull.scad b/convex_hull.scad index 8d9b9a1..a62813e 100644 --- a/convex_hull.scad +++ b/convex_hull.scad @@ -11,7 +11,7 @@ ////////////////////////////////////////////////////////////////////// -// Section: Generalized Hull +// Section: Convex Hulls // Function: convex_hull() // Usage: @@ -32,8 +32,6 @@ function convex_hull(points) = -// Section: 2D Hull - // Function: convex_hull2d() // Usage: // convex_hull2d(points) @@ -96,8 +94,6 @@ function _remove_conflicts_and_insert_point(polygon, conflicts, point) = -// Section: 3D Hull - // Function: convex_hull3d() // Usage: // convex_hull3d(points) diff --git a/foo.scad b/foo.scad new file mode 100644 index 0000000..1983f5e --- /dev/null +++ b/foo.scad @@ -0,0 +1,7 @@ +include + +cube([20,4,4], anchor=TOP+FRONT) { + attach(FRONT, BACK) cube([20,20,4]); + attach(TOP, BOTTOM) cube([20,4,20]); + attach(TOP+FRONT, norot=true) recolor("green") interior_fillet(l=20, r=10, orient=ORIENT_XNEG); +} diff --git a/geometry.scad b/geometry.scad index f920996..fb0090d 100644 --- a/geometry.scad +++ b/geometry.scad @@ -271,7 +271,8 @@ function simplify_path_indexed(points, path, eps=EPSILON, _a=0, _b=2, _acc=[]) = // point_in_polygon(point, path) // Description: // This function tests whether the given point is inside, outside or on the boundary of -// the specified polygon using the Winding Number method. (http://geomalgorithms.com/a03-_inclusion.html) +// the specified polygon using the Winding Number method: +// - (http://geomalgorithms.com/a03-_inclusion.html) // The polygon is given as a list of points, not including the repeated end point. // Returns -1 if the point is outside the polyon. // Returns 0 if the point is on the boundary. diff --git a/scripts/make_all_docs.sh b/scripts/make_all_docs.sh index 8540c24..f4d1e3a 100755 --- a/scripts/make_all_docs.sh +++ b/scripts/make_all_docs.sh @@ -1,6 +1,6 @@ #!/bin/bash -PREVIEW_LIBS="constants compat attachments math arrays vectors matrices coords geometry triangulation quaternions convex_hull transforms primitives shapes masks paths beziers metric_screws threading involute_gears sliders joiners linear_bearings nema_steppers wiring phillips_drive torx_drive debug" +PREVIEW_LIBS="compat attachments math arrays vectors matrices coords geometry triangulation quaternions convex_hull constants transforms primitives shapes masks paths beziers metric_screws threading involute_gears sliders joiners linear_bearings nema_steppers wiring phillips_drive torx_drive debug" dir="$(basename $PWD)" if [ "$dir" = "BOSL2" ]; then diff --git a/shapes.scad b/shapes.scad index a26795f..49f15d5 100644 --- a/shapes.scad +++ b/shapes.scad @@ -133,7 +133,7 @@ module cuboid( if (corner_edge_count(edges, [xa,ya,za]) > 2) { translate(vmul([xa,ya,za]/2, size-[1,1,1]*chamfer*4/3)) { rot(from=UP, to=[xa,ya,za]) { - upcube(chamfer*3); + cube(chamfer*3, anchor=BOTTOM); } } } @@ -1543,7 +1543,7 @@ module sparse_strut3d(h=50, l=100, w=50, thick=3, maxang=40, strut=3, max_bridge if (zreps>1) { back(cross_len/2) { zrot(-cross_ang) { - down(strut) upcube([strut, strut, zstep+strut]); + down(strut) cube([strut, strut, zstep+strut], anchor=BOTTOM); } } } @@ -1551,7 +1551,7 @@ module sparse_strut3d(h=50, l=100, w=50, thick=3, maxang=40, strut=3, max_bridge yflip_copy() { back(soff*supp_step) { skew_xy(ya=supp_ang) { - upcube([strut, strut, zstep]); + cube([strut, strut, zstep], anchor=BOTTOM); } } } @@ -1712,8 +1712,8 @@ module pie_slice( // // Example: // union() { -// translate([0,2,-4]) upcube([20, 4, 24]); -// translate([0,-10,-4]) upcube([20, 20, 4]); +// translate([0,2,-4]) cube([20, 4, 24], anchor=BOTTOM); +// translate([0,-10,-4]) cube([20, 20, 4], anchor=BOTTOM); // color("green") interior_fillet(l=20, r=10, orient=ORIENT_XNEG); // } //