Skip to main content

compacted

Function compacted 

Source
pub fn compacted(
    model: &Model,
    roots: &[Shape],
) -> OgeomResult<(Model, Vec<Shape>)>
Expand description

A fresh model holding only what roots reach, with the roots in it.

Every operation adds its results to a model, and one that fails or is retried leaves what it built along the way, unreachable. A long session that has run many operations carries all of that. The native format writes exactly the reachable closure of its roots, so writing and reading back is a compaction: the same shapes, same geometry, same identities for what survives, in a model with nothing else in it. Of the provenance it keeps the entries those identities name and their ancestry; the ids of the rest stay issued and resolve to nothing.

The handles come back renumbered. To compact a model and keep the handles into it, use Model::retain_reachable.

ยงErrors

As write() and read().