SurfFins/lib/mold.scad

113 lines
3.9 KiB
OpenSCAD

/**
* Mold Support
*
* @param profile - Profile of the mold
* @param extraWidth - Mold Extra width
* @param height - Height of the support
* @param part - Part to provide top or bottom
*
* Bottom will be larger than the profile using extraWidth
* Top part will be the size of the profile
*/
module support( profile, extraWidth=5, height=10, part = "bottom" ) {
moldContour = expandPath(profile,extraWidth);
if ( part == "bottom" ) {
down( height )
difference() {
linear_extrude (height)
polygon( moldContour ); // bottom support
//down(1) left(40) back(30) mirror([-1,0,0]) versionMark(12);
}
} else if ( part == "top" ) {
linear_extrude (height) polygon(profile); // top support
//translate([60,30,moldHeight-1])
//mirror([0,0,0])
//versionMark(12);
}
}
/**
* Build the piston skirt top or bottom
*
* @param profile - Profile of the mold
* @param deepness - Deepness of the mold
* @param heightFactor - Factor to multiply height
* @param part - Part could be 'top' or 'bottom'
* @param angle - Opening angle
*/
module moldSkirt( profile, deepness = 10, part = "bottom", angle = 80, heightFactor = 3,thickness = 4 ){
assert( profile , "'profile' parameter should be defined in mold skirt");
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]));
//moldHeight = fin_thickness * 3;
//up (part=="top" ? height : 0 )
skirt(
profile,
moldThickness = thickness ,
angle = angle,
moldDeep = deepness,
heightFactor = heightFactor,
side = part
);
}
/**
* Make a skirt around a profile
*
* @param profile - Path ot the mold
* @param moldThickness - Thickness of the mold
* @param angle - Angle of the skirt starting from flat angle
* @param moldDeep - Mold deep. Normally height of the skirt should be 3 times the thickness of the model
* @param side - Bottom or top part of the mold
*
*/
module skirt( profile, moldThickness = 4 , angle = 45 , moldDeep, side = "bottom", heightFactor = 3, clearance = 0.2 ) {
height = heightFactor * moldDeep;
deviation = opp_ang_to_adj ( height, angle );
if ( side == "bottom" ) {
lowInt = profile;
lowExt = expandPath( lowInt , moldThickness );
highInt = expandPath( lowInt , deviation );
highExt = expandPath( lowInt , deviation + moldThickness );
difference(){
color("Brown") 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(){
color("Olive") skin([lowExt , highExt ], z=[0 , height ] , slices=0);
skin([lowInt , highInt ], z=[-OFFSET , height+OFFSET ] , slices=0);
}
}
}
/**
* Mold Mark
*
* @param name
* @param suffix
* @param version
* @param font
*
*/
module moldMark(name,suffix,version,font="Geneva",size = 18, align="right") {
linear_extrude(3) color("Orange") {
text(str(name,"[",suffix,"]"),size=size,font=font,halign=align);
fwd(size/18 * 18+1) text(str(version),size=size * (15/18),font=font,halign=align);
}
}