Today I learnt about the stepreduce project. It’s a lossless step file compression tool. What’s the reason the step files shipped with kicad aren’t processed with this tool/algorithm? I ran a quick test and it would reduce the size of the 3dmodels directory from 5GiB to 3GiB.
It also doesn’t seem to be used in the STEP export, not even when the Optimise STEP file option is selected. Post-processing the step file significantly reduces the file size.
Are there any drawbacks of compressing the files with the stepreduce algorithm?
Apparently @Seth_h can answer better. But be aware that compression usually means file compression like zip, and the mentioned process doesn’t compress, it reduces redundance in the original file so that the new version can be read as STEP without decompression. KiCad already understand zipped STEP files which are stored compressed and then decompressed when read.
Note also that the KiCad developers aren’t directly responsible for the official libraries.
“stpz” format it is the compressed version of step file already available both in kicad and FreeCAD
this is the document, followed by other CADs for: Recommended Practices for STEP File Compression
That’s exactly what general purpose compression algorithms do.
True, it doesn’t require a dedicated decompression step.
True, but that’s not the same thing. I think the zip algorithm is quite mediocre and there are multiple algorithms that perform either faster or with better compression (e.g. LZMA or zstd). As I use a compressed file system zipping individual step files would be counter-productive.
They may not be. But the step files are bundled with kicad and could be made 30% smaller by using a simple tool. And I’m just wondering why that is not done and if it may have any drawbacks I’m not aware of.
However, they are responsible for the export. And as I mentioned before, the export contains quite some redundancy as well. And it considerably shrinks when “stepreduce” is used. It then shrinks yet again after LZMA/ZIP, but that’s not what I’m talking about here.
Ok, I found two feature requests, one for using stepreduce for exported files:
And another one to compress the 3D library:
Both have been closed. So apparently there’s no point in pursuing this direction any further. However, after having read both issues —including the comments— I still have no idea what exactly the issues are with the stepreduce approach. But if I understand it correctly, there’s no issue, but there may be issues in the future and that’s why the algorithm is not used, lest to risk incompatibility of the included/exported models.