1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-16 13:50:05 +01:00

use sf_cylinder if angle is 360

This commit is contained in:
Justin Lin 2022-08-27 15:26:59 +08:00
parent d0ea27a76c
commit 29594b8688

View File

@ -9,31 +9,37 @@
**/
use <_impl/_sf_square_surfaces.scad>
use <sf_cylinder.scad>;
use <sf_solidify.scad>
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
);
}
}