Function splitGeometryAndRebuildMeshes

  • Internal helper shared by every fix strategy that needs to split a SceneGeometry in two and fan referencing meshes onto the resulting pieces. Same supported pattern applyIFCMaterials / studio.materials.MaterialsPalette use: detach + destroy + recreate + reattach, with a snapshot of each mesh's id / matrix / opacity / parentTransform preserved across the rebuild.

    Steps:

    1. Split the source geometry via splitSceneGeometry (whole-triangle midpoint partition). Returns {fixed: false} cleanly when the predicate routes every triangle to one side (cannot make progress).
    2. Snapshot every SceneMesh that referenced the source.
    3. For each snapshot: remove from its SceneObject, destroy it, then create two new meshes ({id}_a / {id}_b) — one against each half — and reattach to the same SceneObject.
    4. Destroy the source geometry.

    Parameters

    • sceneModel: SceneModel

      SceneModel containing the source geometry.

    • geometryId: string

      Id of the source geometry to split.

    Returns SDKResult<FixApplyResult>

    SDKResult — ok: true with {fixed: boolean} flag indicating whether anything was actually split. ok: false for lifecycle / underlying SDK errors.