Generating STL file from KiCad
Last updated
Making a projectbox with all the holes in the right place is quite a challenge.
Luckily for the makers that use KiCad as a PCB making tool there is a rescue!
If not already done you first have to install the latest version of FreeCAD.
Then you have to install the KiCadStepUp tool with the Addon Manager.

Start the PCB Editor

From the File menu select Export -> STEP

In the popUp [Browse] to the map where you want to save the STEP file and click on [Export].


Click on the select box ..

.. and select the KiCadStepUp tool

Go to File->Open and select the STEP file from the KiCad Export

.. and click on [Open]

After a while you see the result of this import

Now all you have to do is Export this file

Select "STL Mesh" as type ..

.. and click on [Save]
The result is a nice STL file

Add the following code to the beginning of your .scad file:
myPcb has to point to the generated .stl file
With translate() and rotate() you can place the .stl file to the exact location of your projectbox. This is a bit fiddling in the beginning but once set it does not change anymore.

Last updated
myPcb = "./STL/DSMRloggerESP32_PCB.stl";
if (true)
{
translate([42,43,4.6])
{
rotate([0,0,90]) color("darkgray") import(myPcb);
}
}