Preparing for a 3D Visit

Next weekend my daughter is paying a visit. She has already told me that she needs a switch panel for her project campervan. I don’t know exactly the dimensions, number of switches or how it is to be mounted but I thought I would get the basics done.

The code is quite simple actually:

// Car Type Switch Panel


// Variables

wyd = 130; //Panel width
hyt = 55;   //Panel height
thk= 2;     // Panel Thickness

//Switch dimensions

sww = 22; //Switch width
swh = 36; //Switch Height

swn = 3;  //Number of Switches 


//Calculations

gap = (wyd - (swn*sww))/(swn+1); //distance between holes and edge

// End variables

difference(){
    
    #translate([0,0,0]) panel();
 
    for (x = [1:swn]) {  
    
        translate([((gap*x)+(sww*(x-1))),(hyt-swh)/2,-1]) switch();   
    }    
    
}    

//Panel
module panel(){
    cube([wyd, hyt, thk], center= false);
}
//Switch
module switch(){
    cube([sww, swh, thk*2], center= false);
}   

The switch dimensions I got from the internet but will experiment when she gets here. It can accommodate any number of switches from 1 up but there is no error checking at the moment to see if they will fit on the panel. I will add error checking later.

All you do is change one variable (swn) to fit a different number of switches:

Switch Panel 3

Switch Panel 4

Can’t print anything yet because I don’t know exactly what is required.