mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-17 18:09:40 +00:00
Merge pull request #755 from revarbat/revarbat_dev
Quantize up to a multiple of 4 for rounded edges.
This commit is contained in:
commit
27a8d90f01
1 changed files with 8 additions and 8 deletions
|
@ -102,9 +102,9 @@ function cube(size=1, center, anchor, spin=0, orient=UP) =
|
||||||
// Creates a cube or cuboid object, with optional chamfering or rounding of edges and corners.
|
// Creates a cube or cuboid object, with optional chamfering or rounding of edges and corners.
|
||||||
// You cannot mix chamfering and rounding: just one edge treatment with the same size applies to all selected edges.
|
// You cannot mix chamfering and rounding: just one edge treatment with the same size applies to all selected edges.
|
||||||
// Negative chamfers and roundings can be applied to create external fillets, but they
|
// Negative chamfers and roundings can be applied to create external fillets, but they
|
||||||
// but only apply to edges around the top or bottom faces. If you specify an edge set other than "ALL"
|
// only apply to edges around the top or bottom faces. If you specify an edge set other than "ALL"
|
||||||
// with such roundings or chamfers then you will get an error. See
|
// with negative roundings or chamfers then you will get an error. See [Specifying Edges](attachments.scad#section-specifying-edges)
|
||||||
// [Specifying Edges](attachments.scad#section-specifying-edges) for information on how to specify edge sets.
|
// for information on how to specify edge sets.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// size = The size of the cube, a number or length 3 vector.
|
// size = The size of the cube, a number or length 3 vector.
|
||||||
// ---
|
// ---
|
||||||
|
@ -192,7 +192,7 @@ module cuboid(
|
||||||
dummy=assert(is_finite(r) && !approx(r,0));
|
dummy=assert(is_finite(r) && !approx(r,0));
|
||||||
c = [min(r,size.x/2), min(r,size.y/2), min(r,size.z/2)];
|
c = [min(r,size.x/2), min(r,size.y/2), min(r,size.z/2)];
|
||||||
c2 = v_mul(corner,c/2);
|
c2 = v_mul(corner,c/2);
|
||||||
$fn = is_finite(chamfer)? 4 : segs(r);
|
$fn = is_finite(chamfer)? 4 : quantup(segs(r),4);
|
||||||
translate(v_mul(corner, size/2-c)) {
|
translate(v_mul(corner, size/2-c)) {
|
||||||
if (cnt == 0 || approx(r,0)) {
|
if (cnt == 0 || approx(r,0)) {
|
||||||
translate(c2) cube(c, center=true);
|
translate(c2) cube(c, center=true);
|
||||||
|
|
Loading…
Reference in a new issue