Giter Site home page Giter Site logo

tomashubelbauer / 3mf-zip-uncompressed Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 81 KB

An experiment in seeing how no-compression ZIP file will diff in Git

Home Page: https://github.com/prusa3d/PrusaSlicer/issues/8065

Markdown 100.00%
3mf diff git store zip

3mf-zip-uncompressed's Introduction

3MF ZIP Uncompressed

This is an experiment in seeing whether repacking a 3MF OPC ZIP archive into a new archive with "store" compression (uncompressed) will make the changes to the 3MF file diffable and make the whole file a better fit for version control.

The process is as follows:

  • Start a new project in PrusaSlicer with default settings
  • Right-click the print bed and select Add Shape > Box with default dimensions
  • Save the project as box.3mf
  • Run unzip box.3mf -d box to extract the 3MF OPC ZIP into a directory box
  • Run zip -r box -0 box to create a new archive, box.zip with no compression
  • Turn off the lock next to the box properties Scale and Size
  • Scale the box up twice the size by setting 50 for its Size on the Z axis
  • Save the project again under the same name
  • Delete the box directory to not clash with the unzip command
  • Run unzip box.3mf -d box again to generate a new extraction of the project
  • Run zip -r box -0 box to update the archive with no compression

At this point, VS Code will detect the ZIP archive is a binary file and will not diff it. It can be forced to view it using the default text editor, but even in that case it will not attempt to diff it.

GitHub will show the file as binary and will not offer a way to force-diff it. It does offer a link to view the raw file, but it downloads the file instead of diffing or at least viewing it in the browser.

Since Git detects binary files not by extension, but by a slice of the file's contents, it will always reject ZIP files because their extension is binary and further textual content (due to the store compression mode) will not make a difference.

It is possible to coerce Git into viewing textual diffs of binary files, but at this point, we've strayed too far off the default path and it will give more trouble than it is worth.

The conclusion, then, is that 3MF cannot be version controlled easily even by repacking with no compression. It's best to stick with unpacking the 3MF into a directory and versioning the contents of the directory. Or to use textual STL.

3mf-zip-uncompressed's People

Contributors

tomashubelbauer avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.