Function removeAttachedMaterials

  • Inverse of applyIFCMaterials: detaches every SceneMesh from the SceneModel's _attached_* materials, destroys those materials and the textures they own, and rebuilds the meshes with their original per-mesh color restored.

    Same detach + destroy + recreate + reattach pattern as applyIFCMaterials, run in reverse: applyIFCMaterials snapshots color through its round-trip so the original mesh colour survives the apply, and this function pulls that colour out of each live SceneMesh on its way back through. A pristine reload of the model isn't required to recover the loaded look.

    Idempotent: a SceneModel that never had applyIFCMaterials run over it is left untouched (no _attached_* resources to find).

    Parameters

    • params: {
          onProgress?: (p: LoaderProgress) => void;
          sceneModel: SceneModel;
          signal?: AbortSignal;
      }
      • OptionalonProgress?: (p: LoaderProgress) => void

        Optional progress callback fired between phases and at intervals during the per-object loops. Same LoaderProgress shape the SDK's loaders use.

      • sceneModel: SceneModel

        SceneModel to strip materials from.

      • Optionalsignal?: AbortSignal

        Optional AbortSignal. When aborted, the function throws AbortError from the next yieldToHost checkpoint.

    Returns Promise<SDKResult<void>>

    • {ok: true} when the rebuild completes — the SceneModel now carries colour-only meshes again and the _attached_* materials and textures are gone.
      • {ok: false} propagating the first SceneModel failure encountered (mesh-create / mesh-destroy / addMesh).