Add foot option to CR_BOX

This commit is contained in:
Kienan Stewart 2025-08-05 20:53:26 -04:00
parent 6efc25d0fc
commit 9ac1747e51
1 changed files with 71 additions and 43 deletions

View File

@ -1,44 +1,72 @@
/* [Filter] */ /*
filterThiccness = 100.0; //mm
Originally by ThatDude7Piglets is licensed under the Creative Commons - Attribution - Non-Commercial - Share Alike license.
/* [Piece] */
//Length, width, height. Size of the piece including the wall thiccness https://www.thingiverse.com/thing:6072539
pieceDimensions = [150, 150, 25];
pieceWallThiccness = 1.2; //mm Additions:
bottomThiccness = 1.0; //mm * optional foot
mirrored = false; */
insideCornerStyle = 2; //[0:Cut Corner, 1:Don't cut corner, 2:Rounded corner]
/* [Filter] */
/* [OpenSCAD] [Settings] */ filterThiccness = 100.0; //mm
$fn = 100;
/* [Piece] */
module filter(filterDimensions = [100, 1000, 1000]){ //Length, width, height. Size of the piece including the wall thiccness
cube(filterDimensions); pieceDimensions = [150, 150, 25];
} pieceWallThiccness = 1.2; //mm
bottomThiccness = 1.0; //mm
mirror([mirrored? 1 : 0, 0, 0]){ mirrored = false;
difference(){ insideCornerStyle = 2; //[0:Cut Corner, 1:Don't cut corner, 2:Rounded corner]
translate([-pieceWallThiccness, -pieceWallThiccness, -bottomThiccness]){
cube(pieceDimensions); /* [OpenSCAD] [Settings] */
} $fn = 100;
#filter([filterThiccness, 1000, 1000]);
#translate([filterThiccness + pieceWallThiccness, filterThiccness, 0]){ /* [Foot] */
rotate([0, 0, -90]){ footEnable = 0; //[0:Disable, 1:Enable]
filter([filterThiccness, 1000, 1000]); footShape = 0; //[0:Cylinder, 1:Square]
} footDepth = 10; //mm
} footWidth = 54; //mm
//Corner cutter footInset = 0; //mm
if(insideCornerStyle == 0){
translate([filterThiccness + pieceWallThiccness, filterThiccness + pieceWallThiccness, -bottomThiccness]){ module filter(filterDimensions = [100, 1000, 1000]){
cube(pieceDimensions); cube(filterDimensions);
} }
}else if(insideCornerStyle == 1){
//nothing lol mirror([mirrored? 1 : 0, 0, 0]){
}else if(insideCornerStyle == 2){ difference(){
radius = pieceDimensions.x - (filterThiccness + pieceWallThiccness); translate([-pieceWallThiccness, -pieceWallThiccness, -bottomThiccness]){
#translate([pieceDimensions.x, pieceDimensions.y, -bottomThiccness]){ cube(pieceDimensions);
cylinder(r=radius, h=pieceDimensions.z); }
} #filter([filterThiccness, 1000, 1000]);
} #translate([filterThiccness + pieceWallThiccness, filterThiccness, 0]){
} rotate([0, 0, -90]){
filter([filterThiccness, 1000, 1000]);
}
}
//Corner cutter
if(insideCornerStyle == 0){
translate([filterThiccness + pieceWallThiccness, filterThiccness + pieceWallThiccness, -bottomThiccness]){
cube(pieceDimensions);
}
}else if(insideCornerStyle == 1){
//nothing lol
}else if(insideCornerStyle == 2){
radius = pieceDimensions.x - (filterThiccness + pieceWallThiccness);
#translate([pieceDimensions.x, pieceDimensions.y, -bottomThiccness]){
cylinder(r=radius, h=pieceDimensions.z);
}
}
}
if(footEnable == 1) {
translate([pieceDimensions[0]/2 - footInset, pieceDimensions[1]/2 - footInset, -footDepth/2 - pieceWallThiccness]) {
if (footShape == 0) {
cylinder(footDepth, footWidth, footWidth, center=true);
}
else {
cube([footWidth*2, footWidth*2, footDepth], center=true);
}
}
}
} }