feat: .kc file format — Layer 1 (format registration) #186
Reference in New Issue
Block a user
Delete Branch "feat/kc-file-format-layer1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements Layer 1 of the .kc File Format Specification — registering
.kcas a recognized file type alongside.FCStd.What is .kc?
A
.kcfile is a strict superset of.FCStd— the same ZIP archive with an additionalsilo/directory containing Kindred platform metadata. Every.kcfile can be renamed to.FCStdand opened in vanilla FreeCAD.C++ changes
src/App/Document.cppcheckFileName()accepts.kcwithout appending.FCStdsrc/Gui/Document.cpp*.kcsrc/Gui/CommandDoc.cpp*.kcsrc/Gui/Dialogs/DlgProjectUtility.cpp*.kcPython changes
src/App/FreeCADInit.py*.kcin import type systemsrc/Mod/Create/kc_format.pysilo/ZIP entries across savessrc/Mod/Create/InitGui.pysilo/ Directory Preservation
FreeCAD's C++
saveToFile()creates a new ZIP from scratch on every save, which would lose thesilo/directory.kc_format.pysolves this with aDocumentObserver:slotStartSaveDocument: cachessilo/entries from the existing.kcfileslotFinishSaveDocument: re-injects cached entries into the newly written ZIPThis is transparent — no changes to the C++ save path.
Silo integration
Silo submodule PR: kindred/silo-mod#23
get_cad_file_path()generates.kcpaths for new filesfind_file_by_part_number()finds both.kcand.FCStd, preferring.kcsearch_local_files()lists both extensionsExisting
.FCStdfiles continue to work without any migration.