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.

Awe that’s sweet.

But maybe she just wants a big hug.

I was with you Bruce up until you said

The code is quite simple actually …

Said this before, at this age remembering “The Code” for the Key Safe is the best one can hope for :laughing:

It is simple but will get more complex if it needs rounded corners.

Actually I tried to add some error checking eg if there are more switches than can physically fit on the panel but is shows a syntax error.

I have read and reread the documentation but I am buggered if I know why

She gets that anyway, she asked for this panel so she definitely wants it.

1 Like

@Bruce … I honestly think you’re damn clever … I couldn’t tackle anything like that.

I’m talking to myself!

The syntax error was such a simple thing, a capital “I” instead of a lower case “i”, I could not see it but all is sweetness and light now.

I wish it was that clever but it really isn’t, I have been programming little projects since I first got a Commodore 64 in the early 1980s, my favourite at the moment is M$ Office and VBA but OpenScad is a lot of fun for 3D printer projects. Some of the things others make with it are amazing and far above my ability.

It turned out good, This was the first attempt:

After seeing this we added a bit more border to allow for less accurate cutting of the wood the panel is mounted to.