Skip to content

Grasshopper components: missing inputs as errors and outputs as '' or None, across all components #40

Closed

Description

@fstwn

The two faults reported for DDU_CSC_ReinforcementLayout in #32 (a missing input is an error, not a warning) and #33 (an output without a result is '' or None, not an empty tree) are not limited to that component. A scan of grasshopper_userobjects_src/ (grep, 2026-10-28; each hit still to be confirmed by reading the code) finds the same pattern in many components.

Findings

1. BuildError reported as an error, missing inputs included. These components raise BuildError for problems including missing or empty inputs, and report every BuildError with _addError:

  • DDU_CSC_Actor.py
  • DDU_CSC_ApplyFrame.py
  • DDU_CSC_Capture.py
  • DDU_CSC_ComputeFrame.py (e.g. "Input Geometry failed to collect data")
  • DDU_CSC_CreateComponentIdentity.py (same message)
  • DDU_CSC_CreateComponentSnapshot.py (same message)
  • DDU_CSC_FetchReinforcementLayout.py
  • DDU_CSC_IdentityMetadata.py
  • DDU_CSC_Origin.py
  • DDU_CSC_ReinforcementLayout.py (ReinforcementLayout: missing inputs raise an error instead of a warning #32)
  • DDU_CSC_SnapshotMetadata.py

DDU_CSC_AddEvidence.py already reports its BuildError as a warning. Other components report a missing input as a warning by hand (AssignmentPoints, ComputePCA, ComputeTSNE, ConvertGeoLocation, ...); check that DisassembleComponent and ExtrusionProfile do the same.

2. Outputs initialised as '' or None in RunScript and returned on the error paths, so the output shows <empty> or <null> instead of no data:

  • '': Actor, Capture, ComputeFrame (FrameJSON), CreateComponentIdentity, CreateComponentSnapshot, FetchAllSnapshots, FetchSnapshot, IdentityMetadata, Origin, ReinforcementLayout, SnapshotMetadata
  • None: ApplyFrame (Output, Frame), ComputeFrame (Frame, Box, Transform)

3. empty_outputs() returns None (one output) or a tuple of None (several) in 47 of 51 components. It is used for the early stop (library missing or too old, outputs just updated), so every early stop gives <null>.

Expected

The convention of the CSC components, as in DDU_CSC_AddEvidence.py:

  • A missing or empty input is a warning: the component waits for data. Real failures (bad counts, unreadable data, server errors, unexpected exceptions) stay errors.
  • An output without a result is an empty Grasshopper tree (Grasshopper.DataTree[System.Object]()), on every error path and on the early stop.

Proposed fix

  • In the shared library (grasshopper_lib/csc_gh): a missing-input error type (for example a subclass of BuildError) that the components report as a warning, and a helper that returns an empty tree (or a tuple of them for empty_outputs()).
  • Then every component above uses them. Since the user objects share a template, keep the template and the components in step.
  • The PR lists each component and what changed.

Done when

  • No component reports a missing or empty input as an error; real failures remain errors.
  • No output gives <empty> or <null> on an error path or on the early stop.
  • Tests in tests/grasshopper: the helpers, and per changed component at least one missing-input case (warning, empty output).
  • The user objects are re-exported in Rhino 8 with the release.

Supersedes the scope of #32 and #33, which stay open as the first concrete cases and close with this issue. Planned for the Grasshopper-only release 0.6.4.3.

Activity

  1. fstwn commented on Nov 4, 2026

    @fstwn
    ContributorAuthor

    Fixed in 0.6.4.4 (#53). A failed item of an item-access component keeps a null slot (decision 8.186). The component list is in the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggrasshopper-interfaceIssues regarding the GH interface

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions