3d-stuff/openscad/own/usb-c-dock-wallmount/usb-c-dock-wallmount.scad

64 lines
2.4 KiB
OpenSCAD

// by zeus - zeus@ctdo.de - CC-BY-NC-4.00
// -> https://www.thingiverse.com/zeus
// -> https://www.printables.com/social/366928-zeus/about
// -> https://github.com/zeus86
// -> https://blog.tastatursport.de/
// 2023-03-14
// USB-C-Dock-Wallmount
//##################
//
//
//##################
//
// VARS
mt=4; // general material thickness
slack=0.5; // added slack to inner dimensions to allow easier fitment
width=85.5+slack; // inner width + slack
height=96+slack; // inner height + slack
depth=31+slack; // inner depth + slack
tab=5; // width of the tabbed section on the sides, that wraps around corners
tab_b=10; // width of the tabbed section on the bottom, that wraps around corners
tab_bf=tab; // width of the tabbed section on the bottom, front only
$fn=100; // general resolution
q=0.01; // used to avoid graphical glitches
percentage=0.20; // how many % of the overall height (from the bottom) should be generated (default: 40%)
hole_offset=15; // hole-distance from bottom
holedia=4.5; // diameter of the hole for the screw
dual_hole_spacing=width/1.75; // set to 0 if you want to use a single hole
//
//##################
//
// MODEL
module base(){
difference(){
// outer cube
translate([0,0,height/2+mt])cube([width+2*mt,depth+2*mt,height+2*mt],center=true);
// inner cube
translate([0,0,height/2+mt])cube([width,depth,height],center=true);
// front cutout
translate([0,-(depth/2+mt/2),height/2+mt])cube([width-tab*2,mt+q,height-tab_bf*2],center=true);
// side cutout right
translate([+(width/2+mt/2),0,height/2+mt])cube([mt+q,depth-tab*2,height-tab_b*2],center=true);
// side cutout left
translate([-(width/2+mt/2),0,height/2+mt])cube([mt+q,depth-tab*2,height-tab_b*2],center=true);
// screwpost
for(x=[dual_hole_spacing/2,-dual_hole_spacing/2]){
translate([x,depth/2+mt/2,hole_offset]){
rotate([90,0,0]){
cylinder(r=holedia/2,h=mt+q,center=true);
translate([0,0,0.5])cylinder(r1=holedia/2,r2=holedia,h=3+q,center=true);
}
}
}
}
};
difference(){
base();
translate([0,0,(height+2*mt)/2+(height+2*mt)*percentage])cube([width+2*mt+q,depth+2*mt+q,height+2*mt],center=true);
};