KiCad will support compressed step and vrml models in the future

@Seth_h
I just tried to transform the installed kicad-packages3D-5.1.5 library to the compressed format and here the result:

kicad-packages3D-5.1.5
wrl,step
11,469 items (and 3 hidden), totalling 5.3 GB
wrl->wrz,step->stpz
11,469 items (and 3 hidden), totalling 834.9 MB

2 Likes

Compression should improve loading time from HDD for sure. Time for loading smaller size file and decompress it should be less than loading much bigger uncompressed file. As we all know small file occupy whole sector on disk so a massive numbers of files can waste some disk space as well. It will be good if Kicad could compress multiple files into one zip file, for example like jar files in java.

Hi all!
For the discussion, please also mind that the 3d viewer has its own binary cached models (not sure how it is behaving at moment) so for loading speed proposes, into 3D viewer, it only matters the first time the step /wrl/or the compressed file is loaded… After that it will use the cached file.

That would make sense only if 3D models used in a project were inside that project. Each jar file is a group of files which belong together. The 3D models library of KiCad isn’t like that. In short, it wouldn’t be useful and not worth it.

Nice, last time I used a 83MB stp model (and others) in same 3D Viewer because wasn’t possible the compressed version.
How to compress stp->stpz? (Can I just zip it and rename to the correct extension?) It is available on last Nightly?

to compress a STEP file you can use FreeCAD >= 0.18
FreeCAD can open and save .stpz compressed STEP file format.

KiCAD doesn’t have direct support for .stpz file format ATM; it will be available in version 6 later on.
ATM you can steel use a STEP compressed models through StepUp… just associate the VRML model to a kicad board and convert it with kSU.

Mainly it is a useful feature for saving disk usage…

@kammutierspule is there a way to delete the 3d cache? I think this should be addressed, considering that kicad has different versions of 3D libraries

I believe it’s in-memory cache so simple kicad restart deletes it.

It is in a specific 3d folder inside kicad profile… it will last forever there

You mean %appdata%\kicad\3d ? That folder stays empty for me, I don’t think it’s used anymore.

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