Tutorial - solidworks to 3D VRML/wrl or STEP/stp component

So I’ve been using KiCad for grand total of 24hours, so now is best time for noting down how I solved some of my issues.

This covers taking a model off grabcad etc. in Solidworks and generating a STEP/ stp or VRML/wrl file for 3D representation in KiCad. [Note. using STEP is preferable but is only an option for KiCad version 5 and higher (or those using the nightly builds)]


So we have an OLED display (using mm units)

This is in reply section due to limitation of only 1 picture per post

4 Likes

Step 1 - Make new assembly using component. This is to setup the co-ordinate system for export

Step 2 - Align part to match your PCB footprint (in this case pin 1) Z is up which is perpendicular to ‘front’ plane

Step 3 - Export wrl file using Options as; units in mm (maintain consistency) and VRML 97

Step 4 - In the footprint editor; edit -> edit properties the wrl file can be added (selecting no to relative paths) and the shape scale can be set to 0.3937 for X, Y & Z. You may need to rotate about the Z axis.

You should be able to view your added 3D model; view -> 3D viewer

Manual addition;

You can also directly add the 3D location and scaling to the mod file using a text editor. At the end of the file (without 3D defined) you can add the following (with your own file path and names)

  (pad 3 thru_hole oval ........
  (model M:/Data/Electronic_component_data_sheets/Custom_footprints.pretty/oled_0.96.wrl
    (at (xyz 0 0 0))
    (scale (xyz 0.3937 0.3937 0.3937))
    (rotate (xyz 0 0 0))
  )
)

Hopefully this should be useful to people wanting to add 3D models without mixing up the default librarys with custom parts.

UPDATE For those using nightly and upcoming version 5
Saving as a STEP format instead of VRML you need to make sure that the file suffix is *.STEP when exporting. As this ensures that the colour information is saved to file. You can then rename the file to *.stp which will allow you to import it into KiCad.

And then it imports without needing to apply scaling factors for mm

Using STEP you do not need to also have wrl format defined as this is generated by the KiCad internally. The advantage of using the STEP models is that you can then export the whole populated PCB in STEP format back out to use in your mechanical work.

Hi @dbrown2k welcome to KiCad!
Good step-by-step tutorial. You see, 24h working in KiCad and you are already an expert :wink:
Hopefully on the next KiCad version 5 (or if you are using the Nightly Development Builds) you can (already) import directly from STEP. Still important to cover your steps (centering the model) and export as STEP file.You will not need to add the scale factor then.
Also if you want to improve the VRML export (colors and materials), you can use the StepUp tool that converts STEPS to VRML.

1 Like

Many thanks (expert - former wet drip under pressure)

Good to see update to STEP, certainly much preferred for solid geometry.

I’ve had a look at the nightly versions. Do you know where testing feedback for STEP should be directed? My initial testing with STEP AP203 and AP214 for both solid and wire frame models are showing nothing loading in KiCad.

I am not sure how are working the nightly installers (if they are already support it on the package).
If it is not displaying the model, it should show some error message.
You can discuss the 3D STEP plugin here:

Hi @dbrown2k
if you are using the stable release (as I see from your 3D screenshot), as @kammutierspule already suggested, there are kicad StepUp tools to help in aligning the model in a mechanical environment …
here a demo video of the direct importing of the kicad footprint in mechanical CAD and aligning the 3D STEP model there… and finally export the model aligned as STEP and VRML (already scaled and with colors and material properties for nicer rendering)

this trick will allow you to convert also your kicad board and parts to a mechanical assembly

an other interesting thread about mechanical library is this

there you can also find pre-built libraries to be used out of the box with the actual kicad footprint libraries

if you are planning to use nightly builds, OCE plugin can already manage STEP models…
alignment can be done directly inside (visually) or just using kicad StepUp tools to align the model in a mechanical environment…

Exporting to a mechanical assembly can be done internally or using StepUp tools as above.

Maurice

1 Like

Hi,

Thanks for that.

I’ve moved over to the nightly build and managed to get the STEP files loading in and exporting the whole populated PCB out as a single STEP file.

As I have solidworks for work i’ll stick with that, only so many software packages I can get fluent with at one time. And electronics is not currently part of my commercial offerings.

I have updated the tutorial for those using the nightly versions and when version 5 is released.

Using STEP will simplify the number of stages to get the component models in and the completed PCB out.

Hi @dbrown2k
that OLED is exactly what I need. Do you have that model somewhere to share?
Is it the 0.96 or 1.3 version?

The model came off grab cad;

https://grabcad.com/library?utf8=✓&query=oled

but do you have footprint + 3d shape for kicad created?

Hi, if you can share the already created kicad files for this oled (footprint and 3d wrl and step files) I would really appreciate it.

Hello, and thanks for the informative tutorial.
I tried creating a simple connector, and saved it as a *.wrl file, and have gone to the Footprint Properties and added the path to the 3d Shape.
But, when I open the 3d viewer, the new connector does not appear anywhere in the field of view.

I have discovered that, even after using the Footprint Properties and “successfully” saving the footprint to the current / active library, if I…

  1. choose the connector from pcbnew and then
  2. open “Properties” of that footprint in Footprint Editor,
    the 3d shape file does not appear to be associated (is not shown) in the 3D settings tab.

What am I doing incorrectly?
Appppparrrrrrently, I need a deeper & better understanding of the “library” structure of KiCad.

You missed one step: update the footprint in the layout.

The layout has a copy of the former footprint, the one without the path to the 3D model. Update the footprint with the new version you have saved in the library.

1 Like

Pedro: Thanks for the suggestion. I am still having issues after having used the dialog panel (below…) and choosing (for the sake of completeness) to Update All Footprints.
The 3d viewer still does not show the image of the component (not even in the wrong place…I could deal with that!).
Also, even after successfully saving the Footprint which had included the link to the 3d image (as a *.wrl file), when I inspect the properties of the Footprint by choosing it from the PCBnew layout, it does not have a 3d image associated with it (even though the entire board’s footprints were Updated).

It seems a misspelling word in the path, the library, etc.

Anyway, if you want to share the footprint and the 3d model I (and anyone in the forum) can take a look to see what’s wrong.

I don’t think that mis-spelling or other typographical errors are the problem. Here is why:

  1. I was working on a different schematic and board yesterday.
  2. The new board included ONLY components from the KiCad GitHUB libraries that were installed when I started using KiCad.
  3. After my first routing, I used the 3d viewer and all the components were displayed. There, I noticed that one of the inductors (a torroidal coil) seemed huge. I had in fact chosen the wrong footprint.
  4. So I changed / exchanged the footprint by choosing it in PCBNew, and employing the Footprint Editor.
  5. The outline on the board changed, and so I moved the outline around, then did the export/import routine to apply FreeRouting. So far, so good.
  6. When I view the newly-autorouted board in “3d Viewer”, the outline is correct but the 3d shape of the torroidal inductor does not appear. Another (smaller) torroidal inductor from the same “3dshapes” folder DOES appear in the 3d view. So it seems that the PATH has been set correctly!
  7. Reverting to the PCBnew, choosing the footprint and opening the footprint in Footprint Editor, I see from the Properties that the link to the *.wrl (3d image) file is correct.
  8. I can view the *.wrl image in Solidworks—so it exists and is uncorrupted.

I am guessing—and it is only a guess— that there is some sort of bug such that, if and when the footprint is edited, there is a dangling file association (and so, a file conflict) with the old footprint’s *.wrl file… Not knowing how to resolve the conflict, KiCad’s 3d viewer chooses to display nothing at all.

Does this seem like a logical conclusion?