Scaling Issues Exporting VRML


Hello Kicad Community,
(Using 5.0.0 Stable on Win 10)
I have been trying to get the workflow down of Exporting VRML and import into SolidWorks.
I am having Scaling Issue. I’ve searched and read alot in the topics here but all I’m only finding it StepUp, Freecad solutions, etc…
Surely there is a more direct way of doing this.

First Question:
Does the Units setting directly under “Grid Reference Point” in VRML Export Options have anything to do with Scaling? (Only has mm and inch)
If so, how does that interact with the Output Units: Setting?

I also have the option of Import Scale option in Solidworks(SW). I have mm, cm, meters, inches, feet options.

I can’t find a combination of those 3 settings that produces a properly scaled VRML model in SW.

I use STEP for alot of Mechanical things in SW and I know you can export/import that.
It Scales Properly. Unfortunately Kicad seems to Fill in interior EdgeCuts and all my Pad holes… And it doesnt look nice with Silkscreens, etc like VRML.

Back to VRML.
Here is a list that I started of the three options and results.
**I tried a bunch more combinations before I started taking notes.

My Board should be 2.992" Wide
“Grid Reference Point” Units : Output Units : SW Import Units : Result : Scale

mm : mm : mm : 1.178" (Off by 2.54)
inch : mm : cm : 11.78" (Off by 0.254)
inch : 0.1" : cm : 11.78" (Off by 0.254)
inch : 0.1" : inch : 29.92" (Off by 0.1)
inch : inch : inch : 29.92" (Off by 0.1)

Any suggestions.
I would like to document the process once I get it figured out.


wrl (vrml) is dimensionless. Meaning every application can define its own scaling factor. 1 wrl unit means 1 inch for kicad. solid works might use a different interpretation.

vrml is not really the right format to communicate with cad packages anyway.
This is why version 5 now supports step and step export. The models that come with version 5 are in both step and wrl and are already correctly scaled if you use step.

The reason for this is that step is the defacto standard for exchanging data between different cad programms. wrl is meant for programms that create nice renders. wrl approximates your geometry using a lot of triangles. This means that a round hole is no longer a round hole. (Resulting in problems for cad tools. There is no not really a well defined center of a drill any more. Not really useable for constrainds or anchor for dimensions.)


Can you report this to the bug tracker with an example project that shows the issue?


But give it here first, because it works for others (at least for me), so there may be some misunderstanding or something like that.


Also this: (It have scaling configuration that can be input from user) – Detail Description

In KiCad - Traditionally I see that VRML file are scale in 10th of an inch (Value of 10 in VRML is 1 inc). And the STEP are scale exact.


I agree with you 100%. I was just hoping I was missing something to solve the VRML scaling.
I can just Scale in SolidWorks and it is fine.
Just some info for anyone finding this later.
When set to Inch, KiCad exports the VRML file with this in file:
“scale 0.1 0.1 0.1”
When set to 0.1 Inch, it export wit with:
“scale 1 1 1”
All other Coordinates in the file are exactly the same.
SolidWorks actually gives an error when importing complaining that the “Model exceeds Dimensional Limits”.
So it may be falling back and importing at the same scale even when the VRML file has different scale values. This is why both files (0.1 inch and inch) are Off by 0.1 (or 10 times too large) when imported.

for using VRML, I will just rescale once in solidworks and everything works great.

So moving on:
I would like to get the STEP Export working now.

I get 12 errors like this when Exporting: (obviously Jenkins worked on this code :grinning:)

Warning: 12:22:51: C:/Jenkins/workspace/windows-kicad-msys2-stable/src/kicad/utils/kicad2step/pcb/oce_utils.cpp: addEdge: 1482
Warning:   * added an auxiliary segment from 185.3,-74.1 to 185.3,-74.1

And my step has cylinders where Pad Holes should be and the Center Cutout is filled in.
Picture from SolidWorks:

Here is the Project .ZIP (133.0 KB)

Its very likely the EdgeCuts Layer giving it problems. I did import it via a DXF. I have checked and all the endpoints look fine.

That looks like a cool macro tool for getting the various layers created in SolidWorks. I had seen you talk about it in another thread.


Bug #1806267 reported (with project attached)


With self-compiled latest code it works well in Kubuntu. But flatpak version 5.0.0 gives an assertion when opening the 3D view:

/run/build/kicad/3d-viewer/3d_rendering/3d_render_ogl_legacy/clayer_triangles.cpp(282): assert “aPolySet.OutlineCount() > 0” failed in AddToMiddleContourns().

Still it renders the hole in the middle of the board correctly.


I failed to mention that it does render fine in the KiCad Builtin 3D Viewer.


(EDIT: I didn’t mean to quote myself)

I’ll recompile with STEP export enabled and continue in the bug report if there’s still need.


I know you may not like to use FreeCAD & StepUp, but it works with your board like a charm :stuck_out_tongue:
I also added Tracks Layers and Silk Screen :wink:


Yes, That Looks great.
Are you using KiCad 5.0.0 or a newer nightly?

I removed all the Fillets in the EdgeCut, Exported the Step and it comes into SolidWorks Fine.
I saved a .PNG, and applied that to my model in SW.
Here is result.

Removed these Fillets.

With you able to open STEP just fine in FreeCAD, I just wonder if your KiCad version is exporting the STEP properly or if FreeCAD/StepUP handles the file better than SW?


I didn’t exported the pcbnew kicad file from KiCAD, I just opened directly the pcbnew board file in FreeCAD… from there it is possible to export the model as STEP.
StepUp is a plugin that enables FreeCAD to load directly a kicad pcb board in FreeCAD. Then you can export the model as STEP and then use it in any CAD you may choose.

that is an easy trick to have a lightweight model with tracks and Silks :slight_smile:


Sweet…, I had read forum posts about the FreeCAD/StepUP but didn’t realize that it would open up a pcbnew file directly.
I may just give that a try a little later.
I have to move on for now and get a couple more boards completed.

The PNG decal trick would be even easier if the KiCad 3D Viewer “Export PNG” Option had a way it would just Export the PNG to the size of the board instead of the whole viewport. It would also be awesome if any holes through the board used the PNG Alpha channel for transparency instead of viewport background color.
We could slap it right on the model in MCAD app without having to scale it or post process in photoshop type application.
Maybe that is an improvement that could be worked on in someone’s Spare time…:yum:
Is the 3D Viewer a completely separate source code that could be looked at?


+1 from my side


Could you report a bug for that assert? Adding the board file that generated that.


3D Viewer code is a different source-code part than Export in Pcbnew.


Could you fill a wish in launchpad for that? :slight_smile:

You can search for the use of the function OGL_GetScreenshot