KiCad and 3D Models (5)


// dimensions in mm
 
a=7.0;
b=7.0;
c=13.5-(5.8+1.8+3.9);

h1=1.8;
r1=25.4/4/2;

h2=5.8;
r2=r1*0.9;
 
xoff=a/2;
yoff=b/2;
  
nx=2;
ny=2;
gx=5.08;
gy=gx;
k=1.02;
k2=1.25/2;
h=3.9;
 
xoffset=(a-gx*(nx-1)-k2)/2;
yoffset=(b-gy*(ny-1)-k2)/2;
  
cube([a, b, c]);
  
translate([xoff,yoff,c])
        cylinder(h1, r1, r1, false,$fn=13);

difference() {
translate([xoff,yoff,c+h1])
        cylinder(h2, r2, r2, false,$fn=18);

translate([xoff,yoff,c+h1+h2*0.8])
        cylinder(h2*0.3, r2*0.9, r2*0.9, false,$fn=18);
}
 
for (x=[0:nx-1]) {
    for (y=[0:ny-1]) {
    translate([xoffset+gx*x,yoffset+gy*y,-h])
        cube([k, k, h]);
    }
}

translate([xoff, yoff, -h])
cylinder(h, k2, k2, false, $fn=20);

KiCad and 3D Models (4)

Here is a toggle switch.

Not very exact, but may suffice for my purposes.

// dimensions in inches

a=0.450;
b=0.500;
c=0.3350+0.060;
h1=0.350;
h2=0.410;
r1=0.25/2;
r2=0.115/2;

xoff=a/2;
yoff=b/2;
 
nx=2;
ny=3;
gx=0.190;
gy=0.185;
k=0.073/2;
h=0.201;

xoffset=(a-gx*(nx-1))/2;
yoffset=(b-gy*(ny-1))/2;
 
cube([a, b, c]);
 
translate([xoff,yoff,c])
        cylinder(h1, r1, r1, false,$fn=16);

translate([xoff,yoff,c+h1*0.9]) {
        rotate(30,[1,0,0])
        cylinder(h2, r2, r2, false,$fn=10);
 
}

for (x=[0:nx-1]) {
    for (y=[0:ny-1]) {
    translate([xoffset+gx*x,yoffset+gy*y,-h])
        cylinder(h, k, k, false);
    }
}

KiCad and 3D Models (3)

Designing a 3D model is much easier with OpenSCAD rather than, say, FreeCAD.

Here is TAK-5 Frequency Mixer with which you wish to make a model.

Just copy some of the physical parameters into your source code, and then write a very short program.

VoilĂ !

// dimensions in inches
b=0.800;a
d=0.210;
f=0.400;
g=0.200;
h=0.20;
k=0.031;
nx=2;
ny=4;
xoffset=(f-g*(nx-1))/2;
yoffset=(b-g*(ny-1))/2;

cube([f,b,d]);

for (x=[0:nx-1]) {
    for (y=[0:ny-1]) {
    translate([xoffset+g*x,yoffset+g*y,-h])
        cylinder(h, k, k, false);
    }
}

KiCad and 3D Models

With a very simple procedure, you can create your own 3D models for KiCad.

First, you design your model with OpenSCAD and export an STL file.

Second, you convert the STL file from text to binary using MeshLab.

Finally, you import the binary STL file into Wings3D and export a VRML file, which will be referenced by KiCad as your 3D model.

Use Footprint Editor, and set Footprint Properties with the tab 3D settings to specify your VRML file.