3d-stuff/openscad/own/wallplate-lightsocket/wallplate-lightsocket.scad

84 lines
2.3 KiB
OpenSCAD

// wallplate lightsocket
// coverplate with mounting option for german light-sockets/outlets in walls ("Lampendose")
// by zeus - 2022-08-27 - cc-by-nc-sa-4.0
// https://git.kostianix.de/zeus/3d-stuff/openscad/own/
// ####
// VARS:
$fn=75;
mt=3;
// baseplate:
dia_x=70;
dia_y=70;
hole_dia=5;
hole_dist=57.5;
hole_center_dia=35;
hole_y_offset=-5; // negative for downwards
hole_x_offset=0;
hole_tilt=-25; // in degrees, negative for CW
// mountingblock
mb_x=40;
mb_y=4; // cnc-kitchen brass-inserts (m4-short) height
mb_z=10;
mb_hole_dia=5.5+0.25; // use the dia of brass-inserts if possible. h=4 and d=5.5 is default for the ones from cnc-kitchen (M4, short).
mb_hole_dist=30;
mb_block_dist=50; //(outer distance!)
// box
box_mt=2;
box_x=mb_x+(2*box_mt)+1;
box_y=mb_block_dist+(2*box_mt)+1;
box_z=mb_z+box_mt+1;
box_hole_dia=4.25;
// ####
// MODEL:
module block(){
difference(){
cube([mb_x,mb_y,mb_z],center=true);
for(x=[-mb_hole_dist/2,mb_hole_dist/2]){
translate([x,0,0]){
rotate([90,0,0])cylinder(d=mb_hole_dia,h=mb_y+0.1,center=true);
}
}
}
}
module baseplate(){
difference(){
// baseplate
linear_extrude(mt)scale([1,dia_y/dia_x,1])circle(d=dia_x,$fn=250);
// mounting holes
rotate([0,0,hole_tilt]){
for(x=[-hole_dist/2,hole_dist/2]){
translate([x+hole_x_offset,hole_y_offset,mt/2]){
cylinder(d=hole_dia,h=mt+0.1,center=true);
translate([0,0,mt/4])cylinder(d1=hole_dia,d2=hole_dia*1.5,h=mt/2+0.1,center=true);
}
}
}
translate([0,0,mt/2])cylinder(d=hole_center_dia,h=mt+0.1,center=true);
}
}
module box_blind(){
difference(){
cube([box_x,box_y,box_z],center=true);
translate([0,0,-box_mt/2-0.1])cube([box_x-(2*box_mt),box_y-(2*box_mt),box_z-(1*box_mt)],center=true);
for(x=[-mb_hole_dist/2,mb_hole_dist/2]){
translate([x,0,-(box_z/2)+mb_z/2]){
rotate([90,0,0])cylinder(d=box_hole_dia,h=box_y+0.1,center=true);
}
}
}
}
// ####
// DRAW MODELS:
baseplate();
for(y=[-mb_block_dist/2+mb_y/2,mb_block_dist/2-mb_y/2])translate([0,y,mb_z/2+mt])block();
//rotate([0,0,0])translate([0,0,box_z/2+mt+50])box_blind();