> For the complete documentation index, see [llms.txt](https://mrwheel-docs.gitbook.io/yappgenerator_en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mrwheel-docs.gitbook.io/yappgenerator_en/generating-stl-file-from-kicad.md).

# Generating STL file from KiCad

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!

### Tools needed

If not already done you first have to install the latest version of [FreeCAD](https://www.freecad.org/).\
Then you have to install the **`KiCadStepUp`** tool with the **`Addon Manager`**.

<figure><img src="/files/AdX9iFX68Iv2FsXtqHNQ" alt=""><figcaption></figcaption></figure>

### Creating a STEP file with KiCad

Start the **`PCB Editor`**

<figure><img src="/files/bDUU7a595MYNDbD5mLUy" alt=""><figcaption></figcaption></figure>

From the **`File`** menu select **`Export -> STEP`**

<figure><img src="/files/AqXR3Z5W8TmQ7uYzGMrx" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/PJ6UwEf7fabwFb4oXCbq" alt=""><figcaption></figcaption></figure>

### Start FreeCAD

<figure><img src="/files/FBEyV6YKrGjGTMWvCSiJ" alt=""><figcaption></figcaption></figure>

Click on the select box ..

<figure><img src="/files/aqx0h4DOpTgtHSEKxpJw" alt=""><figcaption></figcaption></figure>

.. and select the **`KiCadStepUp`** tool

<figure><img src="/files/ZdtPtEOmtcpArow3BfmS" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/ko6dOAGGUH1QpAITRpgi" alt=""><figcaption></figcaption></figure>

.. and click on **`[Open]`**

<figure><img src="/files/4BvYtV9FU0dQ9WzAc6LY" alt=""><figcaption></figcaption></figure>

After a while you see the result of this import

<figure><img src="/files/i8ubrs1BwYIn5zctJHlw" alt=""><figcaption></figcaption></figure>

Now all you have to do is **`Export`** this file

<figure><img src="/files/8d1NYIjVmUqFUyGTzqeM" alt=""><figcaption></figcaption></figure>

Select "**`STL Mesh`**" as type ..

<figure><img src="/files/iGvh07g1UISeYfWnO3wK" alt=""><figcaption></figcaption></figure>

.. and click on **`[Save]`**

The result is a nice STL file

<figure><img src="/files/ioHALJR77KoQx1ROe1QF" alt=""><figcaption></figcaption></figure>

## Use this STL file with the YAPPgenerator

Add the following code to the beginning of your **`.scad`** file:

```
myPcb = "./STL/DSMRloggerESP32_PCB.stl";

if (true)
{
  translate([42,43,4.6]) 
  {
    rotate([0,0,90]) color("darkgray") import(myPcb);
  }
}
```

**`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.

<figure><img src="/files/x9M4WN56R30MWlPzwVE3" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mrwheel-docs.gitbook.io/yappgenerator_en/generating-stl-file-from-kicad.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
