Compare commits
	
		
			6 Commits
		
	
	
		
			99352f32ce
			...
			125a792f38
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 125a792f38 | |||
| a216fb2dd6 | |||
| e180588583 | |||
| 8b72052a15 | |||
| 0acb1e0e6e | |||
| 522901991d | 
| @ -5,36 +5,7 @@ | |||||||
|             "$fn": "64", |             "$fn": "64", | ||||||
|             "base_extra_thickness": "20", |             "base_extra_thickness": "20", | ||||||
|             "base_tickness": "8", |             "base_tickness": "8", | ||||||
|             "draw_fin": "true", |             "build_fin": "true", | ||||||
|             "draw_profile": "false", |  | ||||||
|             "fin_back_angle": "20", |  | ||||||
|             "fin_back_height": "30", |  | ||||||
|             "fin_back_strength": "30", |  | ||||||
|             "fin_back_widthdraw": "20", |  | ||||||
|             "fin_back_withraw": "20", |  | ||||||
|             "fin_base": "114", |  | ||||||
|             "fin_counter_angle": "30", |  | ||||||
|             "fin_counter_strength": "10", |  | ||||||
|             "fin_edge_angle": "30", |  | ||||||
|             "fin_edge_strength": "30", |  | ||||||
|             "fin_end_angle": "110", |  | ||||||
|             "fin_end_strength": "30", |  | ||||||
|             "fin_height": "51", |  | ||||||
|             "fin_start_angle": "60", |  | ||||||
|             "fin_sweep": "25", |  | ||||||
|             "fin_thickness": "8", |  | ||||||
|             "fin_top_withdraw": "10", |  | ||||||
|             "fin_width": "120", |  | ||||||
|             "fin_width_tip": "5", |  | ||||||
|             "parts": "all", |  | ||||||
|             "scale_factor": "1", |  | ||||||
|             "show_debug_layers": "true" |  | ||||||
|         }, |  | ||||||
|         "New set 2": { |  | ||||||
|             "$fn": "64", |  | ||||||
|             "base_extra_thickness": "20", |  | ||||||
|             "base_tickness": "8", |  | ||||||
|             "draw_fin": "false", |  | ||||||
|             "draw_profile": "false", |             "draw_profile": "false", | ||||||
|             "fin_back_angle": "20", |             "fin_back_angle": "20", | ||||||
|             "fin_back_height": "30", |             "fin_back_height": "30", | ||||||
| @ -59,12 +30,14 @@ | |||||||
|             "scale_factor": "1", |             "scale_factor": "1", | ||||||
|             "show_debug_layers": "false" |             "show_debug_layers": "false" | ||||||
|         }, |         }, | ||||||
|         "New set 3": { |         "New set 2": { | ||||||
|             "$fn": "64", |             "$fn": "64", | ||||||
|  |             "OFFSET": "0.01", | ||||||
|             "base_extra_thickness": "20", |             "base_extra_thickness": "20", | ||||||
|             "base_tickness": "8", |             "base_tickness": "8", | ||||||
|             "draw_fin": "false", |             "build_fin": "true", | ||||||
|             "draw_profile": "true", |             "build_mold": "true", | ||||||
|  |             "draw_profile": "false", | ||||||
|             "fin_back_angle": "20", |             "fin_back_angle": "20", | ||||||
|             "fin_back_height": "30", |             "fin_back_height": "30", | ||||||
|             "fin_back_strength": "30", |             "fin_back_strength": "30", | ||||||
| @ -84,7 +57,15 @@ | |||||||
|             "fin_top_withdraw": "10", |             "fin_top_withdraw": "10", | ||||||
|             "fin_width": "120", |             "fin_width": "120", | ||||||
|             "fin_width_tip": "5", |             "fin_width_tip": "5", | ||||||
|             "parts": "all", |             "merge_holes_diameter": "6", | ||||||
|  |             "mold_base_height": "10", | ||||||
|  |             "mold_extra_width": "15", | ||||||
|  |             "mold_part": "bottom", | ||||||
|  |             "mold_piston_height": "10", | ||||||
|  |             "mold_top_height": "6", | ||||||
|  |             "parts": "bottom", | ||||||
|  |             "piston_depth": "5", | ||||||
|  |             "resin_escape_diameter": "4", | ||||||
|             "scale_factor": "1", |             "scale_factor": "1", | ||||||
|             "show_debug_layers": "false" |             "show_debug_layers": "false" | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -3,11 +3,12 @@ include <BOSL2/std.scad>; | |||||||
| include <BOSL2/beziers.scad>; | include <BOSL2/beziers.scad>; | ||||||
| include <BOSL2/rounding.scad>; | include <BOSL2/rounding.scad>; | ||||||
| include <BOSL2/skin.scad>; | include <BOSL2/skin.scad>; | ||||||
|  | include <BOSL2/threading.scad>; | ||||||
| 
 | 
 | ||||||
| include <DotScad/src/bend.scad>; | include <DotScad/src/bend.scad>; | ||||||
| include <DotScad/src/bend_extrude.scad>; | include <DotScad/src/bend_extrude.scad>; | ||||||
| include <DotScad/src/ellipse_extrude.scad>; | include <DotScad/src/ellipse_extrude.scad>; | ||||||
| include <DotScad/src/rounded_extrude.scad>; | include <DotScad/src/loft.scad>; | ||||||
| 
 | 
 | ||||||
| /************************************************/ | /************************************************/ | ||||||
| /*  Parameters                                  */ | /*  Parameters                                  */ | ||||||
| @ -50,49 +51,86 @@ fin_back_strength=30; | |||||||
| base_tickness=8;  | base_tickness=8;  | ||||||
| base_extra_thickness=20; | base_extra_thickness=20; | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| /* [Debugging] */ | /* [Debugging] */ | ||||||
| 
 | 
 | ||||||
| // Showing all layers | // Showing all layers | ||||||
| show_debug_layers = false; | show_debug_layers = false; | ||||||
| 
 | 
 | ||||||
| // Draw master profile | // Draw master profile | ||||||
| draw_profile = true; | draw_profile = false; | ||||||
| 
 | 
 | ||||||
| // Draw Fin | // Draw Fin | ||||||
| draw_fin = false; | build_fin = false; | ||||||
|  | 
 | ||||||
|  | // Build mold | ||||||
|  | build_mold = true; | ||||||
|  | 
 | ||||||
|  | /* [Mold] */ | ||||||
|  | 
 | ||||||
|  | // Mold base height | ||||||
|  | mold_base_height = 10; | ||||||
|  | mold_top_height = 5; | ||||||
|  | mold_extra_width = 15; | ||||||
|  | 
 | ||||||
|  | mold_piston_height = 10; | ||||||
|  | 
 | ||||||
|  | resin_escape_diameter=4;  | ||||||
|  | 
 | ||||||
|  | // Diameter for screw holes in mm | ||||||
|  | merge_holes_diameter = 6; | ||||||
|  | piston_depth = 5; | ||||||
| 
 | 
 | ||||||
| /* [Rendering] */ | /* [Rendering] */ | ||||||
| 
 | 
 | ||||||
| // Rendering parts | // Rendering parts | ||||||
| parts="all"; // [all, top, bottom] | parts           = "all";      // [all, top, bottom] | ||||||
| 
 | 
 | ||||||
|  | mold_part       = "all";   // [all, top, bottom] | ||||||
| // Scaling | // Scaling | ||||||
| scale_factor = 1.0; // [0.1:0.1:2]  | scale_factor    = 1.0; // [0.1:0.1:2]  | ||||||
|  | 
 | ||||||
|  | // Printable rendering | ||||||
|  | printable       = true; | ||||||
|  | 
 | ||||||
|  | // Rendering mold | ||||||
|  | //render_mold = true; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| $fn=64; | $fn=64; | ||||||
|  | 
 | ||||||
|  | /*************/ | ||||||
|  | /* Constants */ | ||||||
|  | /*************/ | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | // Define the offset value as a constant | ||||||
|  | OFFSET = 0.01; | ||||||
|  | 
 | ||||||
| /************************************************/ | /************************************************/ | ||||||
|  | /* Derived variable */ | ||||||
|  | 
 | ||||||
|  | mold_width  = fin_height +2 * mold_extra_width; | ||||||
|  | mold_length = fin_width  +2 * mold_extra_width; | ||||||
|  | mold_height = mold_base_height; | ||||||
|  | 
 | ||||||
|  | drilling_length = mold_base_height+mold_piston_height+2*OFFSET; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| pt1_x = adj_ang_to_opp(fin_height,fin_sweep)+fin_base/2; | pt1_x = adj_ang_to_opp(fin_height,fin_sweep)+fin_base/2; | ||||||
| pt1_y = fin_height; | pt1_y = fin_height; | ||||||
| 
 | 
 | ||||||
| echo ("counterTop(fin_width,fin_top_withdraw)",counterTop(fin_width,fin_top_withdraw,fin_height)); | //back_point = [fin_width-7,fin_height/2]; | ||||||
| 
 |  | ||||||
| echo ("handleEnd(fin_width,fin_top_withdraw,fin_counter_angle,fin_counter_strength)",handleEnd(fin_width,fin_top_withdraw,fin_counter_angle,fin_counter_strength)); |  | ||||||
| echo ("xAngleFactor(-20)",xAngleFactor(-20)); |  | ||||||
| 
 |  | ||||||
| echo("polar_to_x : ",polar_to_xy(100, 180)); |  | ||||||
| 
 |  | ||||||
| back_point = [fin_width-7,fin_height/2]; |  | ||||||
| tail_point = [fin_width-3,fin_height/5]; | tail_point = [fin_width-3,fin_height/5]; | ||||||
| 
 | 
 | ||||||
| edge_point = [fin_width-fin_top_withdraw,fin_height-2]; | edge_point = [fin_width-fin_top_withdraw,fin_height-2]; | ||||||
| counter_edge_point = [fin_width-6,fin_height-8]; | counter_edge_point = [fin_width-6,fin_height-8]; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| control_points = [ | 
 | ||||||
|  | /******************/ | ||||||
|  | /* Profile points */ | ||||||
|  | /******************/ | ||||||
|  |  profile_points = [ | ||||||
|     // ***************** |     // ***************** | ||||||
|     //   INITIAL POINT |     //   INITIAL POINT | ||||||
|     // *****************     |     // *****************     | ||||||
| @ -107,219 +145,33 @@ control_points = [ | |||||||
|     // ***************** |     // ***************** | ||||||
|     //   EDGE POINT |     //   EDGE POINT | ||||||
|     // ***************** |     // ***************** | ||||||
|     //counterTop(fin_width,fin_top_withdraw,fin_height), // [250,220],   // Point 2 |     handle(edge_point,140 ,4), | ||||||
|     handle(edge_point,140 /*degree*/,4), |     edge_point,                                                     // Point Edge Point | ||||||
|     edge_point, // [250,220],   // Point 2 |     handle(edge_point,-45,4), | ||||||
|     handle(edge_point,-45 /*degree*/,4), |  | ||||||
|     // ***************** |     // ***************** | ||||||
|     //   COUNTER EDGE POINT |     //   COUNTER EDGE POINT | ||||||
|     // ***************** |     // ***************** | ||||||
|     //counterTop(fin_width,fin_top_withdraw,fin_height), // [250,220],   // Point 2 |     handle(counter_edge_point,120,4), | ||||||
|     handle(counter_edge_point,120 /*degree*/,4), |     counter_edge_point,                                             // Point Counter Edge | ||||||
|     counter_edge_point, // [250,220],   // Point 2 |     handle(counter_edge_point,-110,13),     | ||||||
|     handle(counter_edge_point,-110 /*degree*/,13),     |  | ||||||
| 
 |  | ||||||
|     // ***************** |  | ||||||
|     //   BACK Point |  | ||||||
|     // ***************** |  | ||||||
|     //counterTop(fin_width,fin_top_withdraw,fin_height), // [250,220],   // Point 2 |  | ||||||
|     /* |  | ||||||
|     handle(back_point,90 ,6), |  | ||||||
|     back_point, |  | ||||||
|     handle(back_point,-90 ,6), |  | ||||||
|     */ |  | ||||||
| 
 |  | ||||||
|     // ***************** |     // ***************** | ||||||
|     //   TAIL Point |     //   TAIL Point | ||||||
|     // ***************** |     // ***************** | ||||||
|      |  | ||||||
|     handle(tail_point,115 ,10), |     handle(tail_point,115 ,10), | ||||||
|     tail_point, |     tail_point, | ||||||
|     //handle(tail_point,-90,10),     |  | ||||||
|     handle(tail_point,0,0),     |     handle(tail_point,0,0),     | ||||||
|     //tailPoint(), |  | ||||||
|     // ***************** |  | ||||||
|     //   BACK POINT |  | ||||||
|     // ***************** |  | ||||||
|     /* |  | ||||||
|     handle(backPoint(),fin_back_angle,fin_back_strength), |  | ||||||
|     backPoint(), |  | ||||||
|     handle(backPoint(),-fin_back_angle,fin_back_strength), |  | ||||||
|     */ |  | ||||||
|     // ***************** |     // ***************** | ||||||
|     //   END POINT |     //   END POINT | ||||||
|     // ***************** |     // ***************** | ||||||
|     //endHandle(fin_end_angle),                                       // End Handle |     handle([fin_base,0],60,3), | ||||||
|     handle([fin_base,0],60 /*degree*/,3), |  | ||||||
|     [fin_base,0]                                                    // End point |     [fin_base,0]                                                    // End point | ||||||
| ]; | ]; | ||||||
| 
 | 
 | ||||||
| 
 | profile_path  = translate_path( asCurve(profile_points),-fin_width/2 ); | ||||||
| top_point = [0,fin_height]; |                    | ||||||
| p1 = [fin_thickness/2,0]; |                    | ||||||
| p2 = [-fin_thickness/2,0]; |                    | ||||||
| 
 | function asCurve(points) = bezier_curve(points/*,N=3*/,splinesteps=128); | ||||||
| 
 |  | ||||||
| vertical_shape=[ |  | ||||||
|     p1, |  | ||||||
|     handle(p1,90,fin_height/1.2), |  | ||||||
|     // ***************** |  | ||||||
|     //   TOP Point |  | ||||||
|     // *****************       |  | ||||||
|     handle(top_point,140 /*degree*/,0), |  | ||||||
|     top_point, |  | ||||||
|     handle(top_point,140 /*degree*/,0), |  | ||||||
|     // ***************** |  | ||||||
|     //   END POINT |  | ||||||
|     // *****************     |  | ||||||
|     handle(p2,90,fin_height/1.2), |  | ||||||
|     p2 |  | ||||||
| ]; |  | ||||||
| 
 |  | ||||||
| lpoint=[fin_width/2,0]; |  | ||||||
| rpoint=[-lpoint[0],0]; |  | ||||||
| top_strength=fin_width/8; |  | ||||||
| 
 |  | ||||||
| top_shape=[ |  | ||||||
|     // Right |  | ||||||
|     rpoint, |  | ||||||
|     handle(rpoint,150,top_strength), |  | ||||||
|     // Left |  | ||||||
|     handle(lpoint,40,top_strength), |  | ||||||
|     lpoint, |  | ||||||
|     handle(lpoint,-40,top_strength), |  | ||||||
|     // Final |  | ||||||
|     handle(rpoint,-150,top_strength), |  | ||||||
|     rpoint |  | ||||||
| ]; |  | ||||||
| 
 |  | ||||||
| // Calculate points along the Bézier curve.  |  | ||||||
| // 'N' here determines the number of points to calculate. |  | ||||||
| //N = 50; // Number of points to generate |  | ||||||
| profile_path    = asCurve(control_points); |  | ||||||
| vertical_path   = asCurve(vertical_shape); |  | ||||||
| top_path        = asCurve(top_shape); |  | ||||||
| 
 |  | ||||||
| echo ("vertical_path",vertical_path); |  | ||||||
| 
 |  | ||||||
| left(50) polygon(vertical_path); |  | ||||||
| left(180) polygon(profile_path); |  | ||||||
| //left(280) polygon(top_path); |  | ||||||
| 
 |  | ||||||
| left(100) back(70) |  | ||||||
| resize([fin_width,fin_thickness])circle(d=fin_width); |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| //showDebugPath(top_path); |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| function asCurve(points) = bezier_curve(points,N=3,splinesteps=128); |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| /* |  | ||||||
| bezier = bezier_points(control_points, N=50); |  | ||||||
| 
 |  | ||||||
| // Convert the Bézier curve points to a 3D path starting at z=0 |  | ||||||
| path3d_bezier = path3d(bezier); |  | ||||||
| */ |  | ||||||
| intersection(){ |  | ||||||
|     if (true) down(fin_thickness) linear_extrude(height=fin_thickness*2) { |  | ||||||
|         polygon(profile_path); |  | ||||||
|     }; |  | ||||||
|     left(0) yrot(90) linear_extrude(height=fin_width) { |  | ||||||
|         polygon(vertical_path); |  | ||||||
|     };    |  | ||||||
|     if (true) right(fin_width/2) xrot(-90) linear_extrude(height=fin_height) { |  | ||||||
|         resize([fin_width,fin_thickness])circle(d=fin_width);  |  | ||||||
|     };   |  | ||||||
|   |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| color("Red") left(300) intersection(){ |  | ||||||
|     left(0) yrot(90)  |  | ||||||
|     |  | ||||||
|     //bend(size = [fin_width*3, fin_height*2, fin_tickness*4], angle = 270)  |  | ||||||
|         linear_extrude(height=fin_width)  |  | ||||||
|             polygon(vertical_path); |  | ||||||
|     if (true) right(fin_width/2) xrot(-90) linear_extrude(height=fin_height) { |  | ||||||
|         resize([fin_width,fin_thickness])circle(d=fin_width);  |  | ||||||
|     };   |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
|     |  | ||||||
|  color("green") left(300) back(70) |  | ||||||
|     left(0) yrot(90)  |  | ||||||
|     //bend(size = [fin_width*3, fin_height*2, fin_tickness*4], angle = 30)  |  | ||||||
|         linear_extrude(height=fin_width)  |  | ||||||
|         //bend_extrude(size = [100, 100], thickness = 1, angle = 270) |  | ||||||
|             polygon(vertical_path); |  | ||||||
|             //text("A"); |  | ||||||
|         ;    |  | ||||||
| 
 |  | ||||||
| path = [for(theta=[-180:5:180]) [theta/10, 10*sin(theta)]];     |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| // https://github.com/BelfrySCAD/BOSL2/wiki/skin.scad#functionmodule-path_sweep     |  | ||||||
| color("Yellow") path_sweep( |  | ||||||
|     vertical_path, |  | ||||||
|     get_n_items(profile_path,80), |  | ||||||
|     spin=0 |  | ||||||
|     ); |  | ||||||
| 
 |  | ||||||
|      |  | ||||||
|  semi_minor_axis = 2; |  | ||||||
|   |  | ||||||
|  echo ("PATH LENGTH",len(profile_path)); |  | ||||||
|  echo ("PATH LENGTH2",len(subdivide_path(profile_path,400))); |  | ||||||
|  echo ("PATH LENGTH3",len(resample_path(profile_path,500))); |  | ||||||
|   |  | ||||||
|  print_path_points(profile_path); |  | ||||||
|   |  | ||||||
| print_path_points(translate_path(profile_path,-fin_width/2,0)); |  | ||||||
| 
 |  | ||||||
|  if (true) color("Brown") left(200) back(155) down(fin_thickness)  |  | ||||||
|     ellipse_extrude( |  | ||||||
|         //semi_minor_axis,  |  | ||||||
|         fin_thickness/2, |  | ||||||
|         //height = 16, |  | ||||||
|         center=true, |  | ||||||
|         //convexity=40 |  | ||||||
|         //angle=90 |  | ||||||
|         )  |  | ||||||
|     //linear_extrude(height=fin_thickness*2)  |  | ||||||
|     //linear_extrude(height=60)  |  | ||||||
|         polygon( |  | ||||||
|             translate_path(  |  | ||||||
|                 resample_path(profile_path,200), |  | ||||||
|                 -fin_width/2, |  | ||||||
|                 0 |  | ||||||
|             ) |  | ||||||
|         ); |  | ||||||
|      |  | ||||||
| 
 |  | ||||||
| circle_r = 10; |  | ||||||
| round_r = 5; |  | ||||||
|      |  | ||||||
| right(200) rounded_extrude(circle_r * 2, round_r)  |  | ||||||
|     circle(circle_r); |  | ||||||
|      |  | ||||||
| right(300) rounded_extrude(circle_r * 2, round_r)  |  | ||||||
|     polygon(resample_path(profile_path,200)); |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| color("red")move_copies(profile_path) circle($fn=16); |  | ||||||
| 
 |  | ||||||
|      |  | ||||||
|      |  | ||||||
|     |  | ||||||
| 
 |  | ||||||
| function get_n_items(arr, n) =  |  | ||||||
|     [for (i = [0 : n - 1]) if (i < len(arr)) arr[i]]; |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| function handle(point,angle,strength) = [ | function handle(point,angle,strength) = [ | ||||||
|     //point[0] + adj_ang_to_opp(strength,angle)   /** xAngleFactor(angle)*/, |     //point[0] + adj_ang_to_opp(strength,angle)   /** xAngleFactor(angle)*/, | ||||||
|     //point[1] + /*(angle>0 ? strength :-strength)*/ strength  * yAngleFactor(angle), |     //point[1] + /*(angle>0 ? strength :-strength)*/ strength  * yAngleFactor(angle), | ||||||
| @ -330,7 +182,7 @@ function handle(point,angle,strength) = [ | |||||||
| function xAngleFactor(angle) = angle > 0 && angle < 180 ? 1 : -1; | function xAngleFactor(angle) = angle > 0 && angle < 180 ? 1 : -1; | ||||||
| function yAngleFactor(angle) = angle > -90 && angle < 90 ? 1 : -1; | function yAngleFactor(angle) = angle > -90 && angle < 90 ? 1 : -1; | ||||||
| 
 | 
 | ||||||
| function counterTop(x,withdraw,height)                 = [x-withdraw, height ]; | //function counterTop(x,withdraw,height)                 = [x-withdraw, height ]; | ||||||
| function handleStart(x,withdraw,angle,strength) = [x+adj_ang_to_opp(strength,angle), x-withdraw +strength]; | function handleStart(x,withdraw,angle,strength) = [x+adj_ang_to_opp(strength,angle), x-withdraw +strength]; | ||||||
| function handleEnd(x,withdraw,angle,strength)   = [x-adj_ang_to_opp(strength,angle), x-withdraw -strength]; | function handleEnd(x,withdraw,angle,strength)   = [x-adj_ang_to_opp(strength,angle), x-withdraw -strength]; | ||||||
| function endHandle(angle)=  | function endHandle(angle)=  | ||||||
| @ -339,75 +191,233 @@ function endHandle(angle)= | |||||||
|         :  |         :  | ||||||
|         [fin_base - adj_ang_to_opp(fin_end_strength,angle-90),fin_end_strength]  |         [fin_base - adj_ang_to_opp(fin_end_strength,angle-90),fin_end_strength]  | ||||||
|         ; |         ; | ||||||
| function backPoint() = [fin_base-(fin_back_widthdraw/100*fin_base),fin_back_height/100*fin_height]; |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|  | //function backPoint() = [fin_base-(fin_back_widthdraw/100*fin_base),fin_back_height/100*fin_height]; | ||||||
| 
 | 
 | ||||||
| function decrease_y(points, percentage) = [ for (p = points) [p[0], p[1] * (1 - percentage/100)]]; | function decrease_y(points, percentage) = [ for (p = points) [p[0], p[1] * (1 - percentage/100)]]; | ||||||
| 
 | 
 | ||||||
| function pathProfile(points) = bezpath_curve(points,N=3); | function pathProfile(points) = bezpath_curve(points,N=3); | ||||||
| 
 | 
 | ||||||
| function remove_last(arr) = select(arr, 0, len(arr) - 2); |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| // Surf Fin profile | // Surf Fin profile | ||||||
| fin_profile = pathProfile( control_points ); | fin_profile         = pathProfile( profile_points ); | ||||||
| vertical_profile = pathProfile(vertical_shape); |  | ||||||
| 
 | 
 | ||||||
| // **************** | function expandPath(path,delta) =  | ||||||
| // *  Slicing     * |  | ||||||
| // **************** |  | ||||||
| 
 |  | ||||||
| layer_0 = pathProcess(addBase(fin_profile));                     // Master layer with base |  | ||||||
| layer_1 = contract(layer_0,-5); |  | ||||||
| layer_2 = contract(layer_1,-4); |  | ||||||
| layer_3 = contract(layer_2,-4); |  | ||||||
| layer_4 = contract(layer_3,-2); |  | ||||||
| 
 |  | ||||||
| //echo ("layer_2",layer_2); |  | ||||||
| //echo ("layer_3",layer_3); |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| //layers = [layer_0,layer_1,layer_2,layer_3,layer_4]; |  | ||||||
| layers = [layer_0,layer_1,layer_2,layer_3]; |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| function pathProcess2(path) = subdivide_path(path,100); |  | ||||||
| function pathProcess(path) = path; |  | ||||||
| function contract2(path,delta) = pathProcess(offset(path,r=delta,chamfer=true)); |  | ||||||
| function contract(path,delta) =  |  | ||||||
|     pathProcess( |  | ||||||
|         offset( |         offset( | ||||||
|             deduplicate(path), |             deduplicate(path), | ||||||
|             delta=delta, |             delta=delta, | ||||||
|             chamfer=false, |             chamfer=false, | ||||||
|             same_length=true |             same_length=true | ||||||
|        ) |        ) | ||||||
|     ); |     ; | ||||||
| 
 |      | ||||||
| 
 |      | ||||||
| 
 | // ***************** | ||||||
| 
 | // *  Fin Drawing  * | ||||||
| 
 | // ***************** | ||||||
| // **************** | if (build_fin) { | ||||||
| // *  Fin Drawing     * |     scale([scale_factor, scale_factor, scale_factor]) buildFin(); | ||||||
| // **************** |  | ||||||
| if (draw_fin) { |  | ||||||
| 
 |  | ||||||
|     scale([scale_factor, scale_factor, scale_factor]) build(); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| module build() { | if (build_mold) { | ||||||
|  |    buildMold();     | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Build mold | ||||||
|  |  *  | ||||||
|  |  */ | ||||||
|  | module buildMold() { | ||||||
|  |     // Bottom mold | ||||||
|  |     difference() {  | ||||||
|  |         case(mold_base_height,true); | ||||||
|  |         // Piston | ||||||
|  |         down(piston_depth-OFFSET) fwd(20) bottomInsert();  | ||||||
|  |     } | ||||||
|  |     // Top Mold | ||||||
|  |     up(printable ? 0 : 60) fwd(printable ? fin_height+50 : 0) down(mold_base_height) mirror([0,0,printable ? 1 : 0 ])  { | ||||||
|  |      | ||||||
|  |      | ||||||
|  |         difference() { | ||||||
|  |             union() { | ||||||
|  |                 // case | ||||||
|  |                 case(mold_top_height,false);  | ||||||
|  | 
 | ||||||
|  |                 // Piston | ||||||
|  |                 mirror([1,0,0])         | ||||||
|  |                 down(mold_top_height+piston_depth-OFFSET) fwd(20) topPiston();  | ||||||
|  |             }; | ||||||
|  |             resin_escape(40); | ||||||
|  |          | ||||||
|  |         }; | ||||||
|  |         | ||||||
|  |     };          | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Mold Case  | ||||||
|  |  * | ||||||
|  |  * @param height - Height of the case | ||||||
|  |  * @param bottom - Is bottom or top  | ||||||
|  |  */ | ||||||
|  | module case_old(height,bottom=true) { | ||||||
|  |     diff() cuboid( [ mold_length, mold_width, height ], | ||||||
|  |         rounding=4, | ||||||
|  |         edges=[bottom ? BOTTOM: TOP], | ||||||
|  |         anchor=TOP ){ | ||||||
|  |         // Drills | ||||||
|  |         align(BOTTOM,[FRONT+LEFT,FRONT+RIGHT,BACK+LEFT,BACK+RIGHT],inset=10,overlap=-OFFSET) | ||||||
|  |             color("orange")  | ||||||
|  |                 tag("remove")  | ||||||
|  |                     drilling(); | ||||||
|  |         // Material holes    | ||||||
|  | /*         | ||||||
|  |         align(TOP,[CENTER+BACK+LEFT],inside=true,inset=15,overlap=-OFFSET)  | ||||||
|  |                 color("Red") wedge([mold_height+2*OFFSET, 50, 30], center=true,orient=FRONT,spin=-90        );                         | ||||||
|  |   */               | ||||||
|  |         // Material holes | ||||||
|  |         align(TOP,[CENTER+BACK+LEFT]/*,inside=true*/,inset=15,overlap=-OFFSET)  | ||||||
|  |             color("Red") | ||||||
|  |                 up(OFFSET) | ||||||
|  |                     tag("remove")  | ||||||
|  |                         rounded_triangle(radius=3, height=height+2*OFFSET);                     | ||||||
|  |     }              | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | module case(height,bottom=true) { | ||||||
|  |     difference() { | ||||||
|  |         diff() cuboid( [ mold_length, mold_width, height ], | ||||||
|  |             rounding=4, | ||||||
|  |             edges=[bottom ? BOTTOM: TOP], | ||||||
|  |             anchor=TOP ){ | ||||||
|  |             // Drills | ||||||
|  |             align(BOTTOM,[FRONT+LEFT,FRONT+RIGHT,BACK+LEFT,BACK+RIGHT],inset=10,overlap=-OFFSET) | ||||||
|  |                 color("orange")  | ||||||
|  |                     tag("remove")  | ||||||
|  |                         drilling(); | ||||||
|  |             // Material holes    | ||||||
|  |     /*         | ||||||
|  |             align(TOP,[CENTER+BACK+LEFT],inside=true,inset=15,overlap=-OFFSET)  | ||||||
|  |                     color("Red") wedge([mold_height+2*OFFSET, 50, 30], center=true,orient=FRONT,spin=-90        );                         | ||||||
|  |       */               | ||||||
|  |              | ||||||
|  |                            | ||||||
|  |         }; | ||||||
|  |         // Material holes | ||||||
|  |         mirror([bottom ? 0:1,0,0]) | ||||||
|  |         back(38) left(55) | ||||||
|  |                 color("Red") | ||||||
|  |                     up(OFFSET) | ||||||
|  |                         //tag("remove")  | ||||||
|  |                             rounded_triangle(radius=3, height=height+2*OFFSET);               | ||||||
|  |         // Length hole                     | ||||||
|  |         fwd(32) cuboid([120,10,50],rounding=5); | ||||||
|  |         // Side holes | ||||||
|  |         left(67) cuboid([10,40,50],rounding=5); | ||||||
|  |         right(67) cuboid([10,40,50],rounding=5); | ||||||
|  |          | ||||||
|  |    } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | module rounded_triangle(radius, height) { | ||||||
|  |     triangle_points = [[0, 0], [75, 0], [0, -35]]; // Equilateral triangle with side length 100 | ||||||
|  |     // Round the corners of the triangle | ||||||
|  |     rounded_shape = round_corners( triangle_points, r=radius ); | ||||||
|  |     // Extrude the 2D rounded triangle | ||||||
|  |     //mirror([0,0,1]) linear_extrude(height = height) polygon(rounded_shape); | ||||||
|  |     mirror([0,0,1]) linear_extrude(height = height) polygon(rounded_shape); | ||||||
|  | 
 | ||||||
|  |     //mirror([0,0,1]) linear_extrude(height = height) polygon(round_corners(right_triangle([40,30]),r=radius));     | ||||||
|  |     //mirror([0,0,1]) linear_extrude(height = height) polygon(right_triangle([40,30])); | ||||||
|  |     //mirror([0,0,1]) cyl(l=80, r=10); // Work with cylinder | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | // ***************** | ||||||
|  | // * Bottom insert * | ||||||
|  | // ***************** | ||||||
|  | module bottomInsert() { | ||||||
|  |     debug=true; | ||||||
|  |     //layer_profile       = pathProcess(profile_path);  | ||||||
|  |     layer_profile       = profile_path;  | ||||||
|  |     skin( [ layer_profile,expandPath(layer_profile,3) ], z=[0,piston_depth], slices=0 ) | ||||||
|  |         //up(debug ? 2 : 0) | ||||||
|  |        up(OFFSET)  | ||||||
|  |         buildFinSide(true) | ||||||
|  |         ; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // ***************** | ||||||
|  | // * Top piston    * | ||||||
|  | // ***************** | ||||||
|  | module topPiston() { | ||||||
|  |     debug=true; | ||||||
|  |     layer_profile       = profile_path;  | ||||||
|  |     difference() { | ||||||
|  |         skin( [ layer_profile,expandPath(layer_profile,3) ], z=[0,piston_depth], slices=0 ); | ||||||
|  |         down(OFFSET) | ||||||
|  |         buildFinSide(false); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Build fin side | ||||||
|  |  *  | ||||||
|  |  * @param flip - Define it it is top or bottom fin side | ||||||
|  |  */ | ||||||
|  | module buildFinSide(flip=false) { | ||||||
|  |     debug=false; | ||||||
|  |     mirror([0,0,flip ? 1 : 0]) | ||||||
|  |         color(flip ? "Gray" : "LightGray") /*up(fin_thickness/4)*/ /*down(fin_thickness) */ | ||||||
|  |         ellipse_extrude( fin_thickness/2*(debug?1.2:1))  | ||||||
|  |             polygon(profile_path); | ||||||
|  | }  | ||||||
|  | 
 | ||||||
|  | module resin_escape(length) { | ||||||
|  |     color ("Blue") cylinder(h=length, r=resin_escape_diameter/2); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // ***************** | ||||||
|  | // *  Drilling     * | ||||||
|  | // ***************** | ||||||
|  | module drilling(){ | ||||||
|  | 
 | ||||||
|  | //length = mold_base_height+mold_piston_height+10; | ||||||
|  | 
 | ||||||
|  | /*fwd(20)*/ color("Red") /*up(mold_piston_height+5)*/ up(-OFFSET) | ||||||
|  | orient(DOWN) | ||||||
|  |     threaded_rod( | ||||||
|  |         d=merge_holes_diameter,  | ||||||
|  |         l=drilling_length,  | ||||||
|  |         pitch=1.5,  | ||||||
|  |         anchor=BOTTOM, | ||||||
|  |         //orient=BOTTOM | ||||||
|  | 
 | ||||||
|  |     ); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | //drilling(); | ||||||
|  | 
 | ||||||
|  | module buildFin() { | ||||||
|  |     if (false) | ||||||
|     union(){ |     union(){ | ||||||
|         difference(){ |         difference(){ | ||||||
|             union() { |             union() { | ||||||
|                 if (parts !=  "bottom")  |                 if (parts !=  "bottom")  | ||||||
|                     buildFinSide([layer_0,layer_1,layer_2],fin_thickness/2); |                     //buildFinSide([layer_0,layer_1,layer_2],fin_thickness/2); | ||||||
|                 if (parts !=  "top")  |                     buildFinSide(); | ||||||
|                     zflip()  |                 if (parts !=  "top") | ||||||
|                         buildFinSide([layer_0,layer_1,layer_2],fin_thickness/2);     |                     buildFinSide(true); | ||||||
|  |                     //zflip()  | ||||||
|  |                     //    buildFinSide([layer_0,layer_1,layer_2],fin_thickness/2);     | ||||||
|             } |             } | ||||||
|             color("Red") cube([fin_base+20,base_extra_thickness+20,base_tickness+20],anchor=LEFT+BACK); |             color("Red") cube([fin_base+20,base_extra_thickness+20,base_tickness+20],anchor=LEFT+BACK); | ||||||
|         } |         } | ||||||
| @ -420,29 +430,8 @@ module subtracted(anchor) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /** |  | ||||||
|  * Build fin side |  | ||||||
|  *  |  | ||||||
|  * @param layers - Layers path as array |  | ||||||
|  * @param thickness - thickness of half fin |  | ||||||
|  */ |  | ||||||
| module buildFinSide(layers,thickness,flip=false) { |  | ||||||
|     color("Grey")  |  | ||||||
|         skin( |  | ||||||
|             layers, |  | ||||||
|             slices=0, |  | ||||||
|             //method="reindex", |  | ||||||
|             z=layerHeights(len(layers),thickness), |  | ||||||
|             //caps=true, |  | ||||||
|             sampling="segment", |  | ||||||
|             //closed=false |  | ||||||
|             //convexity=40 |  | ||||||
|             //atype="intersect" |  | ||||||
|             cp="box" |  | ||||||
|         ); |  | ||||||
| }  |  | ||||||
| 
 | 
 | ||||||
| echo ("layerHeights(3,thickness):",layerHeights(3,base_tickness/2)); | 
 | ||||||
| 
 | 
 | ||||||
| if (show_debug_layers) { | if (show_debug_layers) { | ||||||
|     left(130) { |     left(130) { | ||||||
| @ -461,7 +450,7 @@ if (show_debug_layers) { | |||||||
| } | } | ||||||
| if (draw_profile) { | if (draw_profile) { | ||||||
|     // Draw fin profile |     // Draw fin profile | ||||||
|     drawProfile( control_points, true  ); |     drawProfile( profile_points, true  ); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -516,24 +505,10 @@ module drawProfile( points,debug = true ){ | |||||||
| function addBase(path) = concat(path,[[fin_base,-base_extra_thickness],[0,-base_extra_thickness]]); | function addBase(path) = concat(path,[[fin_base,-base_extra_thickness],[0,-base_extra_thickness]]); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /** |  | ||||||
|  * Calculates heights for n layers where the first layer starts at 0 and the last at fin_thickness. |  | ||||||
|  *  |  | ||||||
|  * @param n - Number of layers. |  | ||||||
|  * @param fin_thickness - The total height to be divided. |  | ||||||
|  * @return An array where each element represents the height of the top of each layer. |  | ||||||
|  */ |  | ||||||
| function layerHeights(n, fin_thickness) =  |  | ||||||
|     let( |  | ||||||
|         layer_height = fin_thickness / (n - 1) |  | ||||||
|     ) |  | ||||||
|     [ for (i = [0 : n-1]) i * layer_height ]; |  | ||||||
|      |  | ||||||
| 
 |  | ||||||
| /** | /** | ||||||
|  * Function to translate a path manually along X and Y |  * Function to translate a path manually along X and Y | ||||||
|  */  |  */  | ||||||
| function translate_path(path, dx, dy) =  | function translate_path(path, dx=0, dy=0) =  | ||||||
|     [for (p = path) [p[0] + dx, p[1] + dy]];     |     [for (p = path) [p[0] + dx, p[1] + dy]];     | ||||||
|      |      | ||||||
|      |      | ||||||
| @ -548,9 +523,13 @@ module print_path_points(path) { | |||||||
| echo ("**********************"); | echo ("**********************"); | ||||||
| echo ("*  Configuration     *"); | echo ("*  Configuration     *"); | ||||||
| echo ("**********************"); | echo ("**********************"); | ||||||
| echo ("Layers count"        ,len(layers)); | //echo ("Layers count"        ,len(layers)); | ||||||
| echo ("Base thickness"      ,str(base_tickness," mm")); | echo ("Base thickness"      ,str(base_tickness," mm")); | ||||||
| echo ("Layers heights"      ,layerHeights(len(layers),fin_thickness/2));     |    | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user