Skip to content

v1.2.0 — TopologyGraph attribute store + Codable snapshot

Choose a tag to compare

@gsdali gsdali released this 05 Jun 03:17
· 98 commits to main since this release

v1.2.0 — TopologyGraph attribute store + Codable snapshot (closes #168)

MINOR — additive new public API. No breaking changes; safe to take blindly within the v1 line.

TopologyGraph nodes were bare (kind, index) pairs with no payload, and the type had no
serialization (it wraps an opaque C++ handle). This adds a pure Swift-side sidecar so callers can
attach arbitrary typed metadata to any NodeRef and round-trip a whole session. No C++ bridge
change
— the store never touches the C++ graph.

extension TopologyGraph {
    public var attributes: NodeAttributeStore
    public func attribute(_ key: String, for: NodeRef) -> AttrValue?
    public func setAttribute(_ key: String, _ value: AttrValue, for: NodeRef)
    public func snapshot() throws -> GraphSnapshot
    public convenience init(snapshot: GraphSnapshot) throws
}
  • AttrValue — closed Codable enum: bool / int / double / string / ints / doubles
    (ints for mesh-region index sets, doubles for fitted-surface params).
  • NodeAttributeStore — Codable, keyed by NodeRef; encodes as sorted arrays for
    deterministic element order. Pair with GraphSnapshot.canonicalEncoder() (.sortedKeys) for
    byte-stable, diffable output.
  • GraphSnapshot — Codable round-trip. The graph structure is re-derived by rebuilding from
    the source shape's BREP (captured at construction); rebuild pins parallel: false. A determinism
    test verifies NodeRef indexing is stable across rebuilds.
  • NodeKind / NodeRef gain Codable.

Foundation for the OCCTReconstruct mesh-to-solid
pipeline (per-node fit residual / confidence / provenance + session persistence) and OCCTMCP's
planned reconstruct_* graph read/write tools (OCCTMCP #33).

xcframework unchanged — pure Swift addition. 7 new tests; all 124 TopologyGraph tests pass.