3D Model missing after PCB edit

Some odd behavior, probably a bug with 3d search path.

  1. I added a footprint and a STEP model to my usual directory, and associated the footprint with it. Added the path to the 3d search path, and the name of the step file in the “3d model(s)” list. Looked fine on preview.
  2. Leave the preview window, go back to the PCB.
  3. 3d model does not appear with the PCB in a 3d view.
  4. Re-open the footprint editor. 3d preview shows a blank pcb (just outline and holes)
  5. Click on “Configure Paths” - my path is still there under “3d search path”. Change nothing.
  6. Hit “OK”. The 3d model magically appears!
  7. Hit “OK”, to get back to pcbnew
  8. 3d viewer looks right, includes the part correctly
  9. Make any change to the PCB (move a different part for example)
  10. 3d model is now gone.

This is very strange, it seems to be losing the path or reference to the 3d file, even with no changes.

However, if I add a full path to the 3D Model field (using an environment variable or full path), it works properly.

It appears that there’s a bug in the “3d search path” or something related? I’d expect it to either find the step file, or not - I wouldn’t expect it to find it until the PCB changes in some unrelated way.

As usually, please tell us the Kicad version and OS.

What happens if you save your changes, exit KiCad and then restart it?
Is the path link to the file still there? Does it show then in the 3D viewer?

Apologies. Running in Windows 10.

Application: Pcbnew
Version: (5.1.6)-1, release build
Libraries:
wxWidgets 3.0.4
libcurl/7.66.0 OpenSSL/1.1.1d (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.1.1) nghttp2/1.39.2
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.71.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.66.0
Compiler: GCC 9.2.0 with C++ ABI 1013

Build settings:
USE_WX_GRAPHICS_CONTEXT=OFF
USE_WX_OVERLAY=OFF
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

Restarting KiCad makes the 3d models disappear from the PCB 3d view. The preview is also gone on the footprint properties (blank pcb with holes).

Double-clicking on the footprint, and going to the 3d tab, still shows the file in the table (not an entire path).

If I click “configure paths” and then “ok” (without changes) it does recognize the part, and restores the preview, and then the PCB renders correctly. This is as before. Seems that closing/opening is similar behavior as changing something on the pcb.

It looks like there’s a bug in the paths part. When using a complete path, even with an environment variable, it works correctly.

How are your relative paths defined?
I do not really use relative paths myself, and I think this is the intended way for KiCad.

If you look at:
KiCad / Preferences / Configure paths
Then you see something like:
image

The KICAD_USER_TEMPLATE_DIR is an “official” variable that I once used while experimenting with templates. the “KIDATASHEET” variable however, I added myself, and then in the schematic symbols I use this KIDATASHEET var as a building block to make an absolute path;

Maybe a similar way is adaptable for your personal 3D component libraries.

If you look at:
Eeschema / Help / Eeschema Manual Chapter 5.1.5 you see the KIPRJMOD environment variable, which always points to the root of the current project.

Could you tell us an example of a non complete path?

Couldn’t seem to understand the complete path.

A complete path would be something like:

${MY_FOOTPRINT_DIR}/mymodel.STEP (where MY_FOOTPRINT_DIR is of course defined as an environment variable)

or

e:\kicad stuff\mymodel.step

An incomplete path is just the filename

mymodel.step

The incomplete path (filename) should still work, because the location in the list of 3d search paths, no? And it does work - briefly - until the file is reopened or the PCB is changed.

Unfortunately, it should not. You have to always write the environment variable (${KISYS_3D}\blah) or the full path (“c:\blah\blah”)

1 Like

You use a slash here:

${MY_FOOTPRINT_DIR}/mymodel.STEP

while the slash here is backwards:

e:\kicad stuff\mymodel.step

Since Windose is backwards :slight_smile: , all your slashes should probably also be backwards, but anyway, mixing them is not a good idea.

Another thing to watch out for is whether you use a final slash in the MY_FOOTPRINT_DIR variable, to get to a final string without double, or missing (back) slashes.

Then why have the search path?

Kicad doesn’t seem to care about which kind of slash is used, but I was actually using the windows backslash in all cases.

The ending slash is not used anywhere in kicad that I’ve seen, when describing directories. It’s also not included when using the browser tool to select a folder. And it’s removed when typed manually.

KiCad probably tries to be agnostic to whether user enters slashes or back slashes, just as with dots and comma’s in numbers, and one or 2 weeks ago a bug fix for this was submitted, cause the dot and comma substitution did not always work well due to locale issues.

When debugging problems, it’s usually best to exclude possible problems by not relying on such convenience features. (Or make explicit use of them for testing purposes).

Agreed. In this case it was always the windows backslash. My hand-typing above was just done with the other slash out of habit.

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