Selva Compute API Reference - v1.1.2
    Preparing search index...

    Function getThreeMeshesFromComputeResponse

    • Internal

      Extracts and processes display meshes from a ComputePointerResponse using the Grasshopper WebDisplay component.

      This is the primary entry point for extracting mesh geometry from Grasshopper compute responses. It handles all aspects of mesh processing: decompression, coordinate transformation, scaling, and positioning.

      Note: Mesh decompression happens asynchronously in a Web Worker to prevent UI blocking.

      Parameters

      • data: GrasshopperComputeResponse

        The ComputePointerResponse containing Grasshopper output trees.

      • Optionaloptions: MeshExtractionOptions

        Configuration for mesh extraction and parsing behavior. All options are optional with sensible defaults.

      Returns Promise<
          Mesh<
              BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>,
              Material | Material[],
              Object3DEventMap,
          >[],
      >

      Promise resolving to array of THREE.Mesh objects (may be empty).

      Rethrows unexpected errors after attempting to dispose any created meshes.

      • Only works with the WebDisplay component of GHHeadless.
      • Requires changes to Rhino.Compute (see https://github.com/TheVessen/compute.rhino3d).
      • Provides a performant way to display mesh data in Three.js.
      • Decompression is performed in a Web Worker for non-blocking UI updates.
      • Supports mesh metadata (names, user data) if provided in the compute response.

      Internal helper: high-level extraction remains public via visualization module, but this function is considered internal implementation detail for mesh extraction.

      // Simple usage with defaults (all processing enabled)
      const meshes = await getThreeMeshesFromComputeResponse(response);

      // With debugging enabled
      const meshes = await getThreeMeshesFromComputeResponse(response, { debug: true });

      // With advanced options
      const meshes = await getThreeMeshesFromComputeResponse(response, {
      debug: true,
      allowScaling: true,
      allowAutoPosition: false,
      parsing: {
      mergeByMaterial: false,
      applyTransforms: true,
      debug: true,
      },
      });