PCB step export for 3D FDM printed stencils and jigs

PCB step export with option to uniformly widen holes and windows.

3D printing has advanced to such a stage it is possible to print stencils to perf boards and do some component fitting checks before sending off to manufacturing.

It helps if each hole, or window, slot etc can be uniformly widened by say 0.1mm before step export in PCB to allow for 3D printer nozzle width.

I did manage to do this in a roundabout way by importing gerber into flatcam and doing an isolation mill operation, but when I imported gerber back into KiCAD it had rounded the rectangular windows by adding rounded edges with the 0.1mm offset. That was OK but trying to export that new PCB as a step file takes infinite amount of computational time. So please no rounding of rectangular windows. :grinning: :grinning:

I think you’re going about this wrong. Use the gerbers to render a 2D image, then extrude that to STL. You could either edit the gerber apertures/drills, or process the render (dilation).

I don’t think this should be added to kicad, it’s a very niche usage and would just add confusion.

Thank you for the comments, but it skirts around important technical detail.
The STEP export is not a gerber operation, its a 3D operation, for 3D fitting, checking, and 3D printing.
3D printers have evolved to the point where stencils can be printed as well as usual board print and populated boards print for alignment checking.
Simple dilation would be useful feature at the point of STEP export and not through gerbers or anywhere else which would require further processing and a workflow to be documented.

You’re trying to work around a limitation of your printer by altering the 3D model export in a way that makes it less accurate. I don’t think is is a good feature, and you should instead develop your own workflow.

1 Like

For example, horizontal hole expansion could be used in your slicer to compensate.

1 Like

I agree with the above.
It’s KiCad’s job to make CAD output of objects with accurate dimensions. Post processing this data to make it fit a particular production process or CNC machine is not KiCad’s task, but the task of other programs. Flatcam can be one of them.

This might end up more confusing.

Expansion a very nice find for Cura setting - thank you.
There are two types and may be flaws if using them.

“horizontal expansion” may be deadly (as it changes board outline).
“hole horizontal expansion” is the correct dilation function for holes and windows but can become flawed as its a global function and would end up dilating every component as seen in the print outs which ends up joining windows and holes.

Passing on KiCAD workflow into 3rd party applications is bound to create these kinds of problems.
At the moment STEP export has about 10+ options.
Adding another option to globally dilate is first attempt to fix dilation issues for 3D printing, even if it is slightly flawed.
The next improvement is to add component specific dilation to paste layers so that prints render correctly on 3D printer when making stencil.
Also an option to turn off some holes and windows below certain sizes or for individual components would be a nice to have.
I know this is all far too much in reality to ask for such a small gain right now. :grinning:
May be in the future if 3D printed stencils become popular.

So for the present, with current technology and no changes, components about the size of 0603 can print OK with standard off the shelf 3D printers when making stencil.

Isn’t there an elephant in the room… um… board setup called paste clearance, which is used to enlarge or reduce stencil cutouts?

2 Likes

Ah now I see the big elephant!! :grinning:

Each pad has option to set solder paste clearance individually, which is more than good enough to create a separate copy of the KiCAD file and apply settings set to specific 3D printer in use.

Excellent thank you!

Or globally in the board setup, as I said.

BTW, how do you include paste in the STEP export anyway?
I’m still wondering why your approach would be easier than extruding the paste layers in order to print stencils (see first comment by @halachal).

There is no direct KiCAD feature for it.

The workflow is this:

  1. In KiCAD, File > Plot > Plot format:DXF (select either front or back paste layer)
  2. Open the dxf file, add border using a tool such as LibreCAD
  3. Import dxf file as board edge cuts into new KiCAD project
  4. File > Board Setup - set board thickness to 0.2mm
  5. File > Export > STEP file

Would be nice to have export stencil feature in KiCAD STEP export which exports the paste layer with edge cut layer as the border, and set the stencil thickness. :grinning:

And that workflow is less involved than, say,

  1. KiCad -> plot paste
  2. *CAD -> import, extrude, tesselate
  3. Cura or whatever -> import, slice, print

?

Edit: I have never tried to print stencils, the above is just how I would naively approach it.

Step 2 in FreeCAD doesn’t work well with dxf import with lots of holes and windows.

OpenSCAD I just try - one line code to import, extrude dxf file.
And then F6 to render, and then export as STL for Cura:

linear_extrude(height = 0.11, center = true, convexity = 10)
import (file = “filename.dxf”);

From your workflow I understand you move the paste layer to the edge- cuts layer.
Why not edit the .kicad_pcb file and replace the F.Paste by Edge_Cuts?

Yes could be done that way. But I need to add different border than PCB border for stencil so instinctively didn’t take that option.

Using board wide expansion of 50 microns for paste layer, with local expansion of 5 microns and 10 microns for QFN, micro USB and LQPF48 the results seem a lot cleaner with 0.2mm nozzle and 0.2mm thick stencil. A 0.1mm nozzle initially OK to use but increasingly harder to print without failure for some reason. Scraping 50 micron layer of stencil off the build plate is no fun at all - so given up on the idea of 0.1mm stencil for now.

I had a thought (but haven’t experimented with it so the thought might not work as well in practice…). Model the stencil larger in X and Y than the board up to as thick as the PCB material, and then pocket the board outline into the stencil leaving the desired stencil thickness in the board area. This would give the stencil a frame for rigidity (and a little easier to start lifting off the build plate) that would also index the board properly.

2 Likes

And this can also be done by moving the real outline to another layer, for example ECO1.user and drawing the desired outline on the F.Paste layer before editing the .kicad_pcb file in order to replace F.Paste by Edge.Cuts.

@SembazuruCDE’s idea is brilliant, it can be used with a multiple pcb panel too.