Although it's not an essential part of designing PCBs, the 3D capabilities of Kicad are becoming increasingly useful.
When you're in Pcbnew laying out the board, you can easily get a 3D view of the board by selecting View
-> 3D Viewer
from the menu, or hitting Alt
+3
.
That will open the 3D viewer. The X, Y and Z buttons on the toolbar will let you rotate the model to view it from different angles:
If your board is rather flat and doesn't have any components on it, you probably don't have the Kicad 3D models installed. On Linux check for the
kicad-packages3d
package.
Not every component will have a 3D model, particularly if it's a component that you've created. See the Adding 3D Models to Your Components section below to find out how to add new 3D models for individual components.
If you want to customize the view, the Preferences
menu lets you choose things like the soldermask and silkscreen colours. If you're planning on ordering from OSHPark and want to see it in their trademark purple, you can use these OSHPark PCB colours.
If you're also designing a case, or doing similar work, and want to know how the PCB fits into the physical design then it can be useful to have a 3D model of the board.
Creating that is surprisingly simple.
In the Pcbnew program, choose File
-> Export
-> STEP...
. Choose a filename, leave everything else at the defaults, and click the Export
button.
That will generate a 3D model in the "step" format, which can then be loaded into most 3D CAD software, such as FreeCAD and Fusion360.
Sometimes, such as when you've created the component yourself, there won't be a 3D model available for all of the components on your PCB. In that case, you can create and add the relevant 3D models yourself.
We're not going to cover creating a 3D model from scratch, that would be a whole course in itself. However, you don't always need to create it. There are a few options to try:
- Check if the manufacturer of the component has created a 3D model
- See if it's available from one of the component resellers—Digikey and Mouser often have 3D models available alongside the datasheets for the component, so it's worth a look
- Try a search on GrabCAD
- If none of the above work, then you'll have to design it yourself in your favourite CAD program. If you don't have a favourite CAD program, FreeCAD is a good option because that's what the official Kicad workbench works with.
Once you've got a suitable model you need to tell Kicad how it relates to the footprint for the component in question. This lets Kicad know how to orient the model to display it in the right place when generating the 3D view.
If you're happier in Fusion360 then check out this guide to creating 3D models for Kicad in Fusion360 by Workshopshed. Otherwise, read on...
To work through the steps we'll add the 3D model to the Molex ATX connector that we created in the Making Footprints tutorial. Helpfully there's a STEP file 3D model available from Digikey page for that part, which is included here for convenience.
- Install FreeCAD if you don't already have it
- Then install the KicadStepUp workbench for FreeCAD
- Run FreeCAD, and open the model that you found or created earlier. You should have a vew like this:
- Switch to the
KiCad StepUp Wb
workbench from the workbench chooser drop-down: - Now load the Kicad footprint for your component by choosing
ksu PushPull
->ksu Load FootPrint
from the menu, and find the right.kicad_mod
file for the component footprint. That will draw the footprint in the model and add a new part in the Model browser on the left. In this case that's_Molex_44206_0007_socket__ATX_power___fp
and the footprint lines up quite well with the 3D model - Select the 3D model (not the footprint) in the Model browser on the left, and then use the X/Y/Z translate and rotate options in the
kicad StepUp tools
toolbar to move the model until it's in the right place on the footprint - Make sure you use the FreeCAD view gadget to look at the model from different angles to make sure you line things up in all axes
- When you've got it positioned correctly it will look something like this:
- Ensure the 3D model is (still) selected in the Model browser on the left, and then click the
export to kicad: STEP & scaled VRML
button in thekicad StepUp tools
toolbar: - Accept the default
Mesh Deviation
andcreaseAngle
- Pick a suitable
Material Properties
value. The Molex connectors are white, so we picked "white body" as the material - You'll then see a dialog box like this one, showing where the 3D models have been saved:
- Make a note of where the files were saved. You should probably copy them to the same folder as your footprint file is stored in.
- Close FreeCAD and run Kicad.
- Run the
Footprint Editor
- Find the footprint in the browser on the left and double-click it to load it into the editor
- Choose
Edit
->Footprint Properties...
from the menu to open the Footprint Properties dialog. Switch to the3D Settings
tab: - Click the
Select 3D Model
iconand find either the
.step
or the.wrl
model file that you save a moment ago. - You should then see the 3D model shown in the
Preview
window: - If everything looks okay, click OK to close the
Footprint Properties
dialog - Choose
File
->Save
from the menu to save the changes back to the footprint library. - Close the
Footprint Editor
and your 3D model is now ready to use. - If you've already used the footprint in one of your designs you'll need to update the footprint to load the 3D model:
- Open your existing design in
Pcbnew
- Right-click on the footprint in question and choose
Update Footprint...
Update selected footprint
should be selected. That and the other default options will be fine.- Click
Apply
to update the footprint, and thenClose
to exit the dialog. - Choose
View
->3D Viewer
in the menu to open the 3D viewer to double-check that the component now includes the 3D model!
- Open your existing design in