How to link 3D models to personal libraries?

Continuing the discussion from Kicad 6 Beginners Guide to Personal Symbol and Footprint Libraries:

I tried creating a directory with the .3dshapes suffix and placed the step files there for my library parts via the OS in the hopes that KiCad would know to look there for the 3D models. no joy. I also tried simply copying the step files int the .pretty directory.

To be clear, I successfully followed the example linked above. My libraries are:
/my_lib.kicad_sym
/my_lib.pretty/
/my_lib.3dshapes/

What is the workflow to link the 3D shapes?

There must be a more automated workflow to add new parts to a personal library, e.g. parts from Mouser.

You need to select 3D model for each footprint individually, in the footprint properties window. There is a 3D model tab, where you can add 3D model files, change position offsets etc.

1 Like

Yes, a 3D model is explicitly linked with a footprint, it doesn’t pair by name or anything like that.

BTW, the directory names for the symbols, footprints and 3D models are arbitrary. I never understood why footprints are “pretty”. It’s just historical. I suppose it’s better than “ugly”.

1 Like

You can name things as you like – I have my libs in one dir and named like this:

In Preferences/Configure-Paths, I point to my 3dmodel lib:

Some of the 3d models I just copied out of the standard kicad stuff, and for some components I made step files in solidworks. You can use the footprint 3dviewer to select and adjust the model, or you can just edit the footprint file in a text editor and add a few lines at the end:

If the models were made at proper size and orientation, offset/scale/rotate will be the default, as above.

Sometimes I have found a model from a manufacturer that needed adjustment to work with my footprint, like this one – my first reaction, was “hmm, that’s not right”

However, with a rotation and an offset if was much better:

1 Like

Thanks for the reply.

I added the KICAD_USER_3DMODEL_DIR environment variable.

What I find confusing is that the step files are in the directory that variable points to. In the PCB editor, I can open the symbol property and the 3D model has the correct file name, 90130-3112.stp, but with the red x in the circle (file not found). I then need to manually link to that file. The model then shows the filename with the environment variable and the path. ${KICAD_USER_3DMODEL_DIR}/90130-3112.stp.

What I don’t get is why KiCad is not automatically looking in that directory. It manages to do this for the default libraries.

I am using with the property editor within footprint editor from the main menu.

I am working with connectors, which are pretty specific relationship between footprint and 3D model. The pin numbering can differ.

Because as already explained, there is no matching on the basis of name between the footprint and the 3D model. The link is manual and stored in the footprint attributes. That’s the way it is in the code.

Also, those path variables are not search paths familiar from operating system command interpreters. They are just string substitutions to make it possible for projects to be cross platform.

1 Like

Thanks for your patience. I’m just a bit flabbergasted that the library structure does not make these associations automatic.

Making these associations outside of KiCad can be done by adding the env variable to the .kcad_mod file, e.g.
model “90130-3112.stp” → model “${KICAD_USER_3DMODEL_DIR}/90130-3112.stp”

That can easily be scripted.

It seems then that the links on the KiCad libraires are hard coded for the sub directories, e.g.
model “${KICAD6_3DMODEL_DIR}/Audio_Module.3dshapes/Reverb_BTDR-1H.wrl” But those are probably generated by a script in the first place.

There’s nothing stopping you from processing your own footprints to do this. Remember that you could have multiple 3D model directory paths. Perhaps you have more than one collection.

The ones in the standard library were probably done by a librarian, just like the datasheet URLs were probably manually inserted. It only needs to be done once.

If you have suggestions about how the editing of this field could be improved, like perhaps a GUI navigator that recognises a directory prefix as a possible substitution, then feel free to put in a feature suggestion at Gitlab.

Best I know quite a lot of the KiCad libraries is generated and/or checked by scripts. It may be worth looking into them.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.