Fin ellipse extruding

This commit is contained in:
Sébastien Dante Ursini 2025-01-14 15:34:49 -03:00
parent 290e9efbaa
commit 99352f32ce
2 changed files with 304 additions and 73 deletions

View File

@ -2,65 +2,11 @@
"fileFormatVersion": "1",
"parameterSets": {
"New set 1": {
"$fn": "32",
"base_extra_thickness": "80",
"base_tickness": "9",
"draw_fin": "false",
"draw_profile": "true",
"fin_back_angle": "20",
"fin_back_height": "30",
"fin_back_strength": "30",
"fin_back_widthdraw": "20",
"fin_back_withraw": "20",
"fin_base": "200",
"fin_counter_angle": "30",
"fin_counter_strength": "20",
"fin_end_angle": "110",
"fin_end_strength": "30",
"fin_height": "250",
"fin_start_angle": "70",
"fin_sweep": "25",
"fin_thickness": "5",
"fin_top_withdraw": "30",
"fin_width": "240",
"fin_width_tip": "5",
"parts": "all",
"scale_factor": "1",
"show_debug_layers": "false"
},
"New set 2": {
"$fn": "32",
"base_extra_thickness": "80",
"base_tickness": "8",
"draw_fin": "false",
"draw_profile": "true",
"fin_back_angle": "20",
"fin_back_height": "30",
"fin_back_strength": "30",
"fin_back_widthdraw": "20",
"fin_back_withraw": "20",
"fin_base": "120",
"fin_counter_angle": "30",
"fin_counter_strength": "20",
"fin_end_angle": "110",
"fin_end_strength": "30",
"fin_height": "61",
"fin_start_angle": "70",
"fin_sweep": "25",
"fin_thickness": "8",
"fin_top_withdraw": "30",
"fin_width": "240",
"fin_width_tip": "5",
"parts": "all",
"scale_factor": "1",
"show_debug_layers": "false"
},
"New set 3": {
"$fn": "32",
"base_extra_thickness": "80",
"$fn": "64",
"base_extra_thickness": "20",
"base_tickness": "8",
"draw_fin": "true",
"draw_profile": "true",
"draw_profile": "false",
"fin_back_angle": "20",
"fin_back_height": "30",
"fin_back_strength": "30",
@ -83,6 +29,64 @@
"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",
"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": "false"
},
"New set 3": {
"$fn": "64",
"base_extra_thickness": "20",
"base_tickness": "8",
"draw_fin": "false",
"draw_profile": "true",
"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": "false"
}
}
}

View File

@ -4,6 +4,10 @@ include <BOSL2/beziers.scad>;
include <BOSL2/rounding.scad>;
include <BOSL2/skin.scad>;
include <DotScad/src/bend.scad>;
include <DotScad/src/bend_extrude.scad>;
include <DotScad/src/ellipse_extrude.scad>;
include <DotScad/src/rounded_extrude.scad>;
/************************************************/
/* Parameters */
@ -44,7 +48,7 @@ fin_back_strength=30;
/* [Base Specs] */
base_tickness=8;
base_extra_thickness=80;
base_extra_thickness=20;
/* [Debugging] */
@ -151,6 +155,170 @@ control_points = [
];
top_point = [0,fin_height];
p1 = [fin_thickness/2,0];
p2 = [-fin_thickness/2,0];
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) = [
//point[0] + adj_ang_to_opp(strength,angle) /** xAngleFactor(angle)*/,
@ -185,28 +353,40 @@ function remove_last(arr) = select(arr, 0, len(arr) - 2);
// Surf Fin profile
fin_profile = pathProfile( control_points );
vertical_profile = pathProfile(vertical_shape);
// ****************
// * Slicing *
// ****************
layer_0 = pathProcess(addBase(fin_profile)); // Master layer with base
layer_1 = pathProcess(offset(layer_0,delta=-5,chamfer=true));
layer_2 = pathProcess(offset(layer_1,delta=-7,chamfer=false));
layer_3 = pathProcess(offset(layer_2,delta=-5,chamfer=false));
layer_4 = pathProcess(offset(layer_3,delta=-5,chamfer=false));
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 pathProcess(path) = subdivide_path(path,200);
function pathProcess3(path) = path;
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(
deduplicate(path),
delta=delta,
chamfer=false,
same_length=true
)
);
@ -221,11 +401,13 @@ if (draw_fin) {
module build() {
union(){
//cube([50,50,90]);
difference(){
union() {
if (parts != "bottom") buildFinSide([layer_0,layer_1,layer_2],base_tickness/2);
if (parts != "top") zflip() buildFinSide([layer_0,layer_1,layer_2],base_tickness/2);
if (parts != "bottom")
buildFinSide([layer_0,layer_1,layer_2],fin_thickness/2);
if (parts != "top")
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);
}
@ -246,21 +428,34 @@ module subtracted(anchor) {
*/
module buildFinSide(layers,thickness,flip=false) {
color("Grey")
skin(layers,slices=0,z=layerHeights(len(layers),thickness));
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) {
left(300) {
left(130) {
showDebugPath(layer_0);
showDebugPath(layer_1);
showDebugPath(layer_2);
assert(is_path(layer_3),"Layer 3 is not a path");
showDebugPath(layer_3);
showDebugPath(layer_4);
//showDebugPath(layer_4);
}
left(230)
showDebugPath(vertical_profile);
//showDebugPath(layer_3);
}
@ -283,7 +478,7 @@ module showDebugPath(path) {
assert(is_path(path),"Path to show is not a path");
assert(is_path_simple(path),"Path is not simple");
rainbow(split_path_at_self_crossings(path))
stroke($item, closed=false, width=1);
stroke($item, closed=false, width=0.2);
}
@ -334,11 +529,43 @@ function layerHeights(n, fin_thickness) =
)
[ for (i = [0 : n-1]) i * layer_height ];
/**
* Function to translate a path manually along X and Y
*/
function translate_path(path, dx, dy) =
[for (p = path) [p[0] + dx, p[1] + dy]];
// Function to print points of a path
module print_path_points(path) {
for (i = [0:len(path)-1]) {
echo(str("\t Point ", i, ": [", path[i][0], ", ", path[i][1], "]"));
}
}
echo ("**********************");
echo ("* Configuration *");
echo ("**********************");
echo ("Layers count" ,len(layers));
echo ("Base thickness" ,str(base_tickness," mm"));
echo ("Layers heights" ,layerHeights(len(layers),base_tickness/2));
echo ("Layers heights" ,layerHeights(len(layers),fin_thickness/2));