This commit is contained in:
Sébastien Dante Ursini 2025-01-21 19:41:53 -03:00
parent 63a06192a9
commit e8dde99876
4 changed files with 114 additions and 221 deletions

View File

@ -36,7 +36,6 @@
"parts": "all",
"piston_depth": "5",
"printable": "false",
"render_drill_template": "false",
"resin_escape_diameter": "4",
"scale_factor": "1",
"show_curve_points": "false",
@ -84,7 +83,6 @@
"pin_dia": "3",
"piston_depth": "5",
"printable": "true",
"render_drill_template": "false",
"resin_escape_diameter": "4",
"scale_factor": "1",
"screw_dia": "4.5",
@ -137,7 +135,6 @@
"pin_dia": "3",
"piston_depth": "5",
"printable": "true",
"render_drill_template": "false",
"resin_escape_diameter": "4",
"scale_factor": "1",
"screw_dia": "4.5",

View File

@ -154,7 +154,6 @@ draw_profile = false;
build_fin = false;
build_box = false;
build_mold = true;
render_drill_template = false;
parts = "all"; // [all, top, bottom]
@ -286,7 +285,6 @@ if ( build_box ) {
* Render Mold
*/
if ( build_mold ) buildMold();
if ( render_drill_template ) buildDrillTemplate();
module buildCompletFin() {
@ -321,25 +319,6 @@ module baseMask() {
}
/**
* Remove bottom part of the fin mold to let the box mold do the job
*
*/
module moldBottomMask(moldThickness = 3,height,angle) {
// Remove bottom part
//color("Red") cube([fin_width,base_extra_thickness,80],anchor=BACK);
deviation = opp_ang_to_adj (height,angle);
//back(moldThickness)
back(-1)
down(OFFSET)
//up(2)
color ("Blue") prismoid(
size1=[fin_width/2*1.2, moldThickness*2],
size2=[fin_width/2*1.2, moldThickness*2+ 2*deviation],
h=height+OFFSET*2
);
}
module usBoxMask() {
left(80) color("Blue") usBox(fin_base+30,thickness = box_thickness+2*OFFSET,drill=false);
@ -347,11 +326,20 @@ module usBoxMask() {
/*
module bottomSupport() {
moldHeight = 10;
moldContour = expandPath(profile,mold_extra_width);
down(moldHeight) linear_extrude (moldHeight) polygon(moldContour); // bottom support
down(moldHeight)
linear_extrude (moldHeight) polygon(moldContour); // bottom support
}
*/
module support( part ) {
moldHeight = 10;
moldContour = expandPath(profile,mold_extra_width);
down( (part == "bottom" ? 1 : 0) * moldHeight)
linear_extrude (moldHeight) polygon(moldContour); // bottom support
}
/**
@ -363,14 +351,8 @@ module buildMold() {
if (mold_part != "top") {
// Fin mold
difference() {
//union() {
difference(){
bottomSupport();
usBoxMask();
}
//moldBottomSkirt();
//};
// Remove Fin
support(part="bottom");
usBoxMask();
buildCompletFin();
}
// Box mold
@ -380,8 +362,27 @@ module buildMold() {
buildCompletFin();
}
// Mold skirt
moldBottomSkirt();
moldSkirt( part="bottom" );
}
// Top
if (mold_part != "bottom") up(80) {
difference(){
support(part="top");
usBoxMask();
buildCompletFin();
}
// Box mold
difference() {
left(80) finBoxMold( fin_base+30,part="top",skirt=false );
// Remove fin
//buildCompletFin();
}
// Mold skirt
down( fin_thickness * 3 ) moldSkirt( part="top" );
}
//up(50) buildCompletFin();
@ -410,12 +411,33 @@ module buildMold() {
*/
}
module moldBottomSkirt(){
box_profile = move([-80,0],profileUS (fin_base+30));
finAndBoxProfile = path_merge_collinear(union([box_profile,profile]));
skirt( finAndBoxProfile, moldThickness = 3 , angle = skirt_angle, moldDeep = fin_thickness );
/**
* Build the piston skirt
*
* @param part - Part could be 'top' or 'bottom'
*/
module moldSkirt( part ){
assert( part , "'part' parameter should be defined in mold skirt");
box_profile = move([-80,0],profileUS (fin_base+30));
finAndBoxProfile = path_merge_collinear(union([box_profile,profile]));
//if (part == "bottom") {
skirt( finAndBoxProfile, side = part ,moldThickness = 3 , angle = skirt_angle, moldDeep = fin_thickness );
//} else if (part == "top") {
//}
}
//moldSkirt(part="top");
module moldJunctionMask(moldThickness = 3,height,angle){
deviation = opp_ang_to_adj (height,angle);
@ -435,7 +457,7 @@ module moldJunctionMask(moldThickness = 3,height,angle){
module buildMoldSkirt( height,offset,thickness ) {
outside = expandPath(profile,offset);
inside = expandPath(profile,offset-thickness);
inside = expandPath(profile,offset-thickness);
down(height) {
// Skirt
linear_extrude (height-thick/2) difference() {
@ -456,81 +478,6 @@ module buildMoldSkirt( height,offset,thickness ) {
}
}
/**
* Mold Case
*
* @param height - Height of the case
* @param bottom - Is bottom or top
*/
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
mirror([bottom ? 0:1,0,0])
back(38) left(55)
color("Red")
up(OFFSET)
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);
}
}
/**
* Drill template
*
*/
module buildDrillTemplate() {
spacing = 38.5;
drill_depth = 15;
drill_diameter = 6;
template_height = 5;
p1 = 20;
p2 = p1-spacing;
mirror([0,0,printable ? 1 : 0]) difference() {
left(1) color ("Orange") cuboid([fin_width+7,15,10],rounding=3);
down(OFFSET) {
hull(){
left(28) cylinder(h=template_height+2*OFFSET,r=drill_diameter/2);
left(55) cylinder(h=template_height+2*OFFSET,r=drill_diameter/2);
}
hull(){
left(12) cylinder(h=template_height+2*OFFSET,r=drill_diameter/2);
left(-10) cylinder(h=template_height+2*OFFSET,r=drill_diameter/2);
}
hull(){
left(-27) cylinder(h=template_height+2*OFFSET,r=drill_diameter/2);
left(-53) cylinder(h=template_height+2*OFFSET,r=drill_diameter/2);
}
}
xrot(-90) buildFin(fin_thickness + 2*CLEARING );
//left(60) cylinder(h=20,r=6/2);
up(template_height+OFFSET)
{
left(p1)
cylinder(h=drill_depth+template_height,r=drill_diameter/2,orient=DOWN);
left(p2)
cylinder(h=drill_depth,r=drill_diameter/2,orient=DOWN);
}
}
}
// *****************
// * Bottom insert *
@ -589,108 +536,9 @@ module resin_escape(length) {
color ("Blue") cylinder(h=length, r=resin_escape_diameter/2);
}
// *****************
// * Drilling *
// *****************
module drilling(){
/*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
);
}
function addBase(path) = concat(path,[[fin_base,-base_extra_thickness],[0,-base_extra_thickness]]);
// Function to create a parallel bezier curve offset by a given amount
function offset_bezier_points(points, offset_distance, normal=[0,0,1]) =
[for (pt = points) pt + offset_distance * normal];
// Function to create multiple parallel bezier curves
function create_patch_points(base_points, width, steps=4) =
[for (i = [0:1:steps])
let(
t = i/steps,
offset = width * t
)
offset_bezier_points(base_points, offset)
];
// Create the bezier patch VNF
function make_bezier_patch_from_curve(base_points, width, length_steps=32, width_steps=8) =
let(
// Generate parallel curves to form patch
patch_points = create_patch_points(base_points, width, width_steps),
// Generate points for each curve
curves_points = [for (curve_pts = patch_points)
bezier_points(curve_pts, length_steps)
],
// Create vertices for VNF
vertices = flatten(curves_points),
// Calculate indices for faces
indices = [
for (i=[0:1:width_steps-1], j=[0:1:length_steps-1])
let(
idx00 = i*(length_steps+1) + j,
idx10 = (i+1)*(length_steps+1) + j,
idx11 = (i+1)*(length_steps+1) + (j+1),
idx01 = i*(length_steps+1) + (j+1)
)
each [[idx00, idx10, idx11, idx01]]
]
)
[vertices, indices];
if (false) {
//vnf = bezier_vnf(profile_curve_with_base, splinesteps=10);
/*
vnf = make_bezier_patch_from_curve(points, width=10);
back (100) {
cube([20,20,20]);
vnf_polyhedron(vnf);
}
*/
/*
polygon(profile_curve_with_base);
vnf2 =vnf_from_region(polygon(profile_curve_with_base));
//vnf2 = vnf_from_polygons(profile_curve_with_base, fast=true);
vnf_polyhedron(vnf2);
*/
//curve_points = bezier_curve(points,N=3, splinesteps=32);
curve_points = bezpath_curve(points,N=3, splinesteps=32);
curve_points2 = [ for(p = curve_points) [p.x, p.y, 0]]; // Offset by 1 in Z
//echo ("curve_points",curve_points);
curve_points_offset = [ for(p = curve_points) [p.x, p.y, (p.z != undef ? p.z : 0) + 1 ]]; // Offset by 1 in Z
// Combine original and offset points to form a 2D array for a simple patch
patch_points = [
curve_points,
curve_points_offset
];
//echo ("patch_points",patch_points);
//echo ("curve_points_offset",curve_points_offset);
echo ("curve_points2",curve_points2);
echo ("length curve_points2",len(curve_points2));
//vnf_5 = bezier_vnf(patch_points, caps=false, splinesteps=10);
//vnf_5 = bezier_vnf(curve_points2, splinesteps=10);
echo ("is_bezier_patch",is_bezier_patch(curve_points));
echo ("is_bezier_patch",is_bezier_patch(curve_points2));
//vnf_5 = bezier_vnf(curve_points_offset, splinesteps=10);
}
/**
* Draws a profile based on Bezier path points with optional debug visualization.

View File

@ -1,5 +1,6 @@
include <BOSL2/std.scad>;
// Constants
@ -166,18 +167,53 @@ function layerHeights(n, fin_thickness) =
* @param side - Bottom or top part of the mold
*
*/
module skirt( profile, moldThickness, angle, moldDeep, side = "bottom", heightFactor = 3 ) {
module skirt( profile, moldThickness = 4 , angle = 45 , moldDeep, side = "bottom", heightFactor = 3, clearance = 0.2 ) {
height = heightFactor * moldDeep;
echo ("height",height);
deviation = opp_ang_to_adj (height,angle);
skirtHeight = heightFactor * moldDeep;
// deviation = 3;
if ( side == "bottom" ) {
lowInt = profile;
lowExt = expandPath( lowInt , moldThickness );
highInt = expandPath( lowInt , deviation );
highExt = expandPath( lowInt , deviation + moldThickness );
difference(){
skin([lowExt , highExt ], z=[0 , skirtHeight] , slices=0);
skin([lowInt , highInt ], z=[-OFFSET , skirtHeight+OFFSET] , slices=0);
skin([lowExt , highExt ], z=[0 , height ] , slices=0);
skin([lowInt , highInt ], z=[-OFFSET , height+OFFSET ] , slices=0);
}
} else if ( side == "top" ) {
lowInt = expandPath( profile , -moldThickness );
lowExt = expandPath( profile , -clearance );
highInt = expandPath( profile , +deviation-moldThickness );
highExt = expandPath( profile , +deviation -clearance );
difference(){
skin([lowExt , highExt ], z=[0 , height ] , slices=0);
skin([lowInt , highInt ], z=[-OFFSET , height+OFFSET ] , slices=0);
}
}
}
if ( false ) {
skirt(
rect([30,30]),
moldDeep=5,
moldThickness = 3,
side="bottom"
);
up(1)
skirt(
rect([30,30]),
moldDeep=5,
moldThickness = 3,
side="top",
clearance=1
);
}

View File

@ -83,13 +83,20 @@ module usBoxMold( length, height=23, thickness = 9, moldThickness = 4,tabLength
difference() {
// Mold
{
if ( part == "bottom")
//if ( part == "bottom")
down (moldHeight/2) linear_extrude(moldHeight)
offset(r=moldThickness)
boxProfileUS( length, height );
if ( part == "top" ) {
/*
if ( part == "top")
down (moldHeight/2) linear_extrude(moldHeight)
offset(r=moldThickness)
boxProfileUS( length, height );
*/
if ( part == "top__" ) {
//baseInt = profileUS (length);
//baseInt = profileUS (length);
//topInt = offset(baseInt,delta=-deviation,chamfer=false,same_length=true);
@ -139,6 +146,11 @@ module usBoxMold( length, height=23, thickness = 9, moldThickness = 4,tabLength
}
//usBoxMold (130,part="bottom",skirt=false);
//back (30) usBoxMold (130,part="top",skirt=false);
module finBoxMold( length, finLength=-1, skirtAngle = 80, part="bottom", skirt = true) {
assert (finLength,"Missing 'finLength' parameter in finBoxMold module");