From 29594b8688867650c32ffb70cf0e03089e79631c Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sat, 27 Aug 2022 15:26:59 +0800 Subject: [PATCH] use sf_cylinder if angle is 360 --- src/surface/sf_bend.scad | 46 +++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/src/surface/sf_bend.scad b/src/surface/sf_bend.scad index d696e515..010bf24a 100644 --- a/src/surface/sf_bend.scad +++ b/src/surface/sf_bend.scad @@ -9,31 +9,37 @@ **/ use <_impl/_sf_square_surfaces.scad> +use ; use use <../ptf/ptf_bend.scad> module sf_bend(levels, radius, thickness, depth, angle = 180, invert = false, convexity = 1) { - dp = is_undef(depth) ? thickness / 2 : depth; - surface = _sf_square_surfaces(levels, thickness, dp, invert); - rows = len(levels); - columns = len(levels[0]); - size = [columns - 1, rows - 1]; + if(angle == 360) { + sf_cylinder(levels, radius, thickness, depth, invert, convexity); + } + else { + dp = is_undef(depth) ? thickness / 2 : depth; + surface = _sf_square_surfaces(levels, thickness, dp, invert); + rows = len(levels); + columns = len(levels[0]); + size = [columns - 1, rows - 1]; - offset_z = invert ? thickness : 0; - r = radius + offset_z; - sf_solidify( - [ - for(row = surface[0]) + offset_z = invert ? thickness : 0; + r = radius + offset_z; + sf_solidify( [ - for(p = row) ptf_bend(size, p, r, angle) - ] - ], - [ - for(row = surface[1]) + for(row = surface[0]) + [ + for(p = row) ptf_bend(size, p, r, angle) + ] + ], [ - for(p = row) ptf_bend(size, p, radius, angle) - ] - ], - convexity = convexity - ); + for(row = surface[1]) + [ + for(p = row) ptf_bend(size, p, radius, angle) + ] + ], + convexity = convexity + ); + } } \ No newline at end of file