KiCad and FreeCAD collaboration!

Show off your FreeCAD projects here!
User avatar
easyw-fc
Posts: 604
Joined: Thu Jul 09, 2015 9:34 am

Re: KiCad and FreeCAD collaboration!

Postby easyw-fc » Mon Mar 20, 2017 12:16 pm

realthunder wrote:Yes, solid. Not only that, the solid can optionally come from a sketch, which makes it possible to edit the PCB in FC. Doing copper feature and additionally with holes is exceptionally challenging in FC because it needs lots of 2D offset and tangential cut operation, which FC is not good at. I had to write my own extension to do the heavy lifting.



Is there a repo to test i.e. converting a kicad board with tracks like in your attached image pcb_combo?
Maurice
realthunder
Posts: 110
Joined: Tue Jan 03, 2017 10:55 am

Re: KiCad and FreeCAD collaboration!

Postby realthunder » Mon Mar 20, 2017 1:08 pm

easyw-fc wrote:Is there a repo to test i.e. converting a kicad board with tracks like in your attached image pcb_combo?

I'll add the document soon. I'm currently doing some optimization on path sorting for PCB milling. You can try my repo with any kicad_pcb file. Some pad shapes are not implemented yet, e.g. trapezoid pad. If you encounter any error, please send me your kicad_pcb file. I can try to fix it. No technical layers support yet (silkscreen and stuff), but it should be trivial to add. Here is a brief instruction.

First, you will need the latest 0.17 snapshot of FreeCAD.

Clone my repo into your freecad macro directory. After clone, cd to fcad_pcb, and checkout the submodules

Code: Select all

git submodule update --init --recursive


Start FreeCAD, in the console, the simplest usage,

Code: Select all

form fcad_pcb import kicad
pcb = kicad.KicadFcad(<full_path_to_your_kicad_pcb_file>)
pcb.makeCoppers()


You will get all copper layers as faces. The copper merges together all the pads, tracks, and zones. You can extrude those faces to solid using Part Extrude feature. Or, select the copper item in treeview, and click 'make path from shape' button in Path workbench to convert to gcode. The copper item is a Path.FeatureArea, so you can mess around with offset and stuff to get PCB milling.

You can make single copper layer by

Code: Select all

pcb.setLayer('F.Cu')
pcb.makeCopper()

You can also makePads, makeZones, makeTracks, separately.

If you want holes, add holes=True into any of the above method calls, e.g.

Code: Select all

pcb.makeCopper(holes=True)


And if you want the whole PCB board in 3D,

Code: Select all

pcb.make()

make() internally calls makePads, makeZones and makeTracks to get separate faces, and extrude them into separator solids. If you have matching step files at the same location as your vml model files, the make command will load those models as well. You can checkout my various 3dshapes repository containing the step files in github (which I used your StepUp script to generate, and also the cadquery repo, BTW :D ). If you don't have those model files, then you'll get a bare board with all the tracks, pads, and zones, with holes. Maybe that's what you want.
User avatar
easyw-fc
Posts: 604
Joined: Thu Jul 09, 2015 9:34 am

Re: KiCad and FreeCAD collaboration!

Postby easyw-fc » Fri Mar 24, 2017 5:49 pm

a quick update...
a bunch of other FreeCAD script generated models available at KiCad repo
Image
Image