mirror of
https://github.com/kennetek/gridfinity-rebuilt-openscad.git
synced 2024-11-23 00:40:50 +00:00
add baseplate modules
This commit is contained in:
parent
107ca358de
commit
473dc07ffa
2 changed files with 96 additions and 2 deletions
|
@ -46,3 +46,38 @@ a_tab = 36;
|
|||
|
||||
d_wall2 = r_base-r_c1-d_clear*sqrt(2);
|
||||
d_magic = -2*d_clear-2*d_wall+d_div;
|
||||
|
||||
// Baseplate constants
|
||||
|
||||
// Baseplate top part height (weigthed=false part)
|
||||
bp_h_top = 4.65;
|
||||
|
||||
// Baseplate bottom part height (part added with weigthed=true)
|
||||
bp_h_bot = 6.4;
|
||||
|
||||
// Baseplate z offset
|
||||
bp_z_offset = 0.1;
|
||||
|
||||
// Baaseplate fitting clearance
|
||||
bp_clear = 0.5;
|
||||
|
||||
// Baseplate countersink hole biggest diameter
|
||||
bp_csink_d1 = 8.5;
|
||||
|
||||
// Baseplate countersink hole height
|
||||
bp_csink_h = 2.5;
|
||||
|
||||
// Baseplate bottom cutout rectangle size
|
||||
bp_cut_size = 21.4;
|
||||
|
||||
// Baseplate bottom cutout rectangle depth
|
||||
bp_cut_depth = 4;
|
||||
|
||||
// Baseplate bottom cutout rounded thingy width
|
||||
bp_rcut_width = 8.5;
|
||||
|
||||
// Baseplate bottom cutout rounded thingy left
|
||||
bp_rcut_length = 4.25;
|
||||
|
||||
// Baseplate bottom cutout rounded thingy depth
|
||||
bp_rcut_depth = 2;
|
|
@ -79,7 +79,7 @@ module profile_base() {
|
|||
]);
|
||||
}
|
||||
|
||||
module gridfinityBase(gx, gy, l, dx, dy, style_hole) {
|
||||
module gridfinityBase(gx, gy, l, dx, dy, style_hole, block_scale=1, final_cut=true) {
|
||||
dbnxt = [for (i=[1:5]) if (abs(gx*i)%1 < 0.001 || abs(gx*i)%1 > 0.999) i];
|
||||
dbnyt = [for (i=[1:5]) if (abs(gy*i)%1 < 0.001 || abs(gy*i)%1 > 0.999) i];
|
||||
dbnx = 1/(dx==0 ? len(dbnxt) > 0 ? dbnxt[0] : 1 : round(dx));
|
||||
|
@ -91,12 +91,14 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole) {
|
|||
rounded_rectangle(xx+0.002, yy+0.002, h_bot/1.5, r_fo1/2+0.001);
|
||||
|
||||
intersection(){
|
||||
if(final_cut) {
|
||||
translate([0,0,-1])
|
||||
rounded_rectangle(xx+0.005, yy+0.005, h_base+h_bot/2*10, r_fo1/2+0.001);
|
||||
|
||||
}
|
||||
render()
|
||||
difference() {
|
||||
pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l)
|
||||
scale([block_scale,block_scale,1])
|
||||
block_base_solid(dbnx, dbny, l);
|
||||
|
||||
if (style_hole > 0)
|
||||
|
@ -138,6 +140,7 @@ module block_base_hole(style_hole) {
|
|||
}
|
||||
if (style_hole > 1)
|
||||
cylinder(h = 3*h_base, r = r_hole1, center=true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -378,6 +381,62 @@ module profile_cutter_tab(h, tab, ang) {
|
|||
|
||||
}
|
||||
|
||||
// Baseplate modules
|
||||
module baseplate(gridx, gridy, length, div_base_x, div_base_y, style_hole, weighted, bottom_cutout) {
|
||||
|
||||
scale_factor = (bp_clear / (length /100)) /100 + 1;
|
||||
|
||||
union() {
|
||||
difference(){
|
||||
rounded_rectangle(gridx*length, gridy*length, bp_h_top + bp_z_offset - 0.001, r_base);
|
||||
translate([0,0,-bp_z_offset])
|
||||
|
||||
gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, 0, scale_factor, false);
|
||||
}
|
||||
|
||||
if(weighted) {
|
||||
difference() {
|
||||
translate([0,0,-1*(bp_h_bot - bp_clear)])
|
||||
rounded_rectangle(gridx*length, gridy*length, bp_h_bot, r_base);
|
||||
|
||||
pattern_linear(gridx, gridy, length)
|
||||
union() {
|
||||
block_base_hole(style_hole);
|
||||
|
||||
//TODO Do this part inside block_base_hole as it shares everything except the
|
||||
// countersink cylinder? Maybe make an extra hole type
|
||||
if (style_hole > 2) {
|
||||
translate([0,0,-1*(bp_h_bot + bp_z_offset)])
|
||||
pattern_circular(4)
|
||||
translate([d_hole/2, d_hole/2, 0])
|
||||
cylinder(bp_csink_h, d1=bp_csink_d1, r2=r_hole1);
|
||||
}
|
||||
|
||||
if (bottom_cutout) {
|
||||
translate([0,0,-1*(bp_h_bot + bp_z_offset)])
|
||||
bottom_cutout();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module bottom_cutout(){
|
||||
union() {
|
||||
linear_extrude(bp_cut_depth)
|
||||
square(bp_cut_size, center=true);
|
||||
pattern_circular(4)
|
||||
translate([0,10,0])
|
||||
linear_extrude(bp_rcut_depth)
|
||||
union() {
|
||||
square([bp_rcut_width, bp_rcut_length], center=true);
|
||||
translate([0,bp_rcut_length/2,0])
|
||||
circle(d=bp_rcut_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ==== Utilities =====
|
||||
|
||||
function clp(x,a,b) = min(max(x,a),b);
|
||||
|
|
Loading…
Reference in a new issue