KiCad will support compressed step and vrml models in the future

humm I need to check in the code… I don’t think it is volatile closing pcbnew…

I checked… the 3D cache is active and it is saved on:
“%appdata%\Local\kicad\3d”

This cache never gets cleaned… and so it could be very huge… we should need a way to clean it from inside pcbnew…

It seems that if some data is too large to roam (in “%appdata%\Roaming”), it ends up in the Local and LocalLow folders.

I am not aware if it was implemented a regular cleaning mechanism.
It will cache based on path and file modification time. If changing/update the original file, it will update the file cached. For other cases (eg rename of variable, change path, etc) it will just… grow.

My Windows 10 machine has many files in that folder dating back 6-8 months, so something has changed.

Nothing has changed on 3d caching…
Your files date is because you didn’t use a different 3D model among the one you used before…
just try to delete the content and open pcbnew 3dviewer … it will create new cache files…

As I said this is an issue on a hidden folder which is eating huge amount of disk space…

EDIT: on linux the cache is inside:
~/.cache/kicad/3d

Yes, it has been noted that KiCad doesn’t clean the 3D cache at all (https://gitlab.com/kicad/code/kicad/issues/1928). The current thinking is to move the cache into the system’s temp directory so then the system can take charge of cleaning it up.

Yes, I just measured and the Ubuntu mentioned folder have about 140MB.

That seems a bad ‘solution’ because the Temp dir has to be handled by the sw itself…

Calling GetTempPath() does nothing more than point you to a safe place to put temporary files. It’s the modern equivalent of getting the value of the environment variable PATH . The directory is never cleared automatically – you’ll often find it filled with ancient junk.

At least the actual state can easily manually cleaned.
A good solution would be to simply add a Menu to pcbnew to clean the 3D cache or an automatic check to clean files older than i.e. 6 months o similar.

1 Like

That is only the case for some OSs (mainly Windows). Linux does have processes that automatically clear the /tmp folder periodically (some on boot, others on a timer), and macOS also does this periodically. Moving them to the temp directory also exposes them to other tools that search for temp files to clear out, so they are more likely to be cleaned.

Windows is widely used, so having a partial solution would not fit the target.
Moreover it seems that even Linux doesn’t clean automatically the files in tmp dir…

/tmp directory is a directory used to hold temporary files (or session files) when application is running.

Those temporary files will be deleted automatically by application once their process is got completed.

By default /tmp directory is cleaned up only at the time of system startup or reboot.

By default applications are automatically delete their contents from this directory once their process is got completed. But some of the applications won’t do.

Hence, we need to remove those files manually but if we delete some of the live files from this directory which leads to disconnect the current session that has established.

https://www.2daygeek.com/automatically-delete-clean-up-tmp-directory-folder-contents-in-linux/

Maybe limit the cache size rather than time. And if time, it must be access time rather than creation time.

2 Likes

The cache size is depending on 3d models loaded size and limiting its size would land to an issue in case of big models…

Using access time would be the best, but also a simple delete skeduling would work to avoid caching of abandoned models. The cache would just be rebuilt on request with an almost null user impact.

Both .stpz and .wrz support has now been merged to the nightly repository.

2 Likes

Is there a plan to release the official library as .stpz files?

@Seth_h
I’m trying to test the wrz & stpz support using the nightly kicad-r17091.d122321162-x86_64-lite.exe under windows, but it seems to me that the 3d viewer and the footprint viewer are not displaying the models…
here a zipped test board with 2 compressed 3d models (configured to be found at ${KIPRJMOD} folder)
test-compressed-3d.zip (14.5 KB)
would you mind having a look at this?

It looks like you have the models referenced to ${KIPRJMOD} but you don’t have a project. So it can’t find them. I added a project file and it seems to work as expected.

test-compressed-3d.zip (3.9 KB)

Isn’t working for me either. (5.99.0-2970-g1d1a5afe0)
Do I need a cmake option or something?

(Full compressed library also isn’t displayed)

There’s no cmake option.

Does the project I attached above not work for you?

Nope.
Neither does https://github.com/chschlue/kicad-packages3D/tree/stepreduce

OK. Can you open a bug report with your KiCad version information at the bug tracker and I’ll see if I can figure out what’s going on?