From c7537d5478993232ae6ba90754bc9db70fd7dc84 Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Fri, 26 Jan 2024 00:26:32 -0800 Subject: [PATCH 01/25] Create Rounding the Cube.md --- tutorials/Rounding the Cube.md | 179 +++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 tutorials/Rounding the Cube.md diff --git a/tutorials/Rounding the Cube.md b/tutorials/Rounding the Cube.md new file mode 100644 index 0000000..2035bcf --- /dev/null +++ b/tutorials/Rounding the Cube.md @@ -0,0 +1,179 @@ +# Rounding the Cube + +One of the shape primitives you'll use most often in your OpenSCAD creations is the cube. Rounding the edges of cube-like objects impacts both the visual appeal and functional aspects of the final product. The BOSL2 library provides a variety of methods for rounding edges and corners. + +There are four different 3d shape primitives that you can use to make cube-like objects: + +* [**cuboid()**](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-cuboid) - Creates a cube with chamfering and roundovers. + +* [**cube()**](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-cube) - An extended version of OpenSCAD's cube() with anchors for attaching children. (See the [Attachments Tutorial](https://github.com/BelfrySCAD/BOSL2/wiki/Tutorial-Attachments)). + +* [**prismoid()**](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) - Creates a rectangular prismoid shape with optional roundovers and chamfering. + +* [**rounded_prism()**](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) - Makes a rounded 3d object by connecting two polygons with the same vertex count. Rounded_prism supports continuous curvature rounding. (See [Types of Roundovers](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#section-types-of-roundovers)). + + +BOSL2 provides two different methods for rounding the edges of the cube-like primitives above. + +* **Built-in Rounding** - Cuboid, prismoid, and rounded_prism all have built-in arguments for rounding some or all of their edges. + +* **Masking** - BOSL2 includes a number of options for masking the edges and corners of objects. + + + + + + + +## Cuboid Rounding + +You can round the edges of a cuboid() with the `rounding=` argument by specifying the radius of curvature: + +```openscad-3D +include +cuboid([100,80,60], rounding=20); +``` +If you want to round selected edges you can specify which edges using combinations of the named directions **LEFT, RIGHT, TOP, BOT, FWD, BACK**. See [specifying edges](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#subsection-specifying-edges) for more details. + +![](https://github.com/BelfrySCAD/BOSL2/wiki/images/attachments/subsection-specifying-edges_fig1.png) + +You can round just the top edges: + +```openscad-3D +include +cuboid([100,80,60], rounding=20, edges = TOP); +``` +...or just the bottom edges. Here we're using the *teardrop* parameter to limit the overhang angle to enable 3d printing without supports: + +```openscad-3D +include +cuboid([100,80,60], rounding=20, teardrop = 45, edges = BOTTOM); +``` + +We can round only the edges aligned with one of the axes, X, Y, or Z: + +```openscad-3D +include +cuboid([100,80,60], rounding=20, edges = "Z"); +``` + + +It is possible to round one or more of the edges while leaving others unrounded: + +```openscad-3D +include +cuboid([100,80,60], rounding=20, edges = TOP+FRONT); +``` + +...or exclude the rounding of one or more edges while rounding all the others: + +```openscad-3D +include +cuboid([100,80,60], rounding=20, except = TOP+FRONT); +``` + +There is support for filleting edges using negative rounding values: + +```openscad-3D +include +cuboid([100,80,60], rounding=-20, edges = BOTTOM); +``` + +Chamfering the edges of the cuboid() can be done in a similar fashion: + +```openscad-3D +include +cuboid([100,80,60], chamfer=20); +``` +You can specify edges as with the cuboid(): + +```openscad-3D +include +cuboid([100,80,60], chamfer=20, edges = "Z"); +``` + +##Prismoid Rounding + +The prismoid() differs from the cuboid and cube in that you can only round or chamfer the vertical(ish) edges using the built-in parameters. For those edges, you can specify rounding and/or chamferring for top and bottom separately: + +```openscad-3D +include +prismoid(size1=[35,50], size2=[20,30], h=20, rounding1 = 8, rounding2 = 1); +``` + +You can also specify rounding of the vertical(ish) edges on an edge by edge basis by listing the edges in counter-clockwise order starting with the BACK+RIGHT (X+Y+) edge: + +```openscad-3D +include +prismoid(100, 80, rounding1=[0,50,0,50], rounding2=[40,0,40,0], h=50); +``` + + + +##Masking Edges of the Cuboid, Cube and Prismoid +###2D Edge Masking with [edge_profile()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile) + +One limitation of using rounding arguments in [cuboid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-cuboid) is that all the rounded edges must have the same rounding radius. Using masking we have the flexibility to apply different edge treatments to the same cube. Masking can also be used on the [cube()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-cube) and [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) shapes. + +2D edge masks are attached to edges using [edge_profile()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile). They have a default tag of "remove" to enable differencing them away from your cube using [diff()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-diff). + +We can use a negative rounding value to fillet the bottom of a cuboid and [edge_profile()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile) to round the top. Here edge_profile() applies a 2d roundover mask to the top edges of the cuboid. + +```openscad-3D +include +diff() + cuboid([50,60,70], rounding = -10, edges = BOT) + edge_profile(TOP) + mask2d_roundover(r=10); +``` + +See [mask2d_roundover()](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_roundover) for additional mask parameters. Here we use the *inset* parameter in mask2d_roundover: + +```openscad-3D +include +diff() + cube([50,60,70],center=true) + edge_profile(TOP, except=[BACK,TOP+LEFT]) + mask2d_roundover(h=12, inset=4); +``` + +In addition to the simple roundover mask, there are masks for [cove](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_cove), [chamfer](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_chamfer), [rabbet](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_rabbet), [dovetail](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_dovetail), [teardrop](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_teardrop) and [ogee](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_ogee) edges. + +The mask2d_ogee() only works on cube() and cuboid() shapes, or a prismoid() where size2 >= size1 in both the X and Y dimensions. + +```openscad-3d +include +diff() + prismoid(size1 = [50,50],size2 = [80,80], rounding1 = 25, height = 80) + edge_profile(TOP) + mask2d_ogee([ + "xstep",8, "ystep",5, // Starting shoulder. + "fillet",5, "round",5, // S-curve. + "ystep",3, "xstep",3 // Ending shoulder. + ]); +``` + +You can use edge-profile() to round the top or bottom of a prismoid(). Because the side faces of a prismoid() are not strictly vertical, it's is necessary to increase the length of the masks using the *excess* parameter in edge_profile(). + +```openscad-3D +include +diff() + prismoid(size1=[35,50], size2=[30,30], h=20, rounding1 = 8, rounding2 = 0) + edge_profile([TOP+LEFT, TOP+RIGHT], excess = 5) + mask2d_roundover(r = 15, mask_angle = $edge_angle); +``` + +###3D Edge and Corner Masking + +BOSL2 contains a number of 3d edge and corner masks in addition to the 2d edge profiles shown above. + +The 3d edge masks have the advantage of being able to vary the rounding radius along the edge. 3d edge masks can be attached using [edge_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_mask). They have a default tag of "remove" to enable differencing them away from your cube using [diff()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-diff). + + +```openscad-3D +include +diff() + cuboid(80) + edge_mask(TOP+FWD) + rounding_edge_mask(r1 = 40, r2 = 0, l = 80); +``` \ No newline at end of file From f5c0ef93b6c618a6ab1aa28b80b99042548aca2a Mon Sep 17 00:00:00 2001 From: RAMilewski Date: Sat, 27 Jan 2024 19:08:51 +0000 Subject: [PATCH 02/25] Version Bump --- version.scad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.scad b/version.scad index b502c58..353c735 100644 --- a/version.scad +++ b/version.scad @@ -9,7 +9,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,703]; +BOSL_VERSION = [2,0,704]; // Section: BOSL Library Version Functions From 25d4fb525c4526fc1ea5e51969f095cf631ba246 Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Sat, 27 Jan 2024 14:34:56 -0800 Subject: [PATCH 03/25] Rounded Prism Examples --- .openscad_mdimggen_rc | 2 +- .openscad_mdimggen_rc Dist | 6 ++ tutorials/Rounding the Cube.md | 138 ++++++++++++++++++++++++++++----- 3 files changed, 127 insertions(+), 19 deletions(-) create mode 100644 .openscad_mdimggen_rc Dist diff --git a/.openscad_mdimggen_rc b/.openscad_mdimggen_rc index 89dbdc9..2bc6408 100644 --- a/.openscad_mdimggen_rc +++ b/.openscad_mdimggen_rc @@ -1,4 +1,4 @@ -docs_dir: "BOSL2.wiki" +docs_dir: "/Users/RAM/Desktop/BOSL2.wiki" image_root: "images/tutorials" file_prefix: "Tutorial-" source_files: "tutorials/*.md" diff --git a/.openscad_mdimggen_rc Dist b/.openscad_mdimggen_rc Dist new file mode 100644 index 0000000..89dbdc9 --- /dev/null +++ b/.openscad_mdimggen_rc Dist @@ -0,0 +1,6 @@ +docs_dir: "BOSL2.wiki" +image_root: "images/tutorials" +file_prefix: "Tutorial-" +source_files: "tutorials/*.md" +png_animations: true + diff --git a/tutorials/Rounding the Cube.md b/tutorials/Rounding the Cube.md index 2035bcf..35af0d7 100644 --- a/tutorials/Rounding the Cube.md +++ b/tutorials/Rounding the Cube.md @@ -1,6 +1,6 @@ # Rounding the Cube -One of the shape primitives you'll use most often in your OpenSCAD creations is the cube. Rounding the edges of cube-like objects impacts both the visual appeal and functional aspects of the final product. The BOSL2 library provides a variety of methods for rounding edges and corners. +One of the shape primitives you'll use most often in your OpenSCAD designs is the cube. Rounding the edges of cube-like objects impacts both the visual appeal and functional aspects of the final product. The BOSL2 library provides a variety of methods for rounding edges and corners. There are four different 3d shape primitives that you can use to make cube-like objects: @@ -17,12 +17,7 @@ BOSL2 provides two different methods for rounding the edges of the cube-like pri * **Built-in Rounding** - Cuboid, prismoid, and rounded_prism all have built-in arguments for rounding some or all of their edges. -* **Masking** - BOSL2 includes a number of options for masking the edges and corners of objects. - - - - - +* **Masking** - BOSL2 includes a number of options for masking the edges and corners of objects. Masking can accomplish rounding tasks that are not possible with the built-in rounding arguments. ## Cuboid Rounding @@ -31,8 +26,9 @@ You can round the edges of a cuboid() with the `rounding=` argument by specifyin ```openscad-3D include -cuboid([100,80,60], rounding=20); +cuboid(100, rounding=20); ``` + If you want to round selected edges you can specify which edges using combinations of the named directions **LEFT, RIGHT, TOP, BOT, FWD, BACK**. See [specifying edges](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#subsection-specifying-edges) for more details. ![](https://github.com/BelfrySCAD/BOSL2/wiki/images/attachments/subsection-specifying-edges_fig1.png) @@ -43,6 +39,7 @@ You can round just the top edges: include cuboid([100,80,60], rounding=20, edges = TOP); ``` + ...or just the bottom edges. Here we're using the *teardrop* parameter to limit the overhang angle to enable 3d printing without supports: ```openscad-3D @@ -72,7 +69,7 @@ include cuboid([100,80,60], rounding=20, except = TOP+FRONT); ``` -There is support for filleting edges using negative rounding values: +You can fillet edges by using negative rounding values: ```openscad-3D include @@ -85,23 +82,24 @@ Chamfering the edges of the cuboid() can be done in a similar fashion: include cuboid([100,80,60], chamfer=20); ``` -You can specify edges as with the cuboid(): + +You can specify edges as with rounding. ```openscad-3D include -cuboid([100,80,60], chamfer=20, edges = "Z"); +cuboid([100,80,60], chamfer=20, edges = "Z", except = FWD+RIGHT); ``` ##Prismoid Rounding -The prismoid() differs from the cuboid and cube in that you can only round or chamfer the vertical(ish) edges using the built-in parameters. For those edges, you can specify rounding and/or chamferring for top and bottom separately: +The [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) differs from the cuboid and cube in that you can only round or chamfer the vertical(ish) edges using the built-in parameters. For those edges, you can specify rounding and/or chamferring for top and bottom separately: ```openscad-3D include prismoid(size1=[35,50], size2=[20,30], h=20, rounding1 = 8, rounding2 = 1); ``` -You can also specify rounding of the vertical(ish) edges on an edge by edge basis by listing the edges in counter-clockwise order starting with the BACK+RIGHT (X+Y+) edge: +You can also specify rounding of the individual vertical(ish) edges on an edge by edge basis by listing the edges in counter-clockwise order starting with the BACK+RIGHT (X+Y+) edge: ```openscad-3D include @@ -109,7 +107,6 @@ prismoid(100, 80, rounding1=[0,50,0,50], rounding2=[40,0,40,0], h=50); ``` - ##Masking Edges of the Cuboid, Cube and Prismoid ###2D Edge Masking with [edge_profile()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile) @@ -139,7 +136,7 @@ diff() In addition to the simple roundover mask, there are masks for [cove](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_cove), [chamfer](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_chamfer), [rabbet](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_rabbet), [dovetail](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_dovetail), [teardrop](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_teardrop) and [ogee](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_ogee) edges. -The mask2d_ogee() only works on cube() and cuboid() shapes, or a prismoid() where size2 >= size1 in both the X and Y dimensions. +The mask2d_ogee() only works on cube() and cuboid() shapes, or a [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) where size2 >= size1 in both the X and Y dimensions. ```openscad-3d include @@ -153,7 +150,7 @@ diff() ]); ``` -You can use edge-profile() to round the top or bottom of a prismoid(). Because the side faces of a prismoid() are not strictly vertical, it's is necessary to increase the length of the masks using the *excess* parameter in edge_profile(). +You can use edge-profile() to round the top or bottom of a [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid). Because the side faces of a [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) are not strictly vertical, it's is necessary to increase the length of the masks using the *excess* parameter in edge_profile(), and in mask2d\_roundover to set the mask\_angle to $edge\_angle. ```openscad-3D include @@ -167,7 +164,7 @@ diff() BOSL2 contains a number of 3d edge and corner masks in addition to the 2d edge profiles shown above. -The 3d edge masks have the advantage of being able to vary the rounding radius along the edge. 3d edge masks can be attached using [edge_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_mask). They have a default tag of "remove" to enable differencing them away from your cube using [diff()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-diff). +The 3d edge masks have the advantage of being able to vary the rounding radius along the edge. 3d edge masks, such as[ rounding\_edge_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-rounding_edge_mask), can be attached using [edge_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_mask). The 3D edge masks have a default tag of "remove" to enable differencing them away from your cube using [diff()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-diff). ```openscad-3D @@ -176,4 +173,109 @@ diff() cuboid(80) edge_mask(TOP+FWD) rounding_edge_mask(r1 = 40, r2 = 0, l = 80); -``` \ No newline at end of file +``` + +While you can specify the length of the mask with the l argument, [edge_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_mask) sets a special variable, `$parent_size`, to the size of the parent object. In either case the parent is not a perfect cube, you need to mask each edge individually: + +```openscad-3D +include +diff() + cuboid([60,80,40]) { + edge_mask(TOP+FWD) + rounding_edge_mask(r = 10, l = $parent_size.x); + edge_mask(TOP+RIGHT) + rounding_edge_mask(r = 10, l = $parent_size.y); + edge_mask(RIGHT+FWD) + rounding_edge_mask(r = 10, l = $parent_size.z); + } +``` + +As you can see above, using only [rounding\_edge_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-rounding_edge_mask) to round the top of the cube leaves the corners unrounded. Use [corner_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-corner_mask) and [rounding\_corner_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-rounding_corner_mask) for a smoother corner. + +```openscad-3D +include +diff() + cuboid([60,80,40]) { + edge_mask(TOP+FWD) + rounding_edge_mask(r = 10, l = $parent_size.x); + edge_mask(TOP+RIGHT) + rounding_edge_mask(r = 10, l = $parent_size.y); + edge_mask(RIGHT+FWD) + rounding_edge_mask(r = 10, l = $parent_size.z); + corner_mask(TOP+RIGHT+FWD) + rounding_corner_mask(r = 10); + } + +``` + +As with the built-in rounding arguments, you can use [edge\_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_mask) and [corner\_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-corner_mask) to apply teardrop roundings using [teardrop\_edge_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-teardrop_edge_mask) and [teardrop\_corner_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-teardrop_corner_mask) to limit the overhang angle for better printing on FDM printers. + +```openscad-3D +include +diff() + cuboid([60,80,40]) { + edge_mask(TOP+FWD) + teardrop_edge_mask(r = 10, l = $parent_size.x, angle = 40); + edge_mask(TOP+RIGHT) + teardrop_edge_mask(r = 10, l = $parent_size.y, angle = 40); + edge_mask(RIGHT+FWD) + teardrop_edge_mask(r = 10, l = $parent_size.z, angle = 40); + corner_mask(TOP+RIGHT+FWD) + teardrop_corner_mask(r = 10, angle = 40); + } + +``` +##Rounded Prism +You can construct cube-like objects, as well as a variety of other prisms using [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism). The unique feature of [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism) is the ability to use continuous curvature rounding. Rather than using constant radius arcs, continuous curvature rounding uses 4th order Bezier curves. For complete details on how this works see [Types of Roundovers](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#section-types-of-roundovers). + +Two parameters control the roundover k and joint. The joint parameter is specified separately for the top, bottom and side edges; joint_top, joint_bot, and joint_sides. + +The k parameter ranges from 0 to 1 with a default of 0.5. Larger values give a more abrupt transition and smaller ones a more gradual transition. A k value of .93 approximates the circular roundover of other rounding methods. + + If you want a very smooth roundover, set the joint parameter as large as possible and then adjust the k value down as low as gives a sufficiently large roundover. + + +```openscad-3D +include +include +rounded_prism(rect(20), height=20, + joint_top=10, joint_bot=10, joint_sides=9.99, k = 0.5); +``` + +A large joint value and a very small k value: + +```openscad-3D +include +include +rounded_prism(rect(20), height=20, + joint_top=10, joint_bot=10, joint_sides=9.99, k = 0.01); +``` + +A k value of 0.3 + +```openscad-3D +include +include +rounded_prism(rect(20), height=20, + joint_top=10, joint_bot=10, joint_sides=9.99, k = 0.3); +``` + +A k value of 1: + +```openscad-3d +include +include +rounded_prism(rect(20), height=20, + joint_top=10, joint_bot=10, joint_sides=9.99, k = 1); +``` + +A k value of 0.93 approximates the circular roundover of other rounding methods: + +```openscad-3D +include +include +rounded_prism(rect(20), height=20, + joint_top=4, joint_bot=4, joint_sides=4, k = 0.93); +right(30) +cuboid(20, rounding = 4, $fn = 72); +``` From c35a462c22f0af9141bfb42343e6a22ef262be18 Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Sat, 27 Jan 2024 16:38:40 -0800 Subject: [PATCH 04/25] Update Rounding the Cube.md --- tutorials/Rounding the Cube.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tutorials/Rounding the Cube.md b/tutorials/Rounding the Cube.md index 35af0d7..e2b721a 100644 --- a/tutorials/Rounding the Cube.md +++ b/tutorials/Rounding the Cube.md @@ -22,7 +22,7 @@ BOSL2 provides two different methods for rounding the edges of the cube-like pri ## Cuboid Rounding -You can round the edges of a cuboid() with the `rounding=` argument by specifying the radius of curvature: +You can round the edges of a [cuboid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-cuboid) with the `rounding=` argument by specifying the radius of curvature: ```openscad-3D include @@ -76,7 +76,7 @@ include cuboid([100,80,60], rounding=-20, edges = BOTTOM); ``` -Chamfering the edges of the cuboid() can be done in a similar fashion: +Chamfering the edges of the [cuboid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-cuboid) can be done in a similar fashion: ```openscad-3D include @@ -114,7 +114,7 @@ One limitation of using rounding arguments in [cuboid()](https://github.com/Belf 2D edge masks are attached to edges using [edge_profile()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile). They have a default tag of "remove" to enable differencing them away from your cube using [diff()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-diff). -We can use a negative rounding value to fillet the bottom of a cuboid and [edge_profile()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile) to round the top. Here edge_profile() applies a 2d roundover mask to the top edges of the cuboid. +We can use a negative rounding value to fillet the bottom of a cuboid and [edge_profile()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile) to round the top. Here [edge_profile()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile) applies a 2d roundover mask to the top edges of the cuboid. ```openscad-3D include @@ -150,7 +150,7 @@ diff() ]); ``` -You can use edge-profile() to round the top or bottom of a [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid). Because the side faces of a [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) are not strictly vertical, it's is necessary to increase the length of the masks using the *excess* parameter in edge_profile(), and in mask2d\_roundover to set the mask\_angle to $edge\_angle. +You can use [edge-profile()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile) to round the top or bottom of a [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid). Because the side faces of a [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) are not strictly vertical, it is necessary to increase the length of the masks using the *excess* parameter in [edge_profile()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile), and to set the mask\_angle to $edge\_angle in [mask2d\_roundover()](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_roundover). ```openscad-3D include @@ -175,7 +175,7 @@ diff() rounding_edge_mask(r1 = 40, r2 = 0, l = 80); ``` -While you can specify the length of the mask with the l argument, [edge_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_mask) sets a special variable, `$parent_size`, to the size of the parent object. In either case the parent is not a perfect cube, you need to mask each edge individually: +While you can specify the length of the mask with the l or h argument, [edge_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_mask) sets a special variable, `$parent_size`, to the size of the parent object. In the case where the parent is not a perfect cube, you need to mask each edge individually: ```openscad-3D include @@ -226,9 +226,9 @@ diff() ``` ##Rounded Prism -You can construct cube-like objects, as well as a variety of other prisms using [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism). The unique feature of [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism) is the ability to use continuous curvature rounding. Rather than using constant radius arcs, continuous curvature rounding uses 4th order Bezier curves. For complete details on how this works see [Types of Roundovers](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#section-types-of-roundovers). +You can construct cube-like objects, as well as a variety of other prisms using [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism). The unique feature of [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism) is the ability to use continuous curvature rounding. Rather than using constant radius arcs, continuous curvature rounding uses 4th-order Bezier curves. For complete details on how this works see [Types of Roundovers](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#section-types-of-roundovers). -Two parameters control the roundover k and joint. The joint parameter is specified separately for the top, bottom and side edges; joint_top, joint_bot, and joint_sides. +Two parameters control the roundover, k and joint. The joint parameter is specified separately for the top, bottom and side edges using the arguments joint_top, joint_bot, and joint_sides. The k parameter ranges from 0 to 1 with a default of 0.5. Larger values give a more abrupt transition and smaller ones a more gradual transition. A k value of .93 approximates the circular roundover of other rounding methods. From 4338d4e2bad82f3bb14f97b6554a8304683d1f18 Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Sat, 27 Jan 2024 23:13:27 -0800 Subject: [PATCH 05/25] Cube Rounding Updates --- tutorials/Rounding the Cube.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/Rounding the Cube.md b/tutorials/Rounding the Cube.md index 35af0d7..d04663c 100644 --- a/tutorials/Rounding the Cube.md +++ b/tutorials/Rounding the Cube.md @@ -6,7 +6,7 @@ There are four different 3d shape primitives that you can use to make cube-like * [**cuboid()**](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-cuboid) - Creates a cube with chamfering and roundovers. -* [**cube()**](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-cube) - An extended version of OpenSCAD's cube() with anchors for attaching children. (See the [Attachments Tutorial](https://github.com/BelfrySCAD/BOSL2/wiki/Tutorial-Attachments)). +* [**cube()**](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-cube) - An extended version of OpenSCAD's [cube()](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids#cube) with anchors for attaching children. (See the [Attachments Tutorial](https://github.com/BelfrySCAD/BOSL2/wiki/Tutorial-Attachments)). * [**prismoid()**](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) - Creates a rectangular prismoid shape with optional roundovers and chamfering. From 2c105d76def18fed5768a28a4b6837c1267f2072 Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Sat, 27 Jan 2024 23:24:36 -0800 Subject: [PATCH 06/25] Link Updates --- tutorials/Rounding the Cube.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tutorials/Rounding the Cube.md b/tutorials/Rounding the Cube.md index d04663c..5669a35 100644 --- a/tutorials/Rounding the Cube.md +++ b/tutorials/Rounding the Cube.md @@ -15,14 +15,14 @@ There are four different 3d shape primitives that you can use to make cube-like BOSL2 provides two different methods for rounding the edges of the cube-like primitives above. -* **Built-in Rounding** - Cuboid, prismoid, and rounded_prism all have built-in arguments for rounding some or all of their edges. +* **Built-in Rounding** - [Cuboid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-cuboid), [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid), and [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism) all have built-in arguments for rounding some or all of their edges. * **Masking** - BOSL2 includes a number of options for masking the edges and corners of objects. Masking can accomplish rounding tasks that are not possible with the built-in rounding arguments. ## Cuboid Rounding -You can round the edges of a cuboid() with the `rounding=` argument by specifying the radius of curvature: +You can round the edges of a [cuboid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-cuboid) with the `rounding=` argument by specifying the radius of curvature: ```openscad-3D include @@ -136,7 +136,7 @@ diff() In addition to the simple roundover mask, there are masks for [cove](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_cove), [chamfer](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_chamfer), [rabbet](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_rabbet), [dovetail](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_dovetail), [teardrop](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_teardrop) and [ogee](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_ogee) edges. -The mask2d_ogee() only works on cube() and cuboid() shapes, or a [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) where size2 >= size1 in both the X and Y dimensions. +The mask2d_ogee() only works on [cube()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-cube) and [cuboid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-cuboid) shapes, or a [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) where size2 >= size1 in both the X and Y dimensions. ```openscad-3d include @@ -150,7 +150,7 @@ diff() ]); ``` -You can use edge-profile() to round the top or bottom of a [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid). Because the side faces of a [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) are not strictly vertical, it's is necessary to increase the length of the masks using the *excess* parameter in edge_profile(), and in mask2d\_roundover to set the mask\_angle to $edge\_angle. +You can use [edge-profile()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile) to round the top or bottom of a [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid). Because the side faces of a [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) are not strictly vertical, it's is necessary to increase the length of the masks using the *excess* parameter in [edge_profile()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile), and to set the mask\_angle to $edge\_angle in [mask2d\_roundover()](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_roundover). ```openscad-3D include From bbebaec70720a86279b1e16f17d90634bd65e6aa Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Sat, 27 Jan 2024 23:42:14 -0800 Subject: [PATCH 07/25] Update .openscad_mdimggen_rc --- .openscad_mdimggen_rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.openscad_mdimggen_rc b/.openscad_mdimggen_rc index 2bc6408..89dbdc9 100644 --- a/.openscad_mdimggen_rc +++ b/.openscad_mdimggen_rc @@ -1,4 +1,4 @@ -docs_dir: "/Users/RAM/Desktop/BOSL2.wiki" +docs_dir: "BOSL2.wiki" image_root: "images/tutorials" file_prefix: "Tutorial-" source_files: "tutorials/*.md" From e2434c841a08aad9fe6bcc102ee9407d85068d03 Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Sun, 28 Jan 2024 12:37:00 -0800 Subject: [PATCH 08/25] Delete .openscad_mdimggen_rc Dist --- .openscad_mdimggen_rc Dist | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .openscad_mdimggen_rc Dist diff --git a/.openscad_mdimggen_rc Dist b/.openscad_mdimggen_rc Dist deleted file mode 100644 index 89dbdc9..0000000 --- a/.openscad_mdimggen_rc Dist +++ /dev/null @@ -1,6 +0,0 @@ -docs_dir: "BOSL2.wiki" -image_root: "images/tutorials" -file_prefix: "Tutorial-" -source_files: "tutorials/*.md" -png_animations: true - From 77bdd4f40e53054bc7972de7ce1f5ce880504ae1 Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Sun, 28 Jan 2024 14:43:17 -0800 Subject: [PATCH 09/25] Update Rounding the Cube.md --- tutorials/Rounding the Cube.md | 62 +++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/tutorials/Rounding the Cube.md b/tutorials/Rounding the Cube.md index 5669a35..62f6f26 100644 --- a/tutorials/Rounding the Cube.md +++ b/tutorials/Rounding the Cube.md @@ -1,6 +1,6 @@ # Rounding the Cube -One of the shape primitives you'll use most often in your OpenSCAD designs is the cube. Rounding the edges of cube-like objects impacts both the visual appeal and functional aspects of the final product. The BOSL2 library provides a variety of methods for rounding edges and corners. +One of the shape primitives you'll use most often in your OpenSCAD designs is the cube. Rounding the edges of cube-like objects impacts both the visual appeal and functional aspects of the final design. The BOSL2 library provides a variety of methods for rounding edges and corners. There are four different 3d shape primitives that you can use to make cube-like objects: @@ -17,30 +17,31 @@ BOSL2 provides two different methods for rounding the edges of the cube-like pri * **Built-in Rounding** - [Cuboid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-cuboid), [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid), and [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism) all have built-in arguments for rounding some or all of their edges. -* **Masking** - BOSL2 includes a number of options for masking the edges and corners of objects. Masking can accomplish rounding tasks that are not possible with the built-in rounding arguments. +* **Masking** - BOSL2 includes a number of options for masking the edges and corners of objects. Masking can accomplish rounding tasks that are not possible with the built-in rounding arguments. For example with masking you can have a cube with a different rounding radius on the top edges than the rounding radius on the bottom edges. ## Cuboid Rounding -You can round the edges of a [cuboid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-cuboid) with the `rounding=` argument by specifying the radius of curvature: +You can round the edges of a [cuboid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-cuboid) with the `rounding` argument by specifying the radius of curvature: ```openscad-3D include cuboid(100, rounding=20); ``` -If you want to round selected edges you can specify which edges using combinations of the named directions **LEFT, RIGHT, TOP, BOT, FWD, BACK**. See [specifying edges](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#subsection-specifying-edges) for more details. -![](https://github.com/BelfrySCAD/BOSL2/wiki/images/attachments/subsection-specifying-edges_fig1.png) +Cube-like objects have six named faces. -You can round just the top edges: +![](https://github.com/BelfrySCAD/BOSL2/wiki/images/attachments/subsection-specifying-edges_fig2.png) + +You can round just the edges on one of the faces. Here we're rounding only the top edges: ```openscad-3D include cuboid([100,80,60], rounding=20, edges = TOP); ``` -...or just the bottom edges. Here we're using the *teardrop* parameter to limit the overhang angle to enable 3d printing without supports: +...or just the bottom edges. Here we're using the `teardrop` parameter to limit the overhang angle to enable 3d printing on FDM printers without requiring supports: ```openscad-3D include @@ -54,6 +55,10 @@ include cuboid([100,80,60], rounding=20, edges = "Z"); ``` +If you want to round selected edges you can specify which edges using combinations of the named directions **LEFT, RIGHT, TOP, BOT, FWD, BACK**. See [Specifying Edges](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#subsection-specifying-edges) for more details. + +![](https://github.com/BelfrySCAD/BOSL2/wiki/images/attachments/subsection-specifying-edges_fig1.png) + It is possible to round one or more of the edges while leaving others unrounded: @@ -69,21 +74,30 @@ include cuboid([100,80,60], rounding=20, except = TOP+FRONT); ``` -You can fillet edges by using negative rounding values: +You can fillet top or bottom edges by using negative rounding values. Note that you cannot use negative rounding values on Z-aligned (side) edges. ```openscad-3D include cuboid([100,80,60], rounding=-20, edges = BOTTOM); ``` -Chamfering the edges of the cuboid() can be done in a similar fashion: +If you do need to add a fillet on a Z-aligned edge, use [fillet()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-fillet): + +```openscad-3d +include +cuboid([100,80,60], rounding = -10, edges = BOT+FRONT) + position(FRONT+RIGHT) + fillet(l=60, r=10, spin=180); +``` + +Chamfering the edges of the cuboid() can be done in a manner similar to rounding: ```openscad-3D include cuboid([100,80,60], chamfer=20); ``` -You can specify edges as with rounding. +You can specify edges as with rounding: ```openscad-3D include @@ -182,11 +196,11 @@ include diff() cuboid([60,80,40]) { edge_mask(TOP+FWD) - rounding_edge_mask(r = 10, l = $parent_size.x); + rounding_edge_mask(r = 10, l = $parent_size.x + 0.1); edge_mask(TOP+RIGHT) - rounding_edge_mask(r = 10, l = $parent_size.y); + rounding_edge_mask(r = 10, l = $parent_size.y + 0.1); edge_mask(RIGHT+FWD) - rounding_edge_mask(r = 10, l = $parent_size.z); + rounding_edge_mask(r = 10, l = $parent_size.z + 0.1); } ``` @@ -197,30 +211,30 @@ include diff() cuboid([60,80,40]) { edge_mask(TOP+FWD) - rounding_edge_mask(r = 10, l = $parent_size.x); + rounding_edge_mask(r = 10, l = $parent_size.x + 0.1); edge_mask(TOP+RIGHT) - rounding_edge_mask(r = 10, l = $parent_size.y); + rounding_edge_mask(r = 10, l = $parent_size.y + 0.1); edge_mask(RIGHT+FWD) - rounding_edge_mask(r = 10, l = $parent_size.z); + rounding_edge_mask(r = 10, l = $parent_size.z + 0.1); corner_mask(TOP+RIGHT+FWD) rounding_corner_mask(r = 10); } ``` -As with the built-in rounding arguments, you can use [edge\_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_mask) and [corner\_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-corner_mask) to apply teardrop roundings using [teardrop\_edge_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-teardrop_edge_mask) and [teardrop\_corner_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-teardrop_corner_mask) to limit the overhang angle for better printing on FDM printers. +As with the built-in rounding arguments, you can use [edge\_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_mask) and [corner\_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-corner_mask) to apply teardrop roundings using [teardrop\_edge_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-teardrop_edge_mask) and [teardrop\_corner_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-teardrop_corner_mask) to limit the overhang angle for better printing on FDM printers. Note that the vertical mask on the RIGHT_FWD edge is a rounding\_edge\_mask(). ```openscad-3D include diff() cuboid([60,80,40]) { - edge_mask(TOP+FWD) - teardrop_edge_mask(r = 10, l = $parent_size.x, angle = 40); - edge_mask(TOP+RIGHT) - teardrop_edge_mask(r = 10, l = $parent_size.y, angle = 40); + edge_mask(BOT+FWD) + teardrop_edge_mask(r = 10, l = $parent_size.x + 0.1, angle = 40); + edge_mask(BOT+RIGHT) + teardrop_edge_mask(r = 10, l = $parent_size.y + 0.1, angle = 40); edge_mask(RIGHT+FWD) - teardrop_edge_mask(r = 10, l = $parent_size.z, angle = 40); - corner_mask(TOP+RIGHT+FWD) + rounding_edge_mask(r = 10, l = $parent_size.z + 0.1); + corner_mask(BOT+RIGHT+FWD) teardrop_corner_mask(r = 10, angle = 40); } @@ -228,7 +242,7 @@ diff() ##Rounded Prism You can construct cube-like objects, as well as a variety of other prisms using [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism). The unique feature of [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism) is the ability to use continuous curvature rounding. Rather than using constant radius arcs, continuous curvature rounding uses 4th order Bezier curves. For complete details on how this works see [Types of Roundovers](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#section-types-of-roundovers). -Two parameters control the roundover k and joint. The joint parameter is specified separately for the top, bottom and side edges; joint_top, joint_bot, and joint_sides. +Two parameters control the roundover k and joint. The joint parameter is specified separately for the top, bottom and side edges; joint\_top, joint\_bot, and joint_sides. The k parameter ranges from 0 to 1 with a default of 0.5. Larger values give a more abrupt transition and smaller ones a more gradual transition. A k value of .93 approximates the circular roundover of other rounding methods. From a1f80aa9290320a17f05124b29668dc7b71cb3c5 Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Sun, 28 Jan 2024 14:53:20 -0800 Subject: [PATCH 10/25] Update Rounding the Cube.md --- tutorials/Rounding the Cube.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tutorials/Rounding the Cube.md b/tutorials/Rounding the Cube.md index 02d0f55..4109421 100644 --- a/tutorials/Rounding the Cube.md +++ b/tutorials/Rounding the Cube.md @@ -222,7 +222,7 @@ diff() ``` -As with the built-in rounding arguments, you can use [edge\_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_mask) and [corner\_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-corner_mask) to apply teardrop roundings using [teardrop\_edge_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-teardrop_edge_mask) and [teardrop\_corner_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-teardrop_corner_mask) to limit the overhang angle for better printing on FDM printers. Note that the vertical mask on the RIGHT_FWD edge is a rounding\_edge\_mask(). +As with the built-in rounding arguments, you can use [edge\_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_mask) and [corner\_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-corner_mask) to apply teardrop roundings using [teardrop\_edge_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-teardrop_edge_mask) and [teardrop\_corner_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-teardrop_corner_mask) to limit the overhang angle for better printing on FDM printers. Note that the vertical mask on the RIGHT_FWD edge is a [rounding\_edge\_mask()](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-rounding_edge_mask). ```openscad-3D include @@ -293,3 +293,4 @@ rounded_prism(rect(20), height=20, right(30) cuboid(20, rounding = 4, $fn = 72); ``` +[](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-rounding_edge_mask) \ No newline at end of file From 982079ecb537184614aa2ba3fde3ca265c812677 Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Sun, 28 Jan 2024 15:02:52 -0800 Subject: [PATCH 11/25] Update Rounding the Cube.md --- tutorials/Rounding the Cube.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/Rounding the Cube.md b/tutorials/Rounding the Cube.md index 4109421..e82380b 100644 --- a/tutorials/Rounding the Cube.md +++ b/tutorials/Rounding the Cube.md @@ -13,7 +13,7 @@ There are four different 3d shape primitives that you can use to make cube-like * [**rounded_prism()**](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) - Makes a rounded 3d object by connecting two polygons with the same vertex count. Rounded_prism supports continuous curvature rounding. (See [Types of Roundovers](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#section-types-of-roundovers)). -BOSL2 provides two different methods for rounding the edges of the cube-like primitives above. +BOSL2 provides two different methods for rounding the edges of these cube-like primitives. * **Built-in Rounding** - [Cuboid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-cuboid), [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid), and [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism) all have built-in arguments for rounding some or all of their edges. From c59097898492e92dbc472df813768ca3ce9d7e98 Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Sun, 28 Jan 2024 15:35:11 -0800 Subject: [PATCH 12/25] Fix typos --- tutorials/Rounding the Cube.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tutorials/Rounding the Cube.md b/tutorials/Rounding the Cube.md index e82380b..727e45d 100644 --- a/tutorials/Rounding the Cube.md +++ b/tutorials/Rounding the Cube.md @@ -83,7 +83,7 @@ cuboid([100,80,60], rounding=-20, edges = BOTTOM); If you do need to add a fillet on a Z-aligned edge, use [fillet()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-fillet): -```openscad-3d +```openscad-3D include cuboid([100,80,60], rounding = -10, edges = BOT+FRONT) position(FRONT+RIGHT) @@ -152,7 +152,7 @@ In addition to the simple roundover mask, there are masks for [cove](https://git The mask2d_ogee() only works on [cube()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-cube) and [cuboid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-cuboid) shapes, or a [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) where size2 >= size1 in both the X and Y dimensions. -```openscad-3d +```openscad-3D include diff() prismoid(size1 = [50,50],size2 = [80,80], rounding1 = 25, height = 80) @@ -246,7 +246,7 @@ Two parameters control the roundover k and joint. The joint parameter is specif The k parameter ranges from 0 to 1 with a default of 0.5. Larger values give a more abrupt transition and smaller ones a more gradual transition. A k value of .93 approximates the circular roundover of other rounding methods. - If you want a very smooth roundover, set the joint parameter as large as possible and then adjust the k value down as low as gives a sufficiently large roundover. + If you want a very smooth roundover, set the joint parameter as large as possible and then adjust the k value down low enough to achieve a sufficiently large roundover. ```openscad-3D @@ -276,7 +276,7 @@ rounded_prism(rect(20), height=20, A k value of 1: -```openscad-3d +```openscad-3D include include rounded_prism(rect(20), height=20, From 18ac684ab1f1e8fef6569021f49bbc2658e159be Mon Sep 17 00:00:00 2001 From: RAMilewski Date: Sun, 28 Jan 2024 23:36:42 +0000 Subject: [PATCH 13/25] Version Bump --- version.scad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.scad b/version.scad index 353c735..c5540b8 100644 --- a/version.scad +++ b/version.scad @@ -9,7 +9,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,704]; +BOSL_VERSION = [2,0,705]; // Section: BOSL Library Version Functions From 8484d9f94a984ef8eb96ab8492b3dd56f7e5a509 Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Thu, 1 Feb 2024 16:06:16 -0800 Subject: [PATCH 14/25] Rounded Prism Fixes --- tutorials/Rounding the Cube.md | 143 ++++++++++++++++++++++----------- 1 file changed, 97 insertions(+), 46 deletions(-) diff --git a/tutorials/Rounding the Cube.md b/tutorials/Rounding the Cube.md index 727e45d..53052e1 100644 --- a/tutorials/Rounding the Cube.md +++ b/tutorials/Rounding the Cube.md @@ -10,7 +10,7 @@ There are four different 3d shape primitives that you can use to make cube-like * [**prismoid()**](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) - Creates a rectangular prismoid shape with optional roundovers and chamfering. -* [**rounded_prism()**](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) - Makes a rounded 3d object by connecting two polygons with the same vertex count. Rounded_prism supports continuous curvature rounding. (See [Types of Roundovers](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#section-types-of-roundovers)). +* [**rounded_prism()**](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism) - Makes a rounded 3d object by connecting two polygons with the same vertex count. Rounded_prism supports continuous curvature rounding. (See [Types of Roundovers](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#section-types-of-roundovers)). BOSL2 provides two different methods for rounding the edges of these cube-like primitives. @@ -19,6 +19,16 @@ BOSL2 provides two different methods for rounding the edges of these cube-like p * **Masking** - BOSL2 includes a number of options for masking the edges and corners of objects. Masking can accomplish rounding tasks that are not possible with the built-in rounding arguments. For example with masking you can have a cube with a different rounding radius on the top edges than the rounding radius on the bottom edges. +Cube-like objects have six named faces: **LEFT, RIGHT, TOP, BOT, FWD, BACK**. + +![](https://github.com/BelfrySCAD/BOSL2/wiki/images/attachments/subsection-specifying-edges_fig2.png) + +Each of those face names is a vector pointing to the face. e.g. UP is [0,0,1], and FWD is [0,-1,0]. By adding two of those vectors we can specify an edge. For example, TOP + RIGHT is the same as [0,0,1] + [0,1,0] = [0,1,1]. + + +![](https://github.com/BelfrySCAD/BOSL2/wiki/images/attachments/subsection-specifying-edges_fig1.png) + +See [Specifying Edges](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#subsection-specifying-edges) for more details. ## Cuboid Rounding @@ -29,12 +39,15 @@ include cuboid(100, rounding=20); ``` +We can round the edges aligned with one of the axes, X, Y, or Z: -Cube-like objects have six named faces. +```openscad-3D +include +cuboid([100,80,60], rounding=20, edges = "Z"); +``` -![](https://github.com/BelfrySCAD/BOSL2/wiki/images/attachments/subsection-specifying-edges_fig2.png) -You can round just the edges on one of the faces. Here we're rounding only the top edges: +You can round all the edges on one of the faces. Here we're rounding only the top edges: ```openscad-3D include @@ -48,17 +61,6 @@ include cuboid([100,80,60], rounding=20, teardrop = 45, edges = BOTTOM); ``` -We can round only the edges aligned with one of the axes, X, Y, or Z: - -```openscad-3D -include -cuboid([100,80,60], rounding=20, edges = "Z"); -``` - -If you want to round selected edges you can specify which edges using combinations of the named directions **LEFT, RIGHT, TOP, BOT, FWD, BACK**. See [Specifying Edges](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#subsection-specifying-edges) for more details. - -![](https://github.com/BelfrySCAD/BOSL2/wiki/images/attachments/subsection-specifying-edges_fig1.png) - It is possible to round one or more of the edges while leaving others unrounded: @@ -74,6 +76,28 @@ include cuboid([100,80,60], rounding=20, except = TOP+FRONT); ``` +You can also specify which edges to round using a 3x4 array, where each entry corresponds to one of the 12 edges and is set to 1 if that edge is included and 0 if the edge is not. The edge ordering is: + +[ + [Y-Z-, Y+Z-, Y-Z+, Y+Z+], + [X-Z-, X+Z-, X-Z+, X+Z+], + [X-Y-, X+Y-, X-Y+, X+Y+] +] + +```openscad-3D +include +cuboid([100,80,60], rounding=20, edges = [[1,0,1,0],[0,1,0,1],[1,0,0,1]]); +``` + +Similarly, you can use an array to exclude selected edges from rounding: + +```openscad-3D +include +cuboid([100,80,60], rounding=20, except = [[1,0,1,0],[0,1,0,1],[1,0,0,1]]); +``` + +###Negative Rounding + You can fillet top or bottom edges by using negative rounding values. Note that you cannot use negative rounding values on Z-aligned (side) edges. ```openscad-3D @@ -81,7 +105,7 @@ include cuboid([100,80,60], rounding=-20, edges = BOTTOM); ``` -If you do need to add a fillet on a Z-aligned edge, use [fillet()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-fillet): +If you need to add a fillet on a Z-aligned edge, use [fillet()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-fillet): ```openscad-3D include @@ -90,6 +114,8 @@ cuboid([100,80,60], rounding = -10, edges = BOT+FRONT) fillet(l=60, r=10, spin=180); ``` +###Chamfering + Chamfering the edges of the cuboid() can be done in a manner similar to rounding: ```openscad-3D @@ -106,7 +132,7 @@ cuboid([100,80,60], chamfer=20, edges = "Z", except = FWD+RIGHT); ##Prismoid Rounding -The [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) differs from the cuboid and cube in that you can only round or chamfer the vertical(ish) edges using the built-in parameters. For those edges, you can specify rounding and/or chamferring for top and bottom separately: +The [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) differs from the cuboid and cube in that you can only round or chamfer the vertical(ish) edges using the built-in parameters. For those edges, you can specify rounding and/or chamfering for top and bottom separately: ```openscad-3D include @@ -240,11 +266,23 @@ diff() ``` ##Rounded Prism -You can construct cube-like objects, as well as a variety of other prisms using [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism). The unique feature of [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism) is the ability to use continuous curvature rounding. Rather than using constant radius arcs, continuous curvature rounding uses 4th-order Bezier curves. For complete details on how this works see [Types of Roundovers](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#section-types-of-roundovers). +You can construct cube-like objects, as well as a variety of other prisms using [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism). In this tutorial we're concentrating on rounding cubes, but [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism) has capabilities that extend well beyond cube-like objects. See the rounded_prism() examples to learn more. -Two parameters control the roundover k and joint. The joint parameter is specified separately for the top, bottom and side edges; joint\_top, joint\_bot, and joint_sides. +A feature unique to [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism) is that it uses continuous curvature rounding. Rather than using constant radius arcs, continuous curvature rounding uses 4th-order Bezier curves. For complete details on how this works see [Types of Roundovers](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#section-types-of-roundovers). + + +Two parameters control the roundover k and joint. The joint parameter is the distance from where the rounding starts to the unrounded edge. The k parameter ranges from 0 to 1 with a default of 0.5. Larger values give a more abrupt transition and smaller ones a more gradual transition. + +Parameters of a "smooth" roundover, with k=0.75. + +![](https://github.com/BelfrySCAD/BOSL2/wiki/images/rounding/section-types-of-roundovers_fig3.png) + +Parameters of a "smooth" roundover, with k=0.15. The transition is so gradual that it appears that the roundover is much smaller than specified. The cut length is much smaller for the same joint length. + +![](https://github.com/BelfrySCAD/BOSL2/wiki/images/rounding/section-types-of-roundovers_fig4.png) + +The joint parameter is specified separately for the top, bottom and side edges; joint\_top, joint\_bot, and joint_sides. -The k parameter ranges from 0 to 1 with a default of 0.5. Larger values give a more abrupt transition and smaller ones a more gradual transition. A k value of .93 approximates the circular roundover of other rounding methods. If you want a very smooth roundover, set the joint parameter as large as possible and then adjust the k value down low enough to achieve a sufficiently large roundover. @@ -256,41 +294,54 @@ rounded_prism(rect(20), height=20, joint_top=10, joint_bot=10, joint_sides=9.99, k = 0.5); ``` -A large joint value and a very small k value: +Here we're using the same cube size of 20, setting the joint paramater to 10 and varying the k parameter. -```openscad-3D +```openscad-3D;ImgOnly NoScales Med VPD=170 VPR=[75,0,25] include include -rounded_prism(rect(20), height=20, - joint_top=10, joint_bot=10, joint_sides=9.99, k = 0.01); + left(30) { + rounded_prism(rect(20), height=20, joint_top=10, joint_bot=10, joint_sides=9.99, k = 0.15); + move([0,-12,-12]) xrot(90) color("black") text3d("k=0.15", size=3, h = 0.01, anchor= CENTER); +} + +right(0){ + rounded_prism(rect(20), height=20, joint_top=10, joint_bot=10, joint_sides=9.99, k = 0.5); + move([0,-12,-12]) xrot(90) color("black") text3d("k=0.5", size=3, h = 0.01, anchor= CENTER); +} + +right(30){ + rounded_prism(rect(20), height=20, joint_top=10, joint_bot=10, joint_sides=9.99, k = 0.75); + move([0,-12,-12]) xrot(90) color("black") text3d("k=0.75", size=3, h = 0.01, anchor= CENTER); +} ``` -A k value of 0.3 +You can match the cicrular roundover of cuboid() by setting the joint values to the rounding used in cuboid() and setting the k value to 0.93: -```openscad-3D -include -include -rounded_prism(rect(20), height=20, - joint_top=10, joint_bot=10, joint_sides=9.99, k = 0.3); -``` - -A k value of 1: - -```openscad-3D -include -include -rounded_prism(rect(20), height=20, - joint_top=10, joint_bot=10, joint_sides=9.99, k = 1); -``` - -A k value of 0.93 approximates the circular roundover of other rounding methods: - -```openscad-3D +```openscad-3D: Med include include rounded_prism(rect(20), height=20, joint_top=4, joint_bot=4, joint_sides=4, k = 0.93); right(30) -cuboid(20, rounding = 4, $fn = 72); + cuboid(20, rounding = 4, $fn = 72); ``` -[](https://github.com/BelfrySCAD/BOSL2/wiki/masks3d.scad#module-rounding_edge_mask) \ No newline at end of file + +The joint size can be set to different values for each side of the prism: + +```openscad-3D +include +include +rounded_prism(rect(20), height=20, + joint_top=4, joint_bot=3, joint_sides=[2, 10, 5, 10], k = 0.5); +``` + +Likewise, k can be set to different values for each side of the prism: + +```openscad-3D +include +include +rounded_prism(rect(20), height=20, + joint_top=3, joint_bot=3, joint_sides=8, + k_top=0.5, k_bot=0.1, k_sides=[0,0.7,0.3,0.7]); +``` + From 5e81de764bbcbcd6d63464299f2c59fc79708405 Mon Sep 17 00:00:00 2001 From: RAMilewski Date: Fri, 2 Feb 2024 00:10:21 +0000 Subject: [PATCH 15/25] Version Bump --- version.scad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.scad b/version.scad index c3eba25..18225cb 100644 --- a/version.scad +++ b/version.scad @@ -10,7 +10,7 @@ -BOSL_VERSION = [2,0,710]; +BOSL_VERSION = [2,0,711]; // Section: BOSL Library Version Functions From 583013be26629849564c104b1bbafff2f8ca3028 Mon Sep 17 00:00:00 2001 From: RAMilewski Date: Sat, 3 Feb 2024 07:48:39 +0000 Subject: [PATCH 16/25] Version Bump --- version.scad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.scad b/version.scad index 18225cb..d01bee7 100644 --- a/version.scad +++ b/version.scad @@ -10,7 +10,7 @@ -BOSL_VERSION = [2,0,711]; +BOSL_VERSION = [2,0,712]; // Section: BOSL Library Version Functions From 476eb42ec7bafe565c263129c98cbe6b2d524270 Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Sat, 3 Feb 2024 00:36:12 -0800 Subject: [PATCH 17/25] Update Rounding the Cube.md --- tutorials/Rounding the Cube.md | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/tutorials/Rounding the Cube.md b/tutorials/Rounding the Cube.md index 53052e1..503f682 100644 --- a/tutorials/Rounding the Cube.md +++ b/tutorials/Rounding the Cube.md @@ -98,21 +98,13 @@ cuboid([100,80,60], rounding=20, except = [[1,0,1,0],[0,1,0,1],[1,0,0,1]]); ###Negative Rounding -You can fillet top or bottom edges by using negative rounding values. Note that you cannot use negative rounding values on Z-aligned (side) edges. +You can fillet top or bottom edges by using negative rounding values. Note that you cannot use negative rounding values on Z-aligned (side) edges. If you need to add a fillet on a Z-aligned edge, use [fillet()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-fillet): ```openscad-3D include cuboid([100,80,60], rounding=-20, edges = BOTTOM); ``` -If you need to add a fillet on a Z-aligned edge, use [fillet()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-fillet): - -```openscad-3D -include -cuboid([100,80,60], rounding = -10, edges = BOT+FRONT) - position(FRONT+RIGHT) - fillet(l=60, r=10, spin=180); -``` ###Chamfering @@ -315,6 +307,27 @@ right(30){ } ``` +Alternatively, we can keep k constant at k=0.5 and vary the joint length: + +```openscad-3D;ImgOnly NoScales Med VPD=170 VPR=[75,0,25] +include +include + left(30) { + rounded_prism(rect(20), height=20, joint_top=1, joint_bot=1, joint_sides=1, k = 0.5); + move([0,-13,-13]) xrot(90) color("black") text3d("joint=1", size=3, h = 0.01, anchor= CENTER); +} + +right(0){ + rounded_prism(rect(20), height=20, joint_top=5, joint_bot=5, joint_sides=5, k = 0.5); + move([0,-13,-13]) xrot(90) color("black") text3d("joint=5", size=3, h = 0.01, anchor= CENTER); +} + +right(30){ + rounded_prism(rect(20), height=20, joint_top=9, joint_bot=9, joint_sides=9, k = 0.5); + move([0,-13,-13]) xrot(90) color("black") text3d("joint=9", size=3, h = 0.01, anchor= CENTER); +} +``` + You can match the cicrular roundover of cuboid() by setting the joint values to the rounding used in cuboid() and setting the k value to 0.93: ```openscad-3D: Med From db084c19efddb40a5dddfd954dec4661200ebca1 Mon Sep 17 00:00:00 2001 From: RAMilewski Date: Sat, 3 Feb 2024 08:36:41 +0000 Subject: [PATCH 18/25] Version Bump --- version.scad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.scad b/version.scad index d01bee7..4114b19 100644 --- a/version.scad +++ b/version.scad @@ -10,7 +10,7 @@ -BOSL_VERSION = [2,0,712]; +BOSL_VERSION = [2,0,713]; // Section: BOSL Library Version Functions From a46dac68907acf4d15623c404ae703966b2b6c8e Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Sat, 3 Feb 2024 17:03:12 -0800 Subject: [PATCH 19/25] 2-vector rounded_prism examples --- tutorials/Rounding the Cube.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tutorials/Rounding the Cube.md b/tutorials/Rounding the Cube.md index 503f682..d2e3ca7 100644 --- a/tutorials/Rounding the Cube.md +++ b/tutorials/Rounding the Cube.md @@ -358,3 +358,33 @@ rounded_prism(rect(20), height=20, k_top=0.5, k_bot=0.1, k_sides=[0,0.7,0.3,0.7]); ``` +You can specify a 2-vector for the joint distance to produce asymmetric rounding which is different on the two sides of the edge. This may be useful when one one edge in your polygon is much larger than another. + +```openscad-3D +include +include +rounded_prism(rect([50.1,20.1]), height=6.1, + joint_top=[15,3], joint_bot=[15,3], + joint_sides=[[10,25],[25,10],[10,25],[25,10]], + k_sides=0.3); +``` + +For the top and bottom you can specify negative joint distances. If you give a scalar negative value then the roundover will flare outward. + +```openscad-3D +include +include +rounded_prism(rect(20), height=20, + joint_top=5, joint_bot=-5, joint_sides=8, k=0.5); +``` + +If you give a 2-vector then if joint\_top[0] is negative the shape will flare outward, but if joint\_top[1] is negative the shape will flare upward. At least one value must be non-negative. The same rules apply for joint\_bot. The joint\_sides parameter must be entirely nonnegative. + +Flaring the top upward. The bottom has an asymmetric rounding with a small flare but a large rounding up the side. + +```openscad-3D +include +include +rounded_prism(rect(20), height=20, +joint_top=[3,-3], joint_bot=[-3,10], joint_sides=8, k=0.5); +``` \ No newline at end of file From 9baa8171be5c8c3b407e58c84ee45c71bd21906a Mon Sep 17 00:00:00 2001 From: RAMilewski Date: Sun, 4 Feb 2024 01:03:29 +0000 Subject: [PATCH 20/25] Version Bump --- version.scad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.scad b/version.scad index 4114b19..72214bc 100644 --- a/version.scad +++ b/version.scad @@ -10,7 +10,7 @@ -BOSL_VERSION = [2,0,713]; +BOSL_VERSION = [2,0,714]; // Section: BOSL Library Version Functions From 8578478552b6da7010c85e6c804914734415c2fc Mon Sep 17 00:00:00 2001 From: revarbat Date: Tue, 6 Feb 2024 18:11:55 +0000 Subject: [PATCH 21/25] Version Bump --- version.scad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.scad b/version.scad index fb8477d..a5aeca2 100644 --- a/version.scad +++ b/version.scad @@ -10,7 +10,7 @@ -BOSL_VERSION = [2,0,714]; +BOSL_VERSION = [2,0,715]; From e58cfa0ba139172b62d1eb39d606d5c1a7ba2bdb Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Tue, 6 Feb 2024 10:26:34 -0800 Subject: [PATCH 22/25] Minor docs fixes. Removed VersionBump workflow. --- .github/workflows/pr_merge.yml | 28 ---------------------------- rounding.scad | 6 +++--- 2 files changed, 3 insertions(+), 31 deletions(-) delete mode 100644 .github/workflows/pr_merge.yml diff --git a/.github/workflows/pr_merge.yml b/.github/workflows/pr_merge.yml deleted file mode 100644 index fc8b618..0000000 --- a/.github/workflows/pr_merge.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: VersionBump -on: - push: - branches: - - master - -jobs: - VersionBumpJob: - runs-on: ubuntu-latest - - permissions: - contents: write - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - - name: Bump Version - run: ./scripts/increment_version.sh - - - name: Checkin - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: Version Bump - file_pattern: version.scad - diff --git a/rounding.scad b/rounding.scad index bb88dc1..b2d973a 100644 --- a/rounding.scad +++ b/rounding.scad @@ -1383,15 +1383,15 @@ module offset_stroke(path, width=1, rounded=true, start, end, check_valid=true, // Example: If the shape has sharp corners, make sure to set `$fn/$fs/$fa`. The corners of this triangle are not round, even though `offset="round"` (the default) because the number of segments is small. // triangle = [[0,0],[10,0],[5,10]]; // offset_sweep(triangle, height=6, bottom = os_circle(r=-2),steps=4); -// Example: Can improve the result by increasing $fn +// Example: Can improve the result by increasing `$fn` // $fn=12; // triangle = [[0,0],[10,0],[5,10]]; // offset_sweep(triangle, height=6, bottom = os_circle(r=-2),steps=4); -// Example: Using $fa and $fs works too; it produces a different looking triangulation of the rounded corner +// Example: Using `$fa` and `$fs` works too; it produces a different looking triangulation of the rounded corner // $fa=1;$fs=0.3; // triangle = [[0,0],[10,0],[5,10]]; // offset_sweep(triangle, height=6, bottom = os_circle(r=-2),steps=4); -// Example: Here is the star chamfered at the top with a teardrop rounding at the bottom. Check out the rounded corners on the chamfer. The large $fn value ensures a smooth curve on the concave corners of the chamfer. It has no effect anywhere else on the model. Observe how the rounded star points vanish at the bottom in the teardrop: the number of vertices does not remain constant from layer to layer. +// Example: Here is the star chamfered at the top with a teardrop rounding at the bottom. Check out the rounded corners on the chamfer. The large `$fn` value ensures a smooth curve on the concave corners of the chamfer. It has no effect anywhere else on the model. Observe how the rounded star points vanish at the bottom in the teardrop: the number of vertices does not remain constant from layer to layer. // star = star(5, r=22, ir=13); // rounded_star = round_corners(star, cut=flatten(repeat([.5,0],5)), $fn=24); // offset_sweep(rounded_star, height=20, bottom=os_teardrop(r=4), top=os_chamfer(width=4),$fn=64); From 87beac3f3d87105be670cad319d5cb09f60e9461 Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Wed, 7 Feb 2024 17:57:58 -0800 Subject: [PATCH 23/25] Tutorial tweaks Fixes to rounded_prism() joint examples --- tutorials/Rounding the Cube.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tutorials/Rounding the Cube.md b/tutorials/Rounding the Cube.md index d2e3ca7..ce7ace3 100644 --- a/tutorials/Rounding the Cube.md +++ b/tutorials/Rounding the Cube.md @@ -283,7 +283,7 @@ The joint parameter is specified separately for the top, bottom and side edges; include include rounded_prism(rect(20), height=20, - joint_top=10, joint_bot=10, joint_sides=9.99, k = 0.5); + joint_top=10, joint_bot=10, joint_sides=10, k = 0.5); ``` Here we're using the same cube size of 20, setting the joint paramater to 10 and varying the k parameter. @@ -292,17 +292,17 @@ Here we're using the same cube size of 20, setting the joint paramater to 10 and include include left(30) { - rounded_prism(rect(20), height=20, joint_top=10, joint_bot=10, joint_sides=9.99, k = 0.15); + rounded_prism(rect(20), height=20, joint_top=10, joint_bot=10, joint_sides=10, k = 0.15); move([0,-12,-12]) xrot(90) color("black") text3d("k=0.15", size=3, h = 0.01, anchor= CENTER); } right(0){ - rounded_prism(rect(20), height=20, joint_top=10, joint_bot=10, joint_sides=9.99, k = 0.5); + rounded_prism(rect(20), height=20, joint_top=10, joint_bot=10, joint_sides=10, k = 0.5); move([0,-12,-12]) xrot(90) color("black") text3d("k=0.5", size=3, h = 0.01, anchor= CENTER); } right(30){ - rounded_prism(rect(20), height=20, joint_top=10, joint_bot=10, joint_sides=9.99, k = 0.75); + rounded_prism(rect(20), height=20, joint_top=10, joint_bot=10, joint_sides=10, k = 0.75); move([0,-12,-12]) xrot(90) color("black") text3d("k=0.75", size=3, h = 0.01, anchor= CENTER); } ``` From bf6d366d872254094aa4cf59ef6ea592d9a879fa Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Fri, 9 Feb 2024 17:32:12 -0800 Subject: [PATCH 24/25] Rounded Prism Fixes --- tutorials/Rounding the Cube.md | 43 +++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/tutorials/Rounding the Cube.md b/tutorials/Rounding the Cube.md index ce7ace3..666998e 100644 --- a/tutorials/Rounding the Cube.md +++ b/tutorials/Rounding the Cube.md @@ -263,7 +263,7 @@ You can construct cube-like objects, as well as a variety of other prisms using A feature unique to [rounded_prism()](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#functionmodule-rounded_prism) is that it uses continuous curvature rounding. Rather than using constant radius arcs, continuous curvature rounding uses 4th-order Bezier curves. For complete details on how this works see [Types of Roundovers](https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad#section-types-of-roundovers). -Two parameters control the roundover k and joint. The joint parameter is the distance from where the rounding starts to the unrounded edge. The k parameter ranges from 0 to 1 with a default of 0.5. Larger values give a more abrupt transition and smaller ones a more gradual transition. +Two parameters control the roundover, k and joint. The joint parameter is the distance from where the rounding starts to the unrounded edge. The k parameter ranges from 0 to 1 with a default of 0.5. Larger values give a more abrupt transition and smaller ones a more gradual transition. Parameters of a "smooth" roundover, with k=0.75. @@ -276,33 +276,33 @@ Parameters of a "smooth" roundover, with k=0.15. The transition is so gradual th The joint parameter is specified separately for the top, bottom and side edges; joint\_top, joint\_bot, and joint_sides. - If you want a very smooth roundover, set the joint parameter as large as possible and then adjust the k value down low enough to achieve a sufficiently large roundover. + If you want a very smooth roundover, set the joint parameter as large as possible and then adjust the k value down low enough to achieve a sufficiently large roundover. Joint parameters usually need to be < side/2. ```openscad-3D include include rounded_prism(rect(20), height=20, - joint_top=10, joint_bot=10, joint_sides=10, k = 0.5); + joint_top=9.99, joint_bot=9.99, joint_sides=9.99, k = 0.5); ``` -Here we're using the same cube size of 20, setting the joint paramater to 10 and varying the k parameter. +Here we're using the same cube size and joint sizes, but varying the k parameter. ```openscad-3D;ImgOnly NoScales Med VPD=170 VPR=[75,0,25] include include left(30) { - rounded_prism(rect(20), height=20, joint_top=10, joint_bot=10, joint_sides=10, k = 0.15); + rounded_prism(rect(20), height=20, joint_top=9.99, joint_bot=9.99, joint_sides=9.99, k = 0.15); move([0,-12,-12]) xrot(90) color("black") text3d("k=0.15", size=3, h = 0.01, anchor= CENTER); } right(0){ - rounded_prism(rect(20), height=20, joint_top=10, joint_bot=10, joint_sides=10, k = 0.5); + rounded_prism(rect(20), height=20, joint_top=9.99, joint_bot=9.99, joint_sides=9.99, k = 0.5); move([0,-12,-12]) xrot(90) color("black") text3d("k=0.5", size=3, h = 0.01, anchor= CENTER); } right(30){ - rounded_prism(rect(20), height=20, joint_top=10, joint_bot=10, joint_sides=10, k = 0.75); + rounded_prism(rect(20), height=20, joint_top=9.99, joint_bot=9.99, joint_sides=9.99, k = 0.75); move([0,-12,-12]) xrot(90) color("black") text3d("k=0.75", size=3, h = 0.01, anchor= CENTER); } ``` @@ -330,15 +330,36 @@ right(30){ You can match the cicrular roundover of cuboid() by setting the joint values to the rounding used in cuboid() and setting the k value to 0.93: -```openscad-3D: Med +```openscad-3D: Med, VPR=[75,0,25], VPD=180 include include -rounded_prism(rect(20), height=20, - joint_top=4, joint_bot=4, joint_sides=4, k = 0.93); -right(30) +left(15) + rounded_prism(rect(20), height=20, joint_top=4, joint_bot=4, joint_sides=4, k = 0.93); +right(15) cuboid(20, rounding = 4, $fn = 72); ``` +Unlike other cube-like objects, the rounded prism smoothness is not affected by the special variable $fn, but by the splinesteps argument. Splinesteps defaults to 16. + +```openscad-3D;ImgOnly NoScales, Med, VPD=170, VPR=[75,0,45] +include +include + left(35) { + rounded_prism(rect(20), height=20, joint_top=9.99, joint_bot=9.99, joint_sides=9.99, k = 0.5, splinesteps = 4 ) + move([0,-12,-12]) xrot(90) color("black") text3d("splinesteps=4", size=3, h = 0.01, anchor= CENTER); +} + +right(0){ + rounded_prism(rect(20), height=20, joint_top=9.99, joint_bot=9.99, joint_sides=9.99, k = 0.5, splinesteps = 16) + move([0,-12,-12]) xrot(90) color("black") text3d("splinesteps=16", size=3, h = 0.01, anchor= CENTER); +} + +right(35){ + rounded_prism(rect(20), height=20, joint_top=9.99, joint_bot=9.99, joint_sides=9.99, k = 0.5, splinesteps = 64) + move([0,-12,-12]) xrot(90) color("black") text3d("splinesteps=64", size=3, h = 0.01, anchor= CENTER); +} +``` + The joint size can be set to different values for each side of the prism: ```openscad-3D From e19744da7033c59227b49b81ed6aec710d8dc808 Mon Sep 17 00:00:00 2001 From: Richard Milewski Date: Sat, 10 Feb 2024 17:10:23 -0800 Subject: [PATCH 25/25] Update Rounding the Cube.md --- tutorials/Rounding the Cube.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tutorials/Rounding the Cube.md b/tutorials/Rounding the Cube.md index 666998e..3230623 100644 --- a/tutorials/Rounding the Cube.md +++ b/tutorials/Rounding the Cube.md @@ -140,7 +140,7 @@ prismoid(100, 80, rounding1=[0,50,0,50], rounding2=[40,0,40,0], h=50); ##Masking Edges of the Cuboid, Cube and Prismoid -###2D Edge Masking with [edge_profile()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile) +###2D Edge Masking with [edge_profile()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile) and [edge_profile_asym()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile_asym) One limitation of using rounding arguments in [cuboid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#module-cuboid) is that all the rounded edges must have the same rounding radius. Using masking we have the flexibility to apply different edge treatments to the same cube. Masking can also be used on the [cube()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-cube) and [prismoid()](https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-prismoid) shapes. @@ -156,6 +156,27 @@ diff() mask2d_roundover(r=10); ``` +We could also fillet the bottom of the cube using [edge_profile_asym()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile_asym) and [xflip()](https://github.com/BelfrySCAD/BOSL2/wiki/transforms.scad#functionmodule-xflip) + +```openscad-3D +include +cuboid(50) + edge_profile_asym(BOT, corner_type="round") + xflip() mask2d_roundover(10); +``` + +The flip argumet in [edge_profile_asym()](https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad#module-edge_profile_asym) determines whether the fillet flares out or up. The corner_type argument is used to shape the corners of external fillets. + +```openscad-3D +include +cuboid(50){ + edge_profile_asym(TOP, flip = true) + xflip() mask2d_roundover(10); + edge_profile_asym(BOT, corner_type="round") + xflip() mask2d_roundover(10); + } +``` + See [mask2d_roundover()](https://github.com/BelfrySCAD/BOSL2/wiki/masks2d.scad#functionmodule-mask2d_roundover) for additional mask parameters. Here we use the *inset* parameter in mask2d_roundover: ```openscad-3D