3d-stuff/openscad/own/shelf-mounting/shelf-mounting.scad

41 lines
1.4 KiB
OpenSCAD

// shelf-mounting
// 2022-07-28 by zeus - zeus86@github.com - cc-by-sa-nc 4.0
// #############################
// vars:
mnt_w=25;
mnt_d=mnt_w;
mnt_h=mnt_w;
mnt_hole_dia=5;
countersunk=1;
mt=5;
plate_offset=5; //offset from center for the plate-facing screw
wall_offset=2.5; //offset from center for the wall-facing screw
$fn=100;
// #############################
// model:
module mountblock(){
difference(){
cube([mnt_w,mnt_d,mnt_h],center=true); //base-cube
translate([0,-mt/2,-mt/2])cube([mnt_w-2*mt+0.1,mnt_d-mt+0.1,mnt_h-mt+0.1],center=true); //cutout cube
rotate([90,0,0])translate([0,0,-mnt_d/2+mt/2])translate([0,-wall_offset,0]){
cylinder(r=mnt_hole_dia/2,h=mt+0.1,center=true); //screwhole, wall-facing
if (countersunk == 1){
translate([0,0,mt/4])cylinder(r1=mnt_hole_dia/2,r2=mnt_hole_dia,h=mt/2+0.1,center=true); //countersunk if applicable
}
}
rotate([90,0,0]){translate([0,0,plate_offset])
rotate([90,0,0])translate([0,0,-mnt_d/2+mt/2]){
cylinder(r=mnt_hole_dia/2,h=mt+0.1,center=true); //screwhole, wall-facing
if (countersunk == 1){
translate([0,0,mt/4])cylinder(r1=mnt_hole_dia/2,r2=mnt_hole_dia,h=mt/2+0.1,center=true); //countersunk if applicable
}
}
}
}
}
// #############################
// draw models:
mountblock();