Yet another kicad_pcb to STEP converter

Hi folks, this tool’s a work in progress but it’s yet another tool for converting kicad_pcb files to STEP mechanical assemblies. The basics are done and you should be able to use STEP or IGES models in the assembly.


This tool should be used in conjunction with Mario’s new 3DViewer since the model selection dialog makes it easy to get the offset and orientation of those STEP models correct, and the viewer will display the actual STEP models (no need for VRML). The STEP assembly file should appear as it does in Mario’s 3DViewer branch except no eyecandy since the output is a brute mechanical model. If the model appears differently (example: parts have the wrong orientation) not then there’s a bug for me to fix.

Mario’s branch:

You also need the (currently out-of-tree) OCE plugin to support rendering of STEP/IGES models within the new 3DViewer:

This tool is just one step towards integrating STEP Export with KiCad. Unfortunately I can’t just put this code straight into KiCad since a lot of work needs to be done on the KiCad code in order to make it easier to extend the export functions but I’d appreciate some feedback from those daring enough to build and test it. All the testing/debugging will help ensure a seamless integration with KiCad some time in the future.

This tool differs from Maurice’s StepUp tool in a number of ways:

  • It doesn’t rely on an IDF export of the board; at the moment this doesn’t mean much, but in the future as we address the issue of multiple board bodies in a design IDF will not be able to cope due to its design limitations but this tool can be updated to deal with things as they change.
  • The tool uses the 3D filename resolver code from KiCad so there’s greater flexibility in the specification of file names.
  • The tool will deal directly with IGES and STEP models - StepUP takes a VRML model name and looks for a STEP file with a similar name. This tool completely ignores VRML/X3D models. In the future the tool may provide support for IDF component outlines.

@cbernardo that’s nice! I waited so long for a direct integration :smiley:
Just one info… have you managed to build the tool and the oce plugin in windows? I’m not able to build it and I have sent some query on mailing list without any positive reply…

Just some clarification on my StepUp tools:

kicad StepUp tools don’t rely anymore on IDF, StepUp tools can load directly kicad_pcb board file and convert it to Step

kicad StepUp tools support both kicad environment path and the recently introduced alias method

with kicad StepUp users need to have a library with both STEP and VRML models, but using this method then they can display all the materials properties and eyecandy that have been improved in the new 3d-viewer that Mario @kammutierspule has developed
in this branch:
Moreover kicad StepUp can be used also with the stable release of kicad

Anyway it is good to see that oce can be integrated in kicad, and not only used inside FreeCAD… looking forward to test it in windows :smiley:

1 Like

My turn for clarifications! :slight_smile:

Using my branch + the STEP OCE plugin developed by Cirilo @cbernardo , if the step you are using have colors assigned it will render the colors with a default materials. That should be enough for most of the users if they only care about the mechanical aspects and are not producing material for marketing flyers :wink:

I experiment already some nice STEP models that have proper colors assigned. Some other models just come in grey.

Have fun!

1 Like

Unfortunately no; this is one of the big issues which need to be resolved before tools like the kicad_oce_3d plugin can be merged with the main code. From what I can find on the internet, it seems that FreeCAD is built on MSVC in windows but some people have managed to build it on MSYS. What needs to be investigated are (a) what prebuilt OCE installers are available on MSWin and (b) how do we link to the OCE libraries given that the kicad tools will be built with MSYS2. Once these issues are resolved then it won’t be difficult to put the OCE plugin into the main branch and also include the kicad_pcb->STEP tool.

Hello Everybody,

I will try to test this implementation as soon as i get it to work as I’m curious for the step file models.

So far i got one annotation an two questions:

Marios 3D viewer compiled as well as the oce_3d plugin. Yet i can’t see any model in the properties Tab of
the 3D Model window, its just pitch black. Am i missing something here ?

Is there any specific action required to make all of the three programs interact and their individual features usable ?

While i attempted to build the kicad2mcad source i ran into a lot of WxWidgets linking problems.
It might be a general problem with my system setup, but is it possible the you are using some
Wx features wich might call for a modified build of Wx ?

Thanks very much :slight_smile:

You may want have a look on this steps:

Also, as noted, try to make/install on same suggested temporary path. That is the way I am working at moment, it will make the Cirilo plugin able to be detected and work.

There is nothing special about the version of wxWidgets which we use. Maybe the plugin wasn’t copied to the correct directory? On Linux it should be in ${CMAKE_INSTALL_PREFIX}/lib/kicad/plugins/3d

Thank you for the pointing me to this post.
Both the OCE plugin and the 3d_viewer now work together an display the step models
as intended.

But i have a remark on the “preview” window.
As I’m using a step file for a connector supplied by the manufacturer i have to apply a negative
value of -32.2 on the Y axis. The value gets applied but as soon as i skip out of the Y Field the entry
disappears/ turns blank.
This effect turns up for values of any of the X Y Z Fields that are -10 and beyond.
Any positive number seems fine.
When i now enter a value in the X or Z Field the Y value gets reset to zero.
Currently i have to set the Y Value last in order to keep it in effect.
So maybe you would like to try to reproduce that effect on your machine.

Thank you

After a new git pull and some adjustments in my linker table
i could overcome the initial Wx problem just to stumble into a new error message :smiley:

It tells me about nice things like “…error: no matching function for call to…” wich is beyond my
knowledge of compiling.
In case you want to take a look i dropped the terminal output in a pastebin:

That are odd issues, could you try to make sure you build with in a clean folder?

1 Like

So i did a new bzr/git pull for oce_3D and new3d_viewer.
I build new3d_viewer exactly to your instructions including the folder
structure. And i did cmake … && make DESTDIR=/tmp/kicad install -j4 for oce_3D.
But the effect of the disappearing field value persists.

1 Like

Finally i got the kicad2mcad to compile for me with gcc/g++ 4.9

I went:

git clone && cd kicad2mcad

nano CMakeLists.txt

-> Change the line: set( CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS} " )

to: set( CMAKE_CXX_FLAGS “-Wall ${CMAKE_CXX_FLAGS} -std=c++11” )

cd build && cmake …

make DESTDIR=/tmp/kicad

The mtest excutable now i located in kicad2mcad/build/src


I haven’t used this code yet, on vacation in Korea for the next few weeks. I really want to see IGES and/or STEP file export options too. I would also like to see STEP and/or IGES part support as well since most manufacturers support and supply them directly, and they are not hard to generate with a variety of professional and open source tools! Very glad to see this happening now. I would be very willing to test on Mac and Linux distributions.

I made a fix for this. It is already applied in the main trunk and on my branch, you can try it now.
Thanks for reporting!

Hi @O_Shovah

you may consider to align the STEP model to kicad footprint using kicad
StepUp tools…

that will give you a library model aligned to the kicad library policy,
with both x,y,z offset and x,y,z angle to zero as recommended by the

Wayne Stambaugh:
I would prefer that the orientation and scaling match footprint so the user doesn’t have to change anything by default. In other words, the scaling is always 1 and the offsets and rotation angles are always 0.

Moreover the alignment would be in a MCAD environment where you can
align the model to the footprint with i.e. plain or circular constrains
as in a MCAD manner…with kicad StepUp tools you can also use FreeCAD
assembly2 WB to align the model to the footprint getting all the benefit
of MCAD constrains tools…
as someone pointed out:
“KiCad will never have a tool for checking enclosure clearance or even for checking for collisions of board components (drill hole too small for THT pin etc); that is the responsibility of the Geometry Kernel of an MCAD.”

Then your ‘MCAD aligned’ model can be used in kicad with the new STEP plugins…