feat: .kc file format — Layer 1 (format registration) #186

Merged
forbes merged 1 commits from feat/kc-file-format-layer1 into main 2026-02-13 19:42:40 +00:00
Owner

Implements Layer 1 of the .kc File Format Specification — registering .kc as a recognized file type alongside .FCStd.

What is .kc?

A .kc file is a strict superset of .FCStd — the same ZIP archive with an additional silo/ directory containing Kindred platform metadata. Every .kc file can be renamed to .FCStd and opened in vanilla FreeCAD.

C++ changes

File Change
src/App/Document.cpp checkFileName() accepts .kc without appending .FCStd
src/Gui/Document.cpp Save As and Save Copy dialogs include *.kc
src/Gui/CommandDoc.cpp Merge document dialog includes *.kc
src/Gui/Dialogs/DlgProjectUtility.cpp Project utility dialog includes *.kc

Python changes

File Change
src/App/FreeCADInit.py Register *.kc in import type system
src/Mod/Create/kc_format.py New — DocumentObserver that preserves silo/ ZIP entries across saves
src/Mod/Create/InitGui.py Register kc_format observer on startup

silo/ Directory Preservation

FreeCAD's C++ saveToFile() creates a new ZIP from scratch on every save, which would lose the silo/ directory. kc_format.py solves this with a DocumentObserver:

  • slotStartSaveDocument: caches silo/ entries from the existing .kc file
  • slotFinishSaveDocument: re-injects cached entries into the newly written ZIP

This is transparent — no changes to the C++ save path.

Silo integration

Silo submodule PR: kindred/silo-mod#23

  • get_cad_file_path() generates .kc paths for new files
  • find_file_by_part_number() finds both .kc and .FCStd, preferring .kc
  • search_local_files() lists both extensions

Existing .FCStd files continue to work without any migration.

Implements Layer 1 of the [.kc File Format Specification](https://git.kindred-systems.com/kindred/create/src/branch/main/docs/KC_SPECIFICATION.md) — registering `.kc` as a recognized file type alongside `.FCStd`. ## What is .kc? A `.kc` file is a strict superset of `.FCStd` — the same ZIP archive with an additional `silo/` directory containing Kindred platform metadata. Every `.kc` file can be renamed to `.FCStd` and opened in vanilla FreeCAD. ## C++ changes | File | Change | |------|--------| | `src/App/Document.cpp` | `checkFileName()` accepts `.kc` without appending `.FCStd` | | `src/Gui/Document.cpp` | Save As and Save Copy dialogs include `*.kc` | | `src/Gui/CommandDoc.cpp` | Merge document dialog includes `*.kc` | | `src/Gui/Dialogs/DlgProjectUtility.cpp` | Project utility dialog includes `*.kc` | ## Python changes | File | Change | |------|--------| | `src/App/FreeCADInit.py` | Register `*.kc` in import type system | | `src/Mod/Create/kc_format.py` | **New** — DocumentObserver that preserves `silo/` ZIP entries across saves | | `src/Mod/Create/InitGui.py` | Register kc_format observer on startup | ## silo/ Directory Preservation FreeCAD's C++ `saveToFile()` creates a new ZIP from scratch on every save, which would lose the `silo/` directory. `kc_format.py` solves this with a `DocumentObserver`: - `slotStartSaveDocument`: caches `silo/` entries from the existing `.kc` file - `slotFinishSaveDocument`: re-injects cached entries into the newly written ZIP This is transparent — no changes to the C++ save path. ## Silo integration Silo submodule PR: https://git.kindred-systems.com/kindred/silo-mod/pulls/23 - `get_cad_file_path()` generates `.kc` paths for new files - `find_file_by_part_number()` finds both `.kc` and `.FCStd`, preferring `.kc` - `search_local_files()` lists both extensions Existing `.FCStd` files continue to work without any migration.
forbes added 1 commit 2026-02-13 19:41:34 +00:00
feat: .kc file format — Layer 1 (format registration)
All checks were successful
Build and Test / build (pull_request) Successful in 42m37s
723a8c98d5
Register .kc as a recognized file type alongside .FCStd:

C++ changes:
- Document.cpp: checkFileName() accepts .kc extension
- Gui/Document.cpp: Save As and Save Copy dialogs include *.kc
- CommandDoc.cpp: Merge document dialog includes *.kc
- DlgProjectUtility.cpp: Project utility dialog includes *.kc

Python changes:
- FreeCADInit.py: register *.kc in import type system
- kc_format.py: DocumentObserver that preserves silo/ ZIP entries
  across saves (caches before save, re-injects after save)
- InitGui.py: register kc_format observer on startup

Silo integration:
- get_cad_file_path() generates .kc paths for new files
- find_file_by_part_number() finds both .kc and .FCStd, preferring .kc
- search_local_files() lists both .kc and .FCStd files

The .kc format is a superset of .FCStd with a silo/ directory
containing Kindred platform metadata. See docs/KC_SPECIFICATION.md.
forbes merged commit ac49040ec4 into main 2026-02-13 19:42:40 +00:00
forbes deleted branch feat/kc-file-format-layer1 2026-02-13 19:42:41 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#186