Close GH Player definition

Thank @AndyPayne

Here are my notes on what this might look like:

Developer Spec: Context Close Component
Author: David Kay (DK)
Target: Grasshopper Player & Script Editor–compiled scripts
Purpose: Enable controlled, programmatic closure of GH definitions.


Component Purpose / Behavior

  • Hold open a GH definition while waiting for a Boolean trigger.

  • Close the definition cleanly when the Boolean input becomes True.


Rationale / Motivation

Currently, Grasshopper Player and compiled GH-based plugin execution is rigid and binary:

  1. Keep Open Checked – the definition stays alive indefinitely; no programmatic closure is possible.

  2. No Context Inputs, Keep Open Unchecked – the definition runs once and exits immediately.

  3. Context Input Components Present (e.g., Number, Text, etc.), Keep Open Unchecked – the definition stays open until the last context input is entered.

    • Developers often rely on magic values (e.g., 222) as triggers, requiring manual input into the Rhino command line.

    • This approach is fragile, unintuitive, and blocks Rhino canvas selection, limiting plugin functionality.

There is currently no supported way to:

“Hold a GH definition open temporarily for interaction or processing, then close it automatically when a programmatic Boolean condition is met.”


Desired Outcome

  • Enable a clean, programmatic mechanism to keep the definition alive until a Boolean signal triggers closure.

  • Allow UI-driven or headless workflows (e.g., DKUI, Human UI) to exit gracefully without leaving residual GH documents or blocking Rhino interaction.


Implementation Note

  • This component could be based on the existing context input code, as it already provides the “hold open” behavior.

  • The main addition would be listening for a Boolean input from the GH canvas to trigger clean closure.

    • It must not block any behavior on the Rhino canvas while waiting.
  • This would make the behavior fully programmatic, eliminating the need for manual input or magic-number workarounds.

Please let me know if this is helpful and if there was anything else I could add.

Cheers

DK

3 Likes