Selva Compute API Reference - v3.0.1
    Preparing search index...

    Class GrasshopperResponseProcessor

    High-level wrapper for interacting with Grasshopper Compute responses.

    This class exposes a clean, consistent API for accessing parsed values, geometry, and produced files. It is designed to be the primary interface when working with Grasshopper results in client applications.

    Index

    Constructors

    Methods

    • Decode all geometry results into Three.js meshes/lines ready for rendering. The processor's debug flag is merged with options (explicit options win).

      Requires the Selva Display Grasshopper component and the VektorNode rhino.compute branch. Three.js is loaded dynamically, so install it as a peer dependency before calling this.

      Parameters

      Returns Promise<Object3D<Object3DEventMap>[]>

      If the three.js visualization module can't load.

      const meshes = await processor.extractMeshesFromResponse();
      scene.add(...meshes);
    • Download all files generated by Grasshopper, optionally including additional user-provided files.

      Files are grouped under the specified folder name when downloaded.

      Parameters

      • folderName: string

        Name for the download directory.

      • OptionaladditionalFiles: FileBaseInfo | FileBaseInfo[] | null

        Extra files to package (single file, array, or null).

      Returns Promise<void>

      await processor.getAndDownloadFiles('gh-output');
      
      const extra = { name: 'notes.txt', data: 'Example' };
      await processor.getAndDownloadFiles('project', extra);
    • Retrieve a specific value by parameter name or ID.

      Parameters

      • selector: { byName: string } | { byId: string }

        { byName } for the human-readable name, { byId } for the parameter GUID.

      • Optionaloptions: GetValuesOptions

        Parsing configuration (e.g. disable parsing or enable Rhino).

      Returns any

      Single parsed value, array of values, or undefined if the parameter is absent.

      byId requires the VektorNode rhino.compute branch.

      const schema = processor.getValue({ byName: 'Schema' });
      const output = processor.getValue({ byId: 'a4be1c1e-23f9-4c27-b942-7f3bb2c45c6f' });
    • Extract all values in the response.

      Type Parameters

      • T = ParsedContext

        Expected structure of the return value. Defaults to a simple key/value map. (later cast as needed)

      Parameters

      • byId: boolean = false

        Key by parameter ID instead of name. Requires the VektorNode rhino.compute branch.

      • options: GetValuesOptions = {}

        Controls parsing behavior such as Rhino geometry decoding.

      Returns GetValuesResult<T>

      Parsed Grasshopper output values.

      const processor = new GrasshopperResponseProcessor(response);
      const { values } = processor.getValues();
      const { values } = processor.getValues(true); // keyed by param ID