From 356966b8f6fd40f2054729f5244a0fb07efed237 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Fri, 1 Apr 2022 13:58:01 +0800 Subject: [PATCH] format --- examples/trefoil_klein_bottle.scad | 52 ++++++++++++------------- examples/twisted_ring.scad | 20 +++++----- examples/walk_torus83_fort.scad | 62 +++++++++++++++--------------- examples/wormhole.scad | 8 ++-- 4 files changed, 71 insertions(+), 71 deletions(-) diff --git a/examples/trefoil_klein_bottle.scad b/examples/trefoil_klein_bottle.scad index 9bb2b0ea..eadd1ef1 100644 --- a/examples/trefoil_klein_bottle.scad +++ b/examples/trefoil_klein_bottle.scad @@ -16,21 +16,21 @@ module dis_connected_klein_bottle(radius1, radius2, bottom_height, thickness, t_ module bottom() { rotate(180) - rotate_extrude() { - ph1 = arc_path(radius = radius2, angle = [180, 360]); - ph2 = bezier_curve(t_step, [ - [radius1 + radius2 * 2, 0, 0], - [radius1 + radius2 * 2, bottom_height * 0.25, 0], - [radius1 + radius2 * 0.5, bottom_height * 0.5, 0], - [radius1, bottom_height * 0.75, 0], - [radius1, bottom_height * 1.015, 0] - ]); - - path = concat([for(p = ph1) p + [radius1 + radius2, 0, 0]], ph2); - - polyline_join(path) - circle(half_thickness); - } + rotate_extrude() { + ph1 = arc_path(radius = radius2, angle = [180, 360]); + ph2 = bezier_curve(t_step, [ + [radius1 + radius2 * 2, 0, 0], + [radius1 + radius2 * 2, bottom_height * 0.25, 0], + [radius1 + radius2 * 0.5, bottom_height * 0.5, 0], + [radius1, bottom_height * 0.75, 0], + [radius1, bottom_height * 1.015, 0] + ]); + + path = concat([for(p = ph1) p + [radius1 + radius2, 0, 0]], ph2); + + polyline_join(path) + circle(half_thickness); + } } module tube() { @@ -75,17 +75,17 @@ module dis_connected_klein_bottle(radius1, radius2, bottom_height, thickness, t_ bottom(); rotate(-90) - path_extrude( - shape_circle(radius1 + half_thickness), - tube_path - ); + path_extrude( + shape_circle(radius1 + half_thickness), + tube_path + ); } rotate(-90) - path_extrude( - shape_circle(radius1 - half_thickness), - tube_path2 - ); + path_extrude( + shape_circle(radius1 - half_thickness), + tube_path2 + ); } } @@ -94,17 +94,17 @@ module dis_connected_klein_bottle(radius1, radius2, bottom_height, thickness, t_ module trefoil_klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn) { rotate(90) - dis_connected_klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn); + dis_connected_klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn); translate([0, -26.9, 151.35]) // try-and-error rotate([-120, 0, 0]) rotate(90) - dis_connected_klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn); + dis_connected_klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn); translate([0, 117.59, 98.975]) // try-and-error rotate([120, 0, 0]) rotate(90) - dis_connected_klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn); + dis_connected_klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn); } module trefoil_cutted_klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn) { diff --git a/examples/twisted_ring.scad b/examples/twisted_ring.scad index bc23ea88..93ec9759 100644 --- a/examples/twisted_ring.scad +++ b/examples/twisted_ring.scad @@ -11,18 +11,18 @@ twisted_ring( ); translate([95, 0]) -twisted_ring( - [for(p = shape_liquid_splitting(radius = 5, centre_dist = 25)) [p[0], p[1] + 10]], - r = 25, - shape_turns = 3 -); + twisted_ring( + [for(p = shape_liquid_splitting(radius = 5, centre_dist = 25)) [p[0], p[1] + 10]], + r = 25, + shape_turns = 3 + ); translate([-110, 0]) -twisted_ring( - [[17.5, 10], [17.5, 20], [12.5, 20], [12.5, 15], [7.5, 15], [7.5, 20], [2.5, 20], [2.5, 15], [-2.5, 15], [-2.5, 20], [-7.5, 20], [-7.5, 15], [-12.5, 15], [-12.5, 20], [-17.5, 20], [-17.5, 10]], - r = 30, - shape_turns = 3 -); + twisted_ring( + [[17.5, 10], [17.5, 20], [12.5, 20], [12.5, 15], [7.5, 15], [7.5, 20], [2.5, 20], [2.5, 15], [-2.5, 15], [-2.5, 20], [-7.5, 20], [-7.5, 15], [-12.5, 15], [-12.5, 20], [-17.5, 20], [-17.5, 10]], + r = 30, + shape_turns = 3 + ); module twisted_ring(shape, r, shape_turns) { t = 360 * shape_turns; diff --git a/examples/walk_torus83_fort.scad b/examples/walk_torus83_fort.scad index aff1cc76..6e7eb3b1 100644 --- a/examples/walk_torus83_fort.scad +++ b/examples/walk_torus83_fort.scad @@ -106,39 +106,39 @@ module walk_torus83_fort(radius, thickness, height) { half_leng2 = leng2 / 2; rotate([90, 0, 0]) - linear_extrude(thickness, center = true) { - // walkway with doors - difference() { - hull() { - translate([half_leng, 0, 0]) - square([leng, height], center = true); - translate([-half_leng, -half_h]) - polygon(tri_points); - } - - translate([-leng / 2.125, 0]) - door_df(); - - half_door_df(); - } - translate([-half_leng - height, -half_h]) - stairs(height, stair_number); - - // walkway without doors - translate([-leng * 2, 0]) - rotate([180, 0, 180]) { - translate([half_leng2, 0]) - square([leng2, height], center = true); - translate([0, -half_h]) + linear_extrude(thickness, center = true) { + // walkway with doors + difference() { + hull() { + translate([half_leng, 0, 0]) + square([leng, height], center = true); + translate([-half_leng, -half_h]) polygon(tri_points); - translate([-height, -half_h]) - stairs(height, stair_number); - - walk_bottom_leng = 2 * leng - height * 2 - half_leng; - translate([-walk_bottom_leng - height, -half_h]) - square([walk_bottom_leng, height / stair_number]); - } + } + + translate([-leng / 2.125, 0]) + door_df(); + + half_door_df(); } + translate([-half_leng - height, -half_h]) + stairs(height, stair_number); + + // walkway without doors + translate([-leng * 2, 0]) + rotate([180, 0, 180]) { + translate([half_leng2, 0]) + square([leng2, height], center = true); + translate([0, -half_h]) + polygon(tri_points); + translate([-height, -half_h]) + stairs(height, stair_number); + + walk_bottom_leng = 2 * leng - height * 2 - half_leng; + translate([-walk_bottom_leng - height, -half_h]) + square([walk_bottom_leng, height / stair_number]); + } + } } module one_burst(leng, thickness, height, stair_number) { diff --git a/examples/wormhole.scad b/examples/wormhole.scad index a28ca604..c968bcd6 100644 --- a/examples/wormhole.scad +++ b/examples/wormhole.scad @@ -25,8 +25,8 @@ module wormhole(length, width, depth, thickness, hole_r) { difference() { rotate([90, 0, 0]) linear_extrude(width, center = true) - polyline_join(plane) - square(thickness, center = true); + polyline_join(plane) + square(thickness, center = true); translate([(length - r1) / 2, 0]) linear_extrude(depth + thickness * 2, center = true) @@ -43,8 +43,8 @@ module wormhole(length, width, depth, thickness, hole_r) { translate([(length - r1) / 2, 0, r1 - r2]) rotate_extrude() translate([r2 + half_thickness + hole_r, 0]) - polyline_join(hole_profile) - square(thickness, center = true); + polyline_join(hole_profile) + square(thickness, center = true); } hole();