ManifoldCAD User Guide
    Preparing search index...

    Interface ExecutionContext

    Observe and control a long-running Manifold evaluation. Attach to a Manifold via Manifold.withContext(); the next eager op invoked on the result (status(), one of the refine* family, hull(), or minkowskiSum() / minkowskiDifference()) snapshots the ctx and reports progress / observes cancellation through it. Deferred ops (Boolean, transforms, batch ops) ignore any attached ctx. Safe to read/write from any thread/worker.

    Cancellation is permanent for a Manifold: once cancelled and detected, the Manifold's status becomes 'Cancelled' and stays 'Cancelled'.

    interface ExecutionContext {
        cancel(): void;
        cancelled(): boolean;
        delete(): void;
        fromMesh(mesh: Mesh): Manifold;
        levelSet(
            sdf: (point: Vec3) => number,
            bounds: Box,
            edgeLength: number,
            level?: number,
            tolerance?: number,
        ): Manifold;
        progress(): number;
        smooth(mesh: Mesh, sharpenedEdges?: readonly Smoothness[]): Manifold;
    }
    Index

    Basics

    • Frees the WASM memory of this ExecutionContext, since these cannot be garbage-collected automatically.

      Returns void

    Methods

    • Request cancellation. Can be called from any context. Idempotent.

      Returns void

    • Has cancellation been requested?

      Returns boolean

    • Like Manifold.ofMesh, observed/cancellable via this context.

      Parameters

      • mesh: Mesh

      Returns Manifold

    • Like Manifold.levelSet, observed/cancellable via this context.

      Parameters

      • sdf: (point: Vec3) => number
      • bounds: Box
      • edgeLength: number
      • Optionallevel: number
      • Optionaltolerance: number

      Returns Manifold

    • Normalized progress in [0, 1]. Monotonic within an evaluation. Returns 1 when no work has been scheduled (interpreted as trivially complete -- e.g. a single-leaf manifold has nothing to evaluate).

      Returns number