STEP export peculiarities in KiCad 5

I recently switched to KiCad 5 and noticed a few peculiarities in the STEP export. Well, first of all, let me thank everyone involved for the STEP export being built-in — it’s a major feature that is very important for me. Most of the work I do involves tight interaction between enclosure design and electronics design.

Anyway, here’s what I noticed and I though I’d ask whether these are well-known problems:

  • .wrl models do not seem to get exported at all. I had a lot of my library parts defined using an extremely useful 1box.wrl (unit black box, easy to scale and position in the footprint editor). These are visible in the 3D view, but do not appear in the STEP output.

  • I tried defining a STEP unit black box (1box.step) and using that instead, but the net result was the same: it did not appear in the output.

  • in a board I’m working on right now, some STEP models (third-party) added in the footprint editor do not get exported. They are visible in the footprint editor, show up in 3D Viewer, but do not appear in the STEP output.

Are these well-known problems, or am I doing something wrong?

Version info:

Application: Pcbnew
Version: (5.1.6-0-10_14), release build
Libraries:
wxWidgets 3.0.4
libcurl/7.64.1 SecureTransport (LibreSSL/2.8.3) zlib/1.2.11 nghttp2/1.39.2
Platform: macOS Catalina Version 10.15.6 (Build 19G2021), 64 bit, Little endian, wxMac
Build Info:
wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
Boost: 1.72.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.54.0
Compiler: Clang 9.0.0 with C++ ABI 1002

Build settings:
USE_WX_GRAPHICS_CONTEXT=ON
USE_WX_OVERLAY=ON
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_USE_OCC=OFF
KICAD_SPICE=ON

1 Like

(and other articles in the FAQ, (Start Here) Frequently Asked Questions .)

The FAQ article doesn’t tell directly why wrl isn’t exported to step, but it should be clear from the explanation. The result isn’t really fitting for real mechanical engineering. Find a program which converts wrl to step and use that for each model. It wouldn’t make much sense to implement such bad export in KiCad.

Use the FreeCAD/StepUp combination mentioned in the FAQ. Often opening the 3rd party model with FreeCAD and exporting it to KiCad with StepUp resolves problems.

There have been some problems with step export, some have been fixed, some others may not have been fixed, and you may even have found a new bug. Using StepUp to open a board file works there, too, if the step files are valid in the first place.

It is not only the .wrl that doesn’t get exported, apparently an .STEP model either.

And some other model either, I use mostly StepUp as such I have not much experience with the native exporter.

What’s the log output from step export? If you have a bad model or problems with you board outline it may fail.

@eelik, thanks for pointing out the FAQ. It does explain why .wrl models are not exported. It doesn’t address my other two issues, though.

@halachal, the log for the current board I’m working on contains two errors about missing models. The models are there, footprint editor and 3d viewer show them correctly. I tried importing the STEP models into Fusion and re-exporting them again, which did not change anything. The log says:

    Warning: 09:17:34: /vagrant/build/kicad/src/kicad/utils/kicad2step/pcb/oce_utils.cpp: AddComponent: 588
    Warning: * no model defined for component 'JB2'
    Warning: 09:17:34: /vagrant/build/kicad/src/kicad/utils/kicad2step/pcb/oce_utils.cpp: AddComponent: 588
    Warning: * no model defined for component 'JB1'
    Info: STEP file has been created successfully.

Please take a look at how the board looks in KiCad and in the eMachineShop STEP viewer. The two battery tabs are missing, and the black 1box.step model in the upper right is present, but is not scaled in the STEP output.


I believe the box not being scaled up is intentional.
In an MCAD context, scaling models rarely makes sense (a full-size car is not a scaled compact, for example.)
This also generally holds true WRT electronics. What package is there in the wild that’s nothing more than a blown-up variant of another?

Could you link to the missing models?

1 Like

That’s right, the scaling “issue” has also been discussed back and forth, but the fact is that mechanical engineering models, i.e. STEP models, should always be 1:1 to start with.

I’m not sure if it was made clear enough, but we usually recommend using FreeCAD and StepUp workbench. You can import a STEP model there, import the KiCad footprint file, then move and rotate the model correctly and finally export it as a new STEP file + WRL file combination which is usually compatible with KiCad even if the original STEP model had problems. This way you can be sure that the models are correct, and there’s no need to scale, move or rotate anything in KiCad.

You can also import the KiCad board file there directly which sometimes works better than exporting from KiCad. You can then export it as STEP from FreeCAD if you want to use some other 3D application.


As for the missing models, show at least a screenshot of the 3D Settings tab of the footprint, and the Configure Paths window where the variables used in the 3D paths are visible.

1 Like

I remember that a user asked for a similar feature in StepUp…

Using KiCad 5.1.6

I was curious to see if I could replicate the problem with models I made in FreeCad…
None of this is a problem for me so, not looking for solutions. Just posting observations…

Models:
• My older STEP models were done WithOut exporting from StepUp. I simply exported STEP’s from FreeCad and did Not export WRL’s.

• My newer models (seven of them) were exported using StepUp, thus, having both STEP and WRL.

Using them in KiCad:
• All the STEP’s exported directly from FreeCad (not using StepUp) were recognized, used by Kicad and Exported GOOD STEP’s. All opened in FreeCad.

• All the WRL’s exported using StepUp were recognized, used by Kicad and ALL Exported BAD STEP’s (encircled in Orange).

I admit that in some cases, I made the models differently (Bodies, Parts, Boolean Union, Fuse, Compound… etc. However, in all cases, my STEP models were useable and subsequently exported Good STEP files from Kicad.
The only exception is One not baring the Colors used in design (the Toggle Switch shows Colors Correctly in 3D viewer but Not Correctly as exported STEP from Kicad. Loaded into FreeCad, Encircled with Yellow).

Additional:
The Two WRL Jumper Wires, encircled in Orange Exported STEP with the Full Wire Length. Why? Well, I scaled the WRL’s in Kicad intentionally so, was surprised the STEP’s didn’t export at the scaled value.

if you mean your ‘bad’ models will not be loaded using StepUp, probably it s just because you placed them in a different path and you confgured that path only in KiCad and NOT in FreeCad StepUp.
Please have a better insight of StepUp cheatsheet manual.

Again STEP exporters don’t scale any model because of design decision, they just replace the ‘.wrl’ extension to ‘.step’ and try to load the corresponding model (if it exists in the same path).

About the scaling…
In KiCad V3 or V4 a lot of the default models had weird scaling factors which was quite horrible and these seem to have thankfully all dissapeared, probably due to good library management and a strict 1:1 scaling rule, and I agree. All library models should be 1:1.

But not applying scaling factors on STEP export is a bug in my book.
There are good reason for a user to want to apply a scaling factor for some footprints. The wires shown above are a good example. I myself had a footprint of an Inductor with no 3D model, so I re-used an existing 3D model of a similar inductor and scaled it, which is a valid workaround for quick solutions.

The exported PCB should look the same in a CAD program as it does in the 3D viewer in KiCad itself.

No scaling was applied to Step models.
Scaling used for only WRL.
All models are in same Folder Path and correctly defined and have No problems with loading any footprints or symbols either into Kicad or StepUp.

My comment, “Exported BAD STEPs” refers to only Kicad’s exporting of Steps, not StepUp’s exporting of Steps. StepUp was Not used in the process above process, other than using it for exporting and there were no problems with that (files created and exported 6 months ago).

Please have better insight to what’s ‘posted’ under the Bold Text heading of “Using them in Kicad”, and be not so quick to defend your plugin when nothing was said or implied about StepUp.

ahahah sorry for misunderstanding your post, I’m not native English speaker :smiley:

The step exporter doesn’t build a new model, but simply assembly the board adding the 3D step models at the right position.
STEP format doesn’t support any scaling factor inside, opposite to the WRL format.
Applying a scale could be a risky path when working with mechanical integration … an alternative is to modify the model in the mechanical sw and save it with a different file name. In this way you will have a correct matching between the file name and the real mechanical dimensions, with a little cost in your designing time.

3 Likes

I created a simple Model in FreeCad (FC).

Using Gmesh App to view files:

#1 Exported it from FC as WRL
#2 Exported it from FC as STEP
Results: Both files are Good

#3 Exported it from StepUp
#4 Exported it from StepUp
Results: Step file is Good. WRL file is BAD.

If only changing the extension (as you said) then, I would expect the WRL to also exhibit the Good ability of results as did the Step.

I don’t know it … I use view3dscene as a viewer

that is strange … I mean most (all) the KiCAD 3d libraries are generated using StepUp internal export engine and I had no BAD feedback in 5 years…

This time you misunderstood me…
I said:

they just replace the ‘.wrl’ extension to ‘.step’ and try to load the corresponding model (if it exists in the same path)

then you must have a 3D step model with the same filename of the wrl model, it is not simply changing the extension but loading the file with the same name but ‘.step’ extension.

Okay, my turn for apology :wink:

If interested: Create a FreeCad model and repeat what I did. See if your viewer shows errors…

The FreeCad file (if interested):
junk.FCStd (21.7 KB)

[EDIT - FOLLOWup]
I loaded the WRL into ParaView, it looks good. Thus, Gmesh is headed for the Trash bin…

1 Like

Ok, I’m not sure I follow the discussion anymore.

To answer some of the points raised:

I believe the box not being scaled up is intentional.
In an MCAD context, scaling models rarely makes sense (a full-size car is not a scaled compact, for example.)

I very much disagree. The scaling feature was a fantastic way to quickly get a “bounding box”-style 3D model, which works well enough for mechanical design and is actually close to 100% accurate for things like atypical QFNs/DFNs or shielded inductors. It’s a lifesaver for those of us who do many things and can’t spend too much time on any single one. Also, if scaling is “officially” deprecated, then scaling options should be removed from the dialog. As it is now, they are there, they work within KiCad, show up scaled in 3D Viewer, but are not scaled for STEP export, which is inconsistent and probably not what was intended, whatever the decision on scaling.

I am not posting other screenshots, because STEP export works for all other models I use, and their footprint setup is exactly the same. The specific parts that fail are Keystone 591 battery tabs and I can’t provide the files for them, because Keystone doesn’t make them public (sigh). You have to ask to get them. Yes, I know. But it’s not my decision.

Now, some people have been pointing me towards StepUp. This is something I can’t afford: I tried it in the past, and the amount of work required to understand it, set it up and maintain it was far above what I could dedicate. I was very happy that KiCad included STEP export in the built-in release, as this is something I can (hopefully) simply start using.

1 Like

It’s always amusing when people suggest others should program something because they can’t be bothered to learn to use the solutions that already exist.

2 Likes

I understand your amusement, but also feel sympathy for JWR.

FreeCAD is getting usable, but it still has not reached version 1, and rightly so in my opinion as there are far too many loose ends that do not work properly yet. Almost half the time spent in learning FreeCAD seems to be in learning to avoid the parts that do not work properly.

I’ve made some drawings in FreeCAD over the last few years. I think I started with FreeCAD 0.14 or so (Much improvements since then). My FreeCAD drawings mostly exist of padded sketches and I can get around with it. (My biggest drawing probably has 100+ of these). I’ve tried a few times to wrap my head around the “Draft” workbench, including a few hours yesterday and it seems almost impossible to draw something dimensionally accurate. In it’s current state I’m not even sure if the Draft Workbench is usable, or a left over stub from a different era.

So, when all that is needed is a STEP export from a KiCad PCB, and this function is available in KiCad. I can not blame JWR for expecting this function to work properly and intuitively.

Scaling differences between what KiCad shows in the 3D viewer and the STEP export should not be there.

1 Like