diff --git a/README.md b/README.md index c3371847..ce904a5a 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ See [examples](examples). - [function_grapher](https://openhome.cc/eGossip/OpenSCAD/lib2x-function_grapher.html) - [polysections](https://openhome.cc/eGossip/OpenSCAD/lib2x-polysections.html) (It'll be deprecated from 2.3. Use `sweep` instead.) - [sweep](https://openhome.cc/eGossip/OpenSCAD/lib2x-sweep.html) (2.3 Preview) -- loft (2.3 Preview) +- [loft](https://openhome.cc/eGossip/OpenSCAD/lib2x-loft.html) (2.3 Preview) - [starburst](https://openhome.cc/eGossip/OpenSCAD/lib2x-starburst.html) - [voronoi3d](https://openhome.cc/eGossip/OpenSCAD/lib2x-voronoi3d.html) diff --git a/docs/images/lib2x-loft-1.JPG b/docs/images/lib2x-loft-1.JPG new file mode 100644 index 00000000..7963bddd Binary files /dev/null and b/docs/images/lib2x-loft-1.JPG differ diff --git a/docs/lib2x-loft.md b/docs/lib2x-loft.md new file mode 100644 index 00000000..0bae16ab --- /dev/null +++ b/docs/lib2x-loft.md @@ -0,0 +1,50 @@ +# loft + +When having uniform cross sections, you can use [sweep](https://openhome.cc/eGossip/OpenSCAD/lib2x-sweep.html) to create a module. The `loft` here is best when you have a body with multiple crosssections with different geometries. + +**Since:** 2.3 + +## Parameters + +- `sections` : A list of cross-sections, The points must be count-clockwise indexes. +- `slices` : Defines the number of intermediate points between two sections. Default to 1. + +## Examples + + use ; + use ; + use ; + use ; + + sects = [ + for(i = 10; i >= 4; i = i - 1) + [ + for(p = shape_starburst(15, 12, i % 2 == 1 ? i : i - 1)) ptf_rotate([p[0], p[1], 5 * (i - 4)], i * 10) + ] + ]; + loft(sects, slices = 3); + + translate([30, 0, 0]) + difference() { + loft( + [ + [for(p = shape_circle(10, $fn = 3)) [p[0], p[1], 15]], + [for(p = shape_circle(15, $fn = 24)) [p[0], p[1], 0]] + ], + slices = 4 + ); + + loft( + [ + [for(p = shape_circle(8, $fn = 3)) [p[0], p[1], 15.1]], + [for(p = shape_circle(13, $fn = 24)) [p[0], p[1], -0.1]] + ], + slices = 4 + ); + } + +![loft](images/lib2x-loft-1.JPG) + + + + diff --git a/src/experimental/demo/loft_demo.scad b/src/experimental/demo/loft_demo.scad deleted file mode 100644 index c62895fb..00000000 --- a/src/experimental/demo/loft_demo.scad +++ /dev/null @@ -1,31 +0,0 @@ -use ; -use ; -use ; -use ; - -sects = [ - for(i = 10; i >= 4; i = i - 1) - [ - for(p = shape_starburst(15, 12, i % 2 == 1 ? i : i - 1)) ptf_rotate([p[0], p[1], 5 * (i - 4)], i * 10) - ] -]; -loft(sects, slices = 3); - -translate([30, 0, 0]) -difference() { - loft( - [ - [for(p = shape_circle(10, $fn = 3)) [p[0], p[1], 15]], - [for(p = shape_circle(15, $fn = 24)) [p[0], p[1], 0]] - ], - slices = 4 - ); - - loft( - [ - [for(p = shape_circle(8, $fn = 3)) [p[0], p[1], 15.1]], - [for(p = shape_circle(13, $fn = 24)) [p[0], p[1], -0.1]] - ], - slices = 4 - ); -} \ No newline at end of file diff --git a/src/loft.scad b/src/loft.scad index 030dd8ad..2d82441d 100644 --- a/src/loft.scad +++ b/src/loft.scad @@ -1,3 +1,13 @@ +/** +* loft.scad +* +* @copyright Justin Lin, 2020 +* @license https://opensource.org/licenses/lgpl-3.0.html +* +* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-loft.html +* +**/ + use ; module loft(sections, slices = 1) {