Persistence¶
Save/Load round-trip for Tech and Shape collections.
Replaces the binary’s BSAVE / BLOAD / SAVE / LOAD /
CAT / BCAT commands using a portable JSON format that round-
trips losslessly through Python.
Schema (top-level keys are optional, all others must be present):
{
"version": 1,
"tech": { ... }, // Tech, schema below
"shapes": [ ... ] // list of Shape dicts
}
The Tech and Shape sub-schemas are derived directly from their
dataclass fields. The serializer drops empty extra dicts to keep
files readable.
- reasitic.persistence.shape_from_dict(d)[source]¶
Inverse of
shape_to_dict().
- reasitic.persistence.tech_from_dict(d)[source]¶
Inverse of
tech_to_dict().
- reasitic.persistence.save_session(path, *, tech=None, shapes=None, viewport=None)[source]¶
Save a session (tech + named shapes + optional viewport) to JSON.
- reasitic.persistence.load_session(path)[source]¶
Load a session JSON file. Returns
(tech, shapes_by_name).Use
load_viewport()to also read the optional viewport block.