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
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.
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
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?
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…
- choose the connector from pcbnew and then
- 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.
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:
- I was working on a different schematic and board yesterday.
- The new board included ONLY components from the KiCad GitHUB libraries that were installed when I started using KiCad.
- 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.
- So I changed / exchanged the footprint by choosing it in PCBNew, and employing the Footprint Editor.
- 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.
- 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!
- 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.
- 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?
It has never happened to me.
I don’t use the github repositories for normal use. I have a copy of the libraries in my hard disk. So I can’t help in that way.
Could you send a picture of the Footprint properties->3D settings of the footprint with the issue?
That doesn’t prove anything to be honest. Solid works could simply have a more powerful wrl viewer than kicad. (But then again it is a good indicator that there is at least something there)
There is not really a global searchpath for 3d models. Every footprint sets up its own model in its “3d preferences” section.
The path setup in the footprints settings can use a path variable.
In kicad 4 the use of a path variable is implicit as it takes relative paths to be relative to whatever directory KISYS3DMOD points to. Absolute paths should however always work. (Using path variables “only” add to flexibility. But they also increase the problems you could face.)
The best way to be sure is by opening your footprint in the footprint editor. View it in the 3d viewer. If you see the 3d model there then the model is ok and the footprint is setup correctly.
If not then we can guess that either the model is not ok for use in kicad or the path is incorrect.
Lets investigate the path.
- Open the 3d preferences of the footprint (the 3d settings part of the footprint preferences dialog)
- click the add 3d shape button
- a file browser opens. Navigate to your 3d model and select it.
- double click or single left click on name followed by clicking open
- In kicad 4 if you add a model from somewhere below KISYS3DMOD the resulting path will only contain the relative part compared to that variable.
- In kicad 4 if you add one outside of where KISYS3DMOD points to you are asked if you want a relative path. (My suggestion would be to say no here as less can go wrong)
- Click ok on the 3d preferences dialog.
- Check the 3d viewer again. If you still can not see your model then there must be something wrong with the wrl file. (There are multiple standards for wrl. Only one of them is supported by kicad.)
The safest way to generate a valid wrl file is by using freecad plus kicad-stepup. (Meaning export your model as step from solidwors, import that into freecad and export valid files using stepup.)
Hello, Rene:
Thanks for working with me on this issue. There is some new information in this reply-
I should note (for the sake of anybody new to this Thread) that I am using KiCad v4.0.7 on an up-to-date Win7 Pro SP1 64-bit platform.
When reading through your reply, I tried to follow the instructions…
“Open the 3d preferences of the footprint (the 3d settings part of the footprint preferences dialog)”
It took some time to figure out that the '“footprint preferences dialog” referred to is in fact the Footprint Properties dialog (accessed via the Edit drop-down menu). [* see related footnote, at end of this Reply]
I have, In fact, been using the Footprint Properties dialog as you suggested. Last night (prior to receiving your Reply) I was continuing to grind through this problem, and discovered that one can view the PCB footprint and its associated 3d model---- independent of the PCBNew board you are creating---- using “View >>> 3D Viewer” .
That discovery was a big step in troubleshooting.
Having said that, I checked some of the 3d *.wrl models and their associated footprints I was having problems with. Viewed independently of the PCBNew project, the footprints and the *.wrl models were properly associated (but, alas, not always correctly scaled and oriented in 3d-space; the latter are details that I am not primarily concerned with in this Thread).
I also went so far as to create a dummy {footprint + *.wrl} association, created an entirely new KiCad project, a simple KiCad EEschema, and converted that into a dummy PCBNew.
At this point, I was able to autoroute the PCBnew using FreeRouting, import the *.ses Session file, and successfully view the routed board with models in place.
So far, so good…
I then fiddled around with the PCBnew project by selecting a footprint (right click; “Footprint on…” >>> Edit with Footprint Editor" .
This is when the process go sour (from my perspective). Let me elaborate:
-
If I make any edits to the Footprint in this way, save the changes using Close >> Save and Exit, and revert to PCBNew those Footprint Editor changes are NOT reflected in PCBNew when I view the entire board in 3d Viewer.
-
Returning to the Footprint >> Edit with Footprint Editor dialog, I discover that my changes have not, in fact, been saved – even though there have been no indications of any error in the SAVE process, and even though I am choosing to Edit the footprint that I am seeing locally in this particular PCBNew.
-
If, having saved the Footprint as I previously noted, I return to any of my other KiCad Projects which use this footprint, the saved changes that I made to the footprint are not reflected in the models. From all indications (paths show during the Edits), I am editing the footprint in my Custom library, which is the path to ALL of the footprints used in each of the KiCad projects where the part changes are not reflected by Footprint Editor changes.
So, what am I missing here?
[ Footnote * : From PCBNew, when selecting a Footprint using right-click, Footprint…>> Footprint Parameters brings up a dialog box titled Footprint Properties (not ‘Parameters’). I know that KiCad is a non-commercial, community project with limited development resources, but I’d say that inconsistencies in terminology such as this add steepness to the learning curve, and contribute to a lot of confusion in the Forum discussions]
I should note that I am not using the KiCad libraries on GitHUB directly. To be clear: I am using those GitHub libraries that were copied over to my hard-drive during the KiCad installation process. What I was trying to refer to in this case are libraries which I, as the end-user, did not create myself.