Wish: 3dm file compression

I would love to see an option for saving 3dm files in a compressed format (.3dmz?), which may be as simple as reading/writing the file through zip or gzip via C#. I find that putting a 3dm file into a zip file is usually faster and has much better compression than the “Rhino.Options.Advanced.UseCompressionWhenSaving", or provides much additional compression on top of that option.

I know the usual response is “hard drive space is cheap”, but we use network file systems and routinely have GB+ size Rhino files. Reading & writing large files on a network file system can be as slow as the compression/decompression process, and large files are harder to share.

I am currently dealing with an extreme example: even with “UseCompressionWhenSaving” on, my Brep-heavy 3dm file is 1047 MB when using SaveSmall. Putting this into a Windows ZIP file gives me an archive size of 82 MB (92% reduction). GZIP gives me an archive size of 71 MB (93% reduction). For comparison: saving the 1047 MB file took 33 seconds, ZIPing it took 25 seconds, and GZIPing it took 17 seconds.

At its core, it seems like 5-10 lines of wrapping 3dm file reading & writing in a GZipStream is all that is needed, though I am sure there is additional interface updates that are needed, and maybe some inter-operability issues it might create. Gzip can also be used via C or C++ via the open zlib library or as a C++ iostreams boost library (which I think uses the zlib library).

3 Likes

Hi @Christopher_Savage,

If this is enabled, then Rhino will compress meshes and any embedded files, such as bitmaps. Nothing else in the .3dm file is compressed, as far as I can recall.

To speed up file writing to network drives, we encourage users to set Rhino.Options.FileSettings.WriteLocalTempFileWhenSaving to true. This might be the default in Rhino 8.

Probably a little optimistic. But writing a fully compressed .3dm file isn’t something we’re planning on doing in the near future. A motivated plug-in developer could probably knock this out in short order.

– Dale