Parameters for buildSectionCaps.

interface BuildSectionCapsParams {
    capColor?: Vec3;
    capPlanes: readonly CapPlane[];
    excludeObjectIds?: ReadonlySet<string> | readonly string[];
    idPrefix?: string;
    includeObject?: (sourceObject: SceneObject) => boolean;
    includeObjectIds?: ReadonlySet<string> | readonly string[];
    layerId?: string;
    progressive?: boolean | presentations.sectionCaps.ProgressiveSpec;
    sourceModel: SceneModel;
    targetModel: SceneModel;
}

Properties

capColor?: Vec3

Optional RGB base colour applied to every emitted cap mesh's material. When omitted, each cap inherits the corresponding source mesh's effective colour (mesh color if present, else the source material's color, else a neutral mid-grey fallback). The renderer's body-hatch overlay (when the source material carried a hatchPattern, copied through to the cap material) tints from this base.

capPlanes: readonly CapPlane[]

World-space planes to cut against. Each plane produces an independent set of cap meshes per source object. Multi-plane caps respect the union clip: a cap polygon on plane A is itself trimmed against the kept half-space of every other plane before triangulation.

excludeObjectIds?: ReadonlySet<string> | readonly string[]

Optional blacklist of source SceneObject ids to skip. When supplied, objects whose id is in this collection are not capped. Combines with includeObjectIds and includeObject via AND.

idPrefix?: string

Prefix used when minting target IDs. Defaults to "cap". The full pattern is:

  • Geometry / mesh: "{idPrefix}__{sourceObjectId}__{sourceMeshId}__p{planeIndex}"
  • Material: "{idPrefix}__{sourceObjectId}__{sourceMeshId}__p{planeIndex}__mat"
  • Object: "{idPrefix}__{sourceObjectId}"

Pick a unique prefix when running the extractor multiple times into the same target model (e.g. one prefix per pass / one per cap-plane set).

includeObject?: (sourceObject: SceneObject) => boolean

Optional predicate run once per candidate source SceneObject. Return true to keep the object in the capping set, false to skip. Combines with includeObjectIds and excludeObjectIds via AND — all three must pass.

Useful for filters that don't reduce to a static id list: "whatever's visible in this View", "whatever matches this schema query", "anything not in a hidden set".

includeObjectIds?: ReadonlySet<string> | readonly string[]

Optional whitelist of source SceneObject ids to consider. When supplied, only objects whose id is in this collection are capped; everything else is skipped. Accepts an array or a Set (prefer Set for very large filter lists — membership is O(1)). Combines with excludeObjectIds and includeObject via AND.

layerId?: string

Optional ViewLayer id assigned to every emitted SceneObject. Lets the host hide, show, or style caps collectively via the named ViewLayer without touching the source model. Omit to leave each emitted object on the target SceneModel's default layer.

progressive?: boolean | presentations.sectionCaps.ProgressiveSpec

Yield to the host between batches of per-source-object createObject calls so the extractor paints progressively instead of blocking the main thread. Pass true for defaults (50 objects per batch, RAF-driven yields), or a ProgressiveSpec for finer control. Default false — synchronous, no yields.

When enabled, the function still returns a single SDKResult but only after the last source object has been processed. If the target SceneModel is destroyed mid-flight (e.g. the caller's teardown ran while a yield was outstanding), the function bails cleanly on the next batch boundary.

sourceModel: SceneModel

Source SceneModel whose SceneObjects are inspected for triangles that straddle any of the supplied capPlanes. Read-only — the function consumes its geometry but does not mutate it.

targetModel: SceneModel

Caller-owned target SceneModel into which cap geometry is emitted. One SceneObject is created per source object that has at least one cap, with one SceneMesh per (source mesh, plane) pair that produced a closed loop.

May live in the same Scene as sourceModel or in a different one — the function only reads source geometry and writes target components.

The caller creates and destroys this SceneModel. On error, partial state may have been written; the caller is responsible for tearing it down if needed.