### Grasshopper API: Simple Parameters (VB.NET) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/4306b177-1bf1-41bc-ac0e-2f6869d02365 Explains how to define and manage parameters for Grasshopper components using Visual Basic .NET. This example covers input and output parameter setup. ```vb.net ' Placeholder for Simple Parameters (VB) code snippet ``` -------------------------------- ### GH_State.Data Property (Guid) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_Grasshopper_Kernel_GH_State_Data Gets the state data stored under the specified ID. ```APIDOC ## GH_State.Data Property (Guid) ### Description Gets the state data stored under the specified ID. ### Method GET (Conceptual - This is a property access, not a typical HTTP endpoint) ### Endpoint N/A (Class Property) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } ``` ### Response #### Success Response (200) - **Data** (String) - The state data associated with the provided ID. #### Response Example ```json { "Data": "Example State Data" } ``` ``` -------------------------------- ### Simple Component Creation (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/a367a8b3-a8b6-4d92-ad15-00b5aa60fd48 Demonstrates the basic structure for creating a new component in Grasshopper using C#. This involves defining inputs, outputs, and the SolveInstance method. No external dependencies are required beyond the Rhino/Grasshopper SDK. ```csharp using Grasshopper.Kernel; using Rhino.Geometry; public class SimpleComponent : GH_Component { public SimpleComponent() : base("Simple Component", "SC", "A basic Grasshopper component", "Examples", "Simple") { } protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) { pManager.AddNumberParameter("Input", "I", "An input number", GH_ParamAccess.item); } protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { pManager.AddNumberParameter("Output", "O", "An output number", GH_ParamAccess.item); } protected override void SolveInstance(IGH_DataAccess DA) { double input = 0; if (!DA.GetData(0, ref input)) { // Handle error return; } double output = input * 2; DA.SetData(0, output); } public override GH_Exposure Exposure { get { return GH_Exposure.primary; } } } ``` -------------------------------- ### Example: Get Grasshopper Editor Visibility (VBScript) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_Plugin_GH_RhinoScriptInterface_IsEditorVisible This VBScript example demonstrates how to get the Grasshopper plugin object and then call the IsEditorVisible method to check the visibility of the Grasshopper editor window. The result is printed to the Rhino command line. ```vbscript Sub GrasshopperExampleScript() Dim GH Set GH = Rhino.GetPlugInObject("Grasshopper") Call Rhino.Print("Grasshopper Editor Visible: " & GH.IsEditorVisible()) Set GH = Nothing End Sub ``` -------------------------------- ### GH_ColourPickerBase.SetupColourPicker Method Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_GUI_Base_GH_ColourPickerBase_SetupColourPicker Sets up all UI elements for the color picker. ```APIDOC ## GH_ColourPickerBase.SetupColourPicker Method ### Description Sets up all UI elements for the color picker. ### Method `void` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "col0": "System.Drawing.Color", "col1": "Point4d", "space": "Grasshopper.GUI.Base.GH_ColourSpace" } ``` ### Response #### Success Response (200) This method does not return a value. #### Response Example N/A ``` -------------------------------- ### Get GUID Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/T_GH_IO_Serialization_GH_LooseChunk Retrieves a GUID associated with a given name, optionally by index. Name comparison is case-insensitive. ```APIDOC ## GET /websites/mcneel_github_io_grasshopper-api-docs_api_grasshopper/guid ### Description Retrieves the GUID value of the item with the specified name. Name comparison is not case-sensitive. ### Method GET ### Endpoint `/websites/mcneel_github_io_grasshopper-api-docs_api_grasshopper/guid` ### Parameters #### Query Parameters - **name** (String) - Required - The name of the GUID to retrieve. - **index** (Int32) - Optional - The index of the GUID if multiple exist with the same name. ### Request Example ```json { "query": { "name": "exampleName", "index": 0 } } ``` ### Response #### Success Response (200) - **guid** (Guid) - The retrieved GUID. #### Response Example ```json { "guid": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } ``` ``` -------------------------------- ### Simple Component Example (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/020a5098-963f-4da8-bf65-650993c73bcb Demonstrates the creation of a basic Grasshopper component in C#. This serves as a foundational example for understanding component structure and registration. ```csharp using Grasshopper.Kernel; using Rhino.Geometry; using System; namespace MyComponents { public class SimpleComponent : GH_Component { public SimpleComponent() : base("Simple Component", "SC", "A simple Grasshopper component", "Examples", "Simple") { } protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) { pManager.AddNumberParameter("Input A", "A", "First number", GH_ParamAccess.item); pManager.AddNumberParameter("Input B", "B", "Second number", GH_ParamAccess.item); } protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { pManager.AddNumberParameter("Result", "R", "The sum of A and B", GH_ParamAccess.item); } protected override void SolveInstance(IGH_DataAccess DA) { double inputA = 0; double inputB = 0; if (!DA.GetData(0, ref inputA)) return; if (!DA.GetData(1, ref inputB)) return; double result = inputA + inputB; DA.SetData(0, result); } public override GH_Exposure Exposure => GH_Exposure.primary; } } ``` -------------------------------- ### SetupTooltip Method Signature (C# and VB.NET) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_Kernel_GH_ZuiAction_SetupTooltip Provides the abstract method signature for SetupTooltip in both C# and Visual Basic.NET. This method is responsible for setting up tooltip information and is part of the IGH_TooltipAwareObject interface. ```csharp public abstract void SetupTooltip( PointF canvasPoint, GH_TooltipDisplayEventArgs e ) ``` ```vbnet Public MustOverride Sub SetupTooltip ( canvasPoint As PointF, e As GH_TooltipDisplayEventArgs ) ``` -------------------------------- ### Get id_rc_angulardimension Guid (VB.NET) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/F_Grasshopper_Kernel_GH_TypeLib_id_rc_angulardimension Retrieves the static Guid value for `id_rc_angulardimension` in VB.NET. This Guid serves as a unique identifier for angular dimension types in the Grasshopper ecosystem. ```vbnet Public Shared id_rc_angulardimension As Guid ``` -------------------------------- ### Get Guid Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/T_GH_IO_Serialization_GH_Chunk Retrieves a GUID associated with a given name and optional index. Name comparison is case-insensitive. ```APIDOC ## GET /websites/mcneel_github_io_grasshopper-api-docs_api_grasshopper ### Description Gets the value of the item with the specified name and optional index. Name comparison is not case-sensitive. ### Method GET ### Endpoint `/websites/mcneel_github_io_grasshopper-api-docs_api_grasshopper/TryGetGuid(String name, [Int32 index,] out Guid guid)` ### Parameters #### Path Parameters - **name** (String) - Required - The name of the item. - **index** (Int32) - Optional - The index of the item. #### Query Parameters None #### Request Body None ### Request Example GET /websites/mcneel_github_io_grasshopper-api-docs_api_grasshopper/TryGetGuid?name=exampleName GET /websites/mcneel_github_io_grasshopper-api-docs_api_grasshopper/TryGetGuid?name=exampleName&index=1 ### Response #### Success Response (200) - **guid** (Guid) - The retrieved GUID value. #### Response Example ```json { "guid": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } ``` ``` -------------------------------- ### SetupColourPicker Method Signature (C#, VB.NET) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_GUI_Base_GH_ColourPickerBase_SetupColourPicker Demonstrates the method signature for setting up a color picker in Grasshopper. It takes an initial color, an active color, and the desired color space as input. This method is part of the Grasshopper.GUI.Base namespace. ```csharp public void SetupColourPicker( Color col0, Point4d col1, GH_ColourSpace space ) ``` ```vbnet Public Sub SetupColourPicker ( col0 As Color, col1 As Point4d, space As GH_ColourSpace ) ``` -------------------------------- ### Get Guid Methods Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/T_GH_IO_Serialization_GH_LooseChunk These methods retrieve the value of a Guid item by its name, with or without an index. Name comparison is not case-sensitive. ```APIDOC ## GetGuid(String) ### Description Gets the value of the item with the specified name. Name comparison is not case-sensitive. ### Method GET (Assumed, as it's a retrieval operation) ### Endpoint `/websites/mcneel_github_io_grasshopper-api-docs_api_grasshopper/GetGuid/{name}` ### Parameters #### Path Parameters - **name** (String) - Required - The name of the item to retrieve. ### Response #### Success Response (200) - **value** (String) - The retrieved Guid value (as a string). #### Response Example ```json { "value": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } ``` ## GetGuid(String, Int32) ### Description Gets the value of the item with the specified name and index. Name comparison is not case-sensitive. ### Method GET (Assumed, as it's a retrieval operation) ### Endpoint `/websites/mcneel_github_io_grasshopper-api-docs_api_grasshopper/GetGuid/{name}/{index}` ### Parameters #### Path Parameters - **name** (String) - Required - The name of the item to retrieve. - **index** (Int32) - Required - The index of the item to retrieve. ### Response #### Success Response (200) - **value** (String) - The retrieved Guid value (as a string). #### Response Example ```json { "value": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } ``` ``` -------------------------------- ### Create Simple Component in C# Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/730f0792-7bfb-4310-a416-239e8c315645 Demonstrates the basic structure for creating a new Grasshopper component using C#. This involves defining inputs, outputs, and the SolveInstance method. No external dependencies are required beyond the Grasshopper SDK. ```csharp using Grasshopper.Kernel; using Rhino.Geometry; using System; using System.Collections.Generic; namespace MyComponentNamespace { public class SimpleComponent : GH_Component { public SimpleComponent() : base("Simple Component", "SC", "A simple example component", "Examples", "Simple") { } protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) { pManager.AddNumberParameter("Input", "In", "An input number", GH_ParamAccess.item); } protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { pManager.AddNumberParameter("Output", "Out", "An output number", GH_ParamAccess.item); } protected override void SolveInstance(IGH_DataAccess DA) { double input = 0; if (!DA.GetData(0, ref input)) { return; } double output = input * 2; DA.SetData(0, output); } public override GH_Exposure Exposure { get { return GH_Exposure.primary; } } protected override System.Drawing.Bitmap Icon { get { // Return a 24x24 bitmap icon return Resource.MyIcon; } } public override Guid ComponentGuid { get { return new Guid("YOUR-UNIQUE-GUID-HERE"); } } } } ``` -------------------------------- ### Get id_rc_angulardimension Guid (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/F_Grasshopper_Kernel_GH_TypeLib_id_rc_angulardimension Retrieves the static Guid value for `id_rc_angulardimension` in C#. This Guid is used to uniquely identify angular dimension objects within the Grasshopper API. ```csharp public static Guid id_rc_angulardimension ``` -------------------------------- ### Get Param_AngularDimension ComponentGuid (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_Grasshopper_Kernel_Parameters_Param_AngularDimension_ComponentGuid Retrieves the unique identifier (GUID) for the Param_AngularDimension component. This property is read-only and returns a Guid. ```csharp public override Guid ComponentGuid { get; } ``` -------------------------------- ### GH_ColourPickerBase.SetupColourPicker Method Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_GUI_Base_GH_ColourPickerBase_SetupColourPicker_1 Sets up the UI elements for the color picker, allowing initialization with two colors and a specified color space. ```APIDOC ## GH_ColourPickerBase.SetupColourPicker Method ### Description Sets up all UI elements for the color picker. ### Method C# ### Endpoint N/A (This is a class method, not a REST endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp // This is a method call, not a request body example. // Example usage would depend on the context of the Grasshopper application. ``` ### Response #### Success Response (void) This method does not return a value. #### Response Example ```json // No response body for this void method. ``` ### Parameters - **col0** (System.Drawing.Color) - Required - Initial colour for this picker. - **col1** (System.Drawing.Color) - Required - Active colour for this picker. - **space** (Grasshopper.GUI.Base.GH_ColourSpace) - Required - Colour space mode for this picker. ### See Also - GH_ColourPickerBase Class - SetupColourPicker Overload - Grasshopper.GUI.Base Namespace ``` -------------------------------- ### GH_Attributes.SetupTooltip Method Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_Kernel_GH_Attributes_1_SetupTooltip Populates the Grasshopper tooltip with all relevant data. If this function returns True, it is assumed that all possible fields have been filled out and the tooltip is ready for display. ```APIDOC ## GH_Attributes.SetupTooltip Method ### Description Populates the Grasshopper tooltip with all relevant data. If this function returns True, it is assumed that all possible fields have been filled out and the tooltip is ready for display. ### Method Virtual void ### Endpoint N/A (This is a class method, not a REST endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp // This is a method within a class, not a standalone request. // Example usage would depend on the context of the GH_Attributes object. ``` ### Response #### Success Response (void return type indicates no specific success code) This method returns void, implying its action is performed directly. #### Response Example ```json // No direct JSON response, operation is internal to the Grasshopper GUI. ``` ``` -------------------------------- ### Get Cylinder ID Guid (VB.NET) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/F_Grasshopper_Kernel_GH_TypeLib_id_rc_cylinder Retrieves the static Guid identifier for a cylinder in Grasshopper using VB.NET. ```vbnet Public Shared id_rc_cylinder As Guid ``` -------------------------------- ### Get Cylinder ID Guid (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/F_Grasshopper_Kernel_GH_TypeLib_id_rc_cylinder Retrieves the static Guid identifier for a cylinder in Grasshopper using C#. ```csharp public static Guid id_rc_cylinder ``` -------------------------------- ### GH_ResizeBorder.Setup Method Overloads Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/Overload_Grasshopper_GUI_Canvas_GH_ResizeBorder_Setup This section details the different overloads for the Setup method of the GH_ResizeBorder class. Each overload facilitates the setup of a new sizing operation with varying parameters. ```APIDOC ## GH_ResizeBorder.Setup Method Overloads ### Description The `Setup` method in the `GH_ResizeBorder` class is used to initialize a new sizing operation. There are multiple overloads available, each accepting different combinations of parameters to define the initial state and behavior of the resize operation. ### Overloads #### Setup(IGH_Attributes, PointF) * **Description**: Set up a new sizing operation. * **Parameters**: * `attributes` (IGH_Attributes) - Required - The attributes associated with the resize operation. * `point` (PointF) - Required - The starting point of the resize operation. #### Setup(IGH_Attributes, PointF, SizeF) * **Description**: Set up a new sizing operation. * **Parameters**: * `attributes` (IGH_Attributes) - Required - The attributes associated with the resize operation. * `point` (PointF) - Required - The starting point of the resize operation. * `size` (SizeF) - Required - The initial size of the element being resized. #### Setup(RectangleF, PointF, PointF) * **Description**: Set up a new sizing operation. * **Parameters**: * `bounds` (RectangleF) - Required - The bounding rectangle of the element being resized. * `startPoint` (PointF) - Required - The starting point of the mouse drag. * `endPoint` (PointF) - Required - The current point of the mouse drag. #### Setup(IGH_Attributes, PointF, SizeF, SizeF) * **Description**: Set up a new sizing operation. * **Parameters**: * `attributes` (IGH_Attributes) - Required - The attributes associated with the resize operation. * `point` (PointF) - Required - The starting point of the resize operation. * `initialSize` (SizeF) - Required - The initial size of the element being resized. * `currentSize` (SizeF) - Required - The current size of the element being resized. #### Setup(RectangleF, PointF, PointF, SizeF) * **Description**: Set up a new sizing operation. * **Parameters**: * `bounds` (RectangleF) - Required - The bounding rectangle of the element being resized. * `startPoint` (PointF) - Required - The starting point of the mouse drag. * `endPoint` (PointF) - Required - The current point of the mouse drag. * `delta` (SizeF) - Required - The change in size during the drag operation. #### Setup(RectangleF, PointF, PointF, SizeF, SizeF) * **Description**: Set up a new sizing operation. * **Parameters**: * `bounds` (RectangleF) - Required - The bounding rectangle of the element being resized. * `startPoint` (PointF) - Required - The starting point of the mouse drag. * `endPoint` (PointF) - Required - The current point of the mouse drag. * `initialSize` (SizeF) - Required - The initial size of the element being resized. * `currentSize` (SizeF) - Required - The current size of the element being resized. ### Note This documentation is based on the provided text and may not cover all possible scenarios or internal workings of the `GH_ResizeBorder` class. For more detailed information, refer to the official Grasshopper API documentation or source code. ``` -------------------------------- ### Get Element Guid (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_Grasshopper_Kernel_Types_IGH_FieldElement_ElementGuid Retrieves the unique Guid identifier for an IGH_FieldElement in C#. This is a read-only property provided by the Grasshopper.Kernel.Types namespace. ```csharp Guid ElementGuid { get; } ``` -------------------------------- ### Create Simple Component (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/d823ee90-ea94-4a8a-a972-df5d006a8d9f Demonstrates the basic structure for creating a custom Grasshopper component using C#. This serves as a foundational example for extending Grasshopper's capabilities. ```csharp // Placeholder for actual C# code for a simple component. // This would typically involve inheriting from GH_Component and implementing // required methods like SolveInstance and RegisterInputParams. ``` -------------------------------- ### Manage Simple Parameters in C# Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/8a7974ab-7b2b-4f48-84d0-6e81b184e6b0 Illustrates the process of defining and managing simple input and output parameters for a Grasshopper component in C#. This is crucial for component interaction. ```csharp // Placeholder for actual C# code for simple parameters // Shows how to create GH_Param_Generic, GH_Param_Number, etc. ``` -------------------------------- ### Get GH_Item Internal Data as Guid (VB) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_GH_IO_Types_GH_Item__guid This VB.NET code snippet shows how to retrieve the internal data of a GH_Item object in its Guid representation. A conversion exception might occur if the data cannot be cast to a Guid. ```vbnet Public ReadOnly Property _guid As Guid Get ``` -------------------------------- ### GH_ResizeBorder.Setup Method - C# and VB.NET Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_GUI_Canvas_GH_ResizeBorder_Setup_5 This snippet demonstrates the setup method for the GH_ResizeBorder class in both C# and VB.NET. It initializes a resize operation by defining the shape's region, pivot point, mouse cursor position, and the minimum and maximum allowed dimensions for the resize. ```csharp public void Setup( RectangleF ShapeRegion, PointF ShapePivot, PointF MouseCursor, SizeF MinSize, SizeF MaxSize ) ``` ```vbnet Public Sub Setup ( ShapeRegion As RectangleF, ShapePivot As PointF, MouseCursor As PointF, MinSize As SizeF, MaxSize As SizeF ) ``` -------------------------------- ### Get Element Guid (VB.NET) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_Grasshopper_Kernel_Types_IGH_FieldElement_ElementGuid Retrieves the unique Guid identifier for an IGH_FieldElement in VB.NET. This is a read-only property available within the Grasshopper.Kernel.Types namespace. ```vbnet ReadOnly Property ElementGuid As Guid Get ``` -------------------------------- ### Implement Simple Parameters (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/d823ee90-ea94-4a8a-a972-df5d006a8d9f Details the process of defining and registering input and output parameters for a custom Grasshopper component using C#. Covers parameter types and their attributes. ```csharp // Placeholder for actual C# code for simple parameters. // This would involve using methods like RegisterInputParams and RegisterOutputParams. ``` -------------------------------- ### Get Guid Table Reference Count (VB) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_Grasshopper_Kernel_GH_DocumentEventServer_GuidTableRefCount Retrieves the number of stored IDs in the Guid Table for the GH_DocumentEventServer class. This is a read-only property. ```vbnet Public ReadOnly Property GuidTableRefCount As Integer Get ``` -------------------------------- ### GH_ZuiAction.SetupTooltip Method Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_Kernel_GH_ZuiAction_SetupTooltip Sets up the tooltip display for a UI element within the Grasshopper canvas. ```APIDOC ## GH_ZuiAction.SetupTooltip Method ### Description Sets up the tooltip display for a UI element within the Grasshopper canvas. ### Method ABSTRACT VOID ### Endpoint N/A (Class Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "canvasPoint": { "x": 100, "y": 50 }, "e": { "description": "Tooltip content details" } } ``` ### Response #### Success Response (200) Void (No return value) #### Response Example None ``` -------------------------------- ### Get Guid Table Reference Count (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_Grasshopper_Kernel_GH_DocumentEventServer_GuidTableRefCount Retrieves the number of stored IDs in the Guid Table for the GH_DocumentEventServer class. This is a read-only property. ```csharp public int GuidTableRefCount { get; } ``` -------------------------------- ### GH_ResizeBorder.Setup Method (RectangleF, PointF, PointF, SizeF, SizeF) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_GUI_Canvas_GH_ResizeBorder_Setup_5 Sets up a new sizing operation for a resize border, defining the shape region, pivot, cursor position, and minimum/maximum allowed sizes. ```APIDOC ## GH_ResizeBorder.Setup Method (RectangleF, PointF, PointF, SizeF, SizeF) ### Description Set up a new sizing operation. ### Method Void Setup ### Endpoint N/A (This is a class method, not a REST endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp public void Setup( RectangleF ShapeRegion, PointF ShapePivot, PointF MouseCursor, SizeF MinSize, SizeF MaxSize ) ``` ### Response #### Success Response (200) N/A (This is a method call, not an API response) #### Response Example N/A ``` -------------------------------- ### Get Decimal Type Guid (VB.NET) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/F_Grasshopper_Kernel_GH_TypeLib_id_decimal Retrieves the shared Guid representing the System.Decimal type from the GH_TypeLib class. This is a constant field within the Grasshopper API. ```vbnet Public Shared id_decimal As Guid ``` -------------------------------- ### Get Decimal Type Guid (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/F_Grasshopper_Kernel_GH_TypeLib_id_decimal Retrieves the static Guid representing the System.Decimal type from the GH_TypeLib class. This is a constant field within the Grasshopper API. ```csharp public static Guid id_decimal ``` -------------------------------- ### GH_ResizeBorder.Setup Method Signature (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_GUI_Canvas_GH_ResizeBorder_Setup_2 Provides the C# signature for the Setup method of the GH_ResizeBorder class. This method is used to initialize a new resizing operation for a shape's attributes, taking cursor position and size constraints as input. ```csharp public void Setup( IGH_Attributes att, PointF MouseCursor, SizeF MinSize, SizeF MaxSize ) ``` -------------------------------- ### Get Object Guid (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_Grasshopper_Kernel_IGH_ObjectProxy_Guid Retrieves the Guid of the target Grasshopper object. This property is read-only and returns a Guid value. For compiled objects, it's the ComponentID; for user objects, it's a hash of the file path. ```csharp Guid Guid { get; } ``` -------------------------------- ### GH_PreviewUtil Constructor Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_Kernel_GH_PreviewUtil__ctor Initializes a new instance of the GH_PreviewUtil class. This constructor does not take any arguments. ```APIDOC ## GH_PreviewUtil Constructor ### Description Initializes a new instance of the GH_PreviewUtil class. ### Method **N/A** (This is a constructor, not a typical API endpoint) ### Endpoint **N/A** ### Parameters None ### Request Example ```csharp // Example usage of the constructor (if applicable in a larger context) GH_PreviewUtil previewUtil = new GH_PreviewUtil(); ``` ### Response #### Success Response (N/A) N/A #### Response Example N/A ### See Also - **Reference**: GH_PreviewUtil Class, GH_PreviewUtil Overload - **Namespace**: Grasshopper.Kernel ``` -------------------------------- ### Get Param_AngularDimension ComponentGuid (VB.NET) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_Grasshopper_Kernel_Parameters_Param_AngularDimension_ComponentGuid Retrieves the unique identifier (GUID) for the Param_AngularDimension component using VB.NET syntax. This property is read-only and returns a Guid. ```vbnet Public Overrides ReadOnly Property ComponentGuid As Guid Get End Property ``` -------------------------------- ### Simple Parameters Example (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/020a5098-963f-4da8-bf65-650993c73bcb Explains how to define and manage input and output parameters for a Grasshopper component in C#. This covers different parameter access modes and types. ```csharp using Grasshopper.Kernel; using System.Collections.Generic; using System; namespace MyComponents { public class SimpleParameters : GH_Component { public SimpleParameters() : base("Simple Parameters", "SP", "Demonstrates different parameter access types", "Examples", "Simple") { } protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) { pManager.AddNumberParameter("Single Item", "SI", "A single number input", GH_ParamAccess.item); pManager.AddNumberParameter("Multiple Items", "MI", "A list of numbers", GH_ParamAccess.list); pManager.AddNumberParameter("Tree Item", "TI", "A single number from a data tree", GH_ParamAccess.tree); } protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { pManager.AddNumberParameter("Output A", "OA", "Single item output", GH_ParamAccess.item); pManager.AddNumberParameter("Output B", "OB", "List output", GH_ParamAccess.list); } protected override void SolveInstance(IGH_DataAccess DA) { // Input A (Single Item) double singleInput = 0; if (!DA.GetData(0, ref singleInput)) return; // Input B (Multiple Items) List listInput = new List(); if (!DA.GetDataList(1, listInput)) return; // Input C (Tree Item) - Example of accessing a specific path // This is a simplified example; actual tree manipulation is more complex GH_Structure treeInput = new GH_Structure(); if (!DA.GetDataTree(2, out treeInput)) return; // Process inputs and set outputs DA.SetData(0, singleInput * 2); List outputList = new List(); foreach (var item in listInput) { outputList.Add(item * 2); } DA.SetDataList(1, outputList); } public override GH_Exposure Exposure => GH_Exposure.tertiary; } } ``` -------------------------------- ### Get State Data by ID - C# Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_Grasshopper_Kernel_GH_State_Data Retrieves state data using a Guid identifier. This is a read-only property within the Grasshopper.Kernel namespace. ```csharp public string this[ Guid id ] { get; } ``` -------------------------------- ### GH_ColourPickerBase.SetupColourPicker Method Overloads Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/Overload_Grasshopper_GUI_Base_GH_ColourPickerBase_SetupColourPicker This section details the different overloads available for the SetupColourPicker method in the GH_ColourPickerBase class. Each overload allows for setting up UI elements with varying parameters. ```APIDOC ## GH_ColourPickerBase.SetupColourPicker Method Overloads ### Description Provides details on the different ways to call the SetupColourPicker method, each accepting different parameter sets to configure the color picker UI. ### Method Overloaded Methods ### Endpoints N/A (Method Overloads) ### Parameters #### Overload 1: SetupColourPicker(Color, Point4d, GH_ColourSpace) - **color** (Color) - Description of the color parameter. - **point** (Point4d) - Description of the point parameter. - **colorSpace** (GH_ColourSpace) - Description of the color space parameter. #### Overload 2: SetupColourPicker(Color, Color, GH_ColourSpace) - **color1** (Color) - Description of the first color parameter. - **color2** (Color) - Description of the second color parameter. - **colorSpace** (GH_ColourSpace) - Description of the color space parameter. ### Request Example ```json // Example for Overload 1 { "color": "System.Drawing.Color", "point": { "X": 0.0, "Y": 0.0, "Z": 0.0, "W": 1.0 }, "colorSpace": "GH_ColourSpace" } // Example for Overload 2 { "color1": "System.Drawing.Color", "color2": "System.Drawing.Color", "colorSpace": "GH_ColourSpace" } ``` ### Response #### Success Response (Void) This method does not return a value; it configures the UI elements. #### Response Example N/A ``` -------------------------------- ### Get GH_Interval Guid (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/F_Grasshopper_Kernel_GH_TypeLib_id_gh_interval Retrieves the static Guid identifier for the GH_Interval type in C#. This is a fundamental type for representing intervals in Grasshopper. ```csharp public static Guid id_gh_interval ``` -------------------------------- ### Create a Simple Component in C# Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/fbfe5e40-ba8d-4e53-97c6-27572e049835 This example demonstrates the basic structure for creating a custom component in Grasshopper using C#. It covers defining inputs, outputs, and the core logic executed by the component. No external dependencies are required beyond the standard Grasshopper SDK. ```csharp using Grasshopper.Kernel; using Rhino.Geometry; using System; using System.Collections.Generic; namespace YourNamespace { public class SimpleComponent : GH_Component { public SimpleComponent() : base("Simple Component", "SC", "A simple example component", "Examples", "Simple") { } protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) { pManager.AddNumberParameter("Input A", "A", "First number", GH_ParamAccess.item); pManager.AddNumberParameter("Input B", "B", "Second number", GH_ParamAccess.item); } protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { pManager.AddNumberParameter("Output Sum", "Sum", "The sum of A and B", GH_ParamAccess.item); } protected override void SolveInstance(IGH_DataAccess DA) { double inputA = 0; double inputB = 0; if (!DA.GetData(0, ref inputA)) { return; } if (!DA.GetData(1, ref inputB)) { return; } double sum = inputA + inputB; DA.SetData(0, sum); } public override GH_Exposure Exposure { get { return GH_Exposure.primary; } } } } ``` -------------------------------- ### GH_Canvas.GH_ImageSettings Constructor (String) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_GUI_Canvas_GH_Canvas_GH_ImageSettings__ctor_1 Creates a new instance of the GH_ImageSettings class with a specified file path. ```APIDOC ## GH_Canvas.GH_ImageSettings Constructor (String) ### Description Create a new instance of the GH_ImageSettings class. ### Method Constructor ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Syntax ```csharp public GH_ImageSettings(string filePath) ``` ### Parameters - **filePath** (System.String) - Target location for image. ``` -------------------------------- ### Get GH_Item Internal Data as Guid (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_GH_IO_Types_GH_Item__guid This C# code snippet demonstrates how to access the internal data of a GH_Item object and retrieve it as a Guid. It is important to note that a conversion exception may be thrown if the data is not stored as a Guid. ```csharp public Guid _guid { get; } ``` -------------------------------- ### Get Installed Fonts (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_Grasshopper_Rhinoceros_ModelFont_InstalledFonts Retrieves a read-only list of all installed ModelFont objects recognized by Grasshopper. This property is static and directly accessible from the ModelFont class. ```csharp public static IReadOnlyList InstalledFonts { get; } ``` ```vbnet Public Shared ReadOnly Property InstalledFonts As IReadOnlyList(Of ModelFont) Get ``` -------------------------------- ### Create List Component (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/d823ee90-ea94-4a8a-a972-df5d006a8d9f An example demonstrating how to create a Grasshopper component that processes or generates lists of data using C#. Covers list manipulation and iteration. ```csharp // Placeholder for actual C# code for a list component. // This example would focus on handling GH_Structure or List inputs/outputs. ``` -------------------------------- ### Get Installed Font Families (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_Grasshopper_Rhinoceros_ModelFont_InstalledFamilies Retrieves a read-only list of installed font family names. This property is part of the ModelFont class in the Grasshopper.Rhinoceros namespace. ```csharp public static IReadOnlyList InstalledFamilies { get; } ``` ```vbnet Public Shared ReadOnly Property InstalledFamilies As IReadOnlyList(Of String) Get ``` -------------------------------- ### GH_ResizeBorder.Setup Method (IGH_Attributes, PointF, SizeF, SizeF) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_GUI_Canvas_GH_ResizeBorder_Setup_2 Sets up a new sizing operation for a resize border with specified attributes, cursor position, minimum size, and maximum size. ```APIDOC ## GH_ResizeBorder.Setup Method (IGH_Attributes, PointF, SizeF, SizeF) ### Description Set up a new sizing operation. ### Method N/A (This is a class method documentation, not an API endpoint) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A #### Parameters - **att** (Grasshopper.Kernel.IGH_Attributes) - Required - Attributes of shape to resize. - **MouseCursor** (System.Drawing.PointF) - Required - Location of cursor in shape space coordinates. - **MinSize** (System.Drawing.SizeF) - Required - Minimum allowed size for shape. - **MaxSize** (System.Drawing.SizeF) - Required - Maximum allowed size for shape. ``` -------------------------------- ### Create Simple Component in C# Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/8a7974ab-7b2b-4f48-84d0-6e81b184e6b0 This snippet shows how to create a basic Grasshopper component using C#. It covers the essential structure and methods required for a functional component. ```csharp // Placeholder for actual C# code of a simple component // This would typically involve inheriting from GH_Component and implementing // the SolveInstance method. ``` -------------------------------- ### GH_UserObject.Guid Property Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_Grasshopper_Kernel_GH_UserObject_Guid Gets or sets the Guid of this User Object. The Guid is created anew during construction and is not stored in the User Object File. You should never have to set this field. ```APIDOC ## GH_UserObject.Guid Property ### Description Gets or sets the Guid of this User Object. The Guid is created anew during construction and is not stored in the User Object File. You should never have to set this field. ### Method GET/SET ### Endpoint N/A (This is a property of a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "Guid property does not have a request body." } ``` ### Response #### Success Response (200) - **Guid** (Guid) - The unique identifier for the User Object. #### Response Example ```json { "example": "A Guid value, e.g., 'a1b2c3d4-e5f6-7890-1234-567890abcdef'" } ``` ``` -------------------------------- ### GH_SettingsServer Constructor (String) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/Overload_Grasshopper_Kernel_GH_SettingsServer__ctor Creates a new instance of the GH_SettingsServer class associated with a settings XML file. If the file exists, its settings are loaded. ```APIDOC ## GH_SettingsServer Constructor (String) ### Description Creates a new instance of the GH_SettingsServer class. The server will be associated with a settings xml file in the %ApplicationData%\Grasshopper\ directory. If a file with the same name already exists, its settings will be automatically loaded. ### Method CONSTRUCTOR ### Endpoint N/A (Class Constructor) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp var settingsServer = new GH_SettingsServer("MySettings"); ``` ### Response #### Success Response (200) N/A (Constructor) #### Response Example N/A (Constructor) ``` -------------------------------- ### Get Baked Object IDs - VB Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_Grasshopper_Kernel_GH_BakeUtility_BakedIds Retrieves an array of GUIDs representing all baked object IDs within the GH_BakeUtility. This property is read-only and returns a Guid(). ```vbnet Public ReadOnly Property BakedIds As Guid() Get ``` -------------------------------- ### Get Baked Object IDs - C# Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/P_Grasshopper_Kernel_GH_BakeUtility_BakedIds Retrieves an array of GUIDs representing all baked object IDs within the GH_BakeUtility. This property is read-only and returns a Guid[]. ```csharp public Guid[] BakedIds { get; } ``` -------------------------------- ### SetupColourPicker Method in C# and VB.NET Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_GUI_Base_GH_ColourPickerBase_SetupColourPicker_1 The SetupColourPicker method initializes the user interface elements of a color picker. It takes two Color parameters for initial and active colors, and a GH_ColourSpace parameter to define the color space mode. This method is part of the Grasshopper.GUI.Base namespace. ```csharp public void SetupColourPicker( Color col0, Color col1, GH_ColourSpace space ) ``` ```vbnet Public Sub SetupColourPicker ( col0 As Color, col1 As Color, space As GH_ColourSpace ) ``` -------------------------------- ### GH_DigitScrollerBase.SetupScroller Method Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_GUI_Base_GH_DigitScrollerBase_SetupScroller Sets the minimum, maximum, and value fields of the GH_DigitScrollerBase simultaneously. ```APIDOC ## GH_DigitScrollerBase.SetupScroller Method ### Description Sets the minimum, maximum, and value fields of the GH_DigitScrollerBase simultaneously. ### Method `public void SetupScroller(decimal minimum, decimal maximum, decimal value)` ### Endpoint N/A (This is a method within a class, not a REST API endpoint) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (N/A) N/A #### Response Example N/A #### Parameters - **minimum** (decimal) - The minimum value for the scroller. - **maximum** (decimal) - The maximum value for the scroller. - **value** (decimal) - The initial value for the scroller. ``` -------------------------------- ### Get Point3f Guid (VB) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/F_Grasshopper_Kernel_GH_TypeLib_id_rc_point3f This snippet shows how to access the static Guid `id_rc_point3f` in VB.NET, which is used to identify the Point3f type within the Grasshopper API. ```vbnet Public Shared id_rc_point3f As Guid ``` -------------------------------- ### Get Point3f Guid (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/F_Grasshopper_Kernel_GH_TypeLib_id_rc_point3f This snippet shows how to access the static Guid `id_rc_point3f` in C#, which is used to identify the Point3f type within the Grasshopper API. ```csharp public static Guid id_rc_point3f ``` -------------------------------- ### SetupScroller Method (C#, VB.NET) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/M_Grasshopper_GUI_Base_GH_DigitScrollerBase_SetupScroller The SetupScroller method allows for simultaneous initialization of the minimum, maximum, and current value for a digit scroller control. It takes three decimal parameters: minimum, maximum, and value. This method is crucial for configuring the range and initial state of the scroller. ```csharp public void SetupScroller( decimal minimum, decimal maximum, decimal value ) ``` ```vbnet Public Sub SetupScroller ( minimum As Decimal, maximum As Decimal, value As Decimal ) ``` -------------------------------- ### C# Grasshopper Input/Output Parameter Registration with Access Flags Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/020a5098-963f-4da8-bf65-650993c73bcb Demonstrates how to register input and output parameters for a Grasshopper component using C#. It specifically shows how to set the GH_ParamAccess flag for parameters, enabling list ('list') and single item ('item') data handling. This is crucial for components that operate on collections of data. ```csharp protected override void RegisterInputParams(Kernel.GH_Component.GH_InputParamManager pManager) { pManager.AddGeometryParameter("Geometry", "G", "Geometry to cull", GH_ParamAccess.list); pManager.AddIntegerParameter("Count", "C", "Number of objects to cull", GH_ParamAccess.item, 1); } protected override void RegisterOutputParams(Kernel.GH_Component.GH_OutputParamManager pManager) { pManager.AddGeometryParameter("Geometry", "G", "Culled geometry", GH_ParamAccess.list); } ``` -------------------------------- ### Get Point3d Guid (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/F_Grasshopper_Kernel_GH_TypeLib_id_rc_point3d Retrieves the static Guid identifier for Rhino.Geometry.Point3d from the GH_TypeLib class. This is a common way to reference geometry types within the Grasshopper API. ```csharp public static Guid id_rc_point3d ``` ```vbnet Public Shared id_rc_point3d As Guid ``` -------------------------------- ### SetupColourPicker Method (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/T_Grasshopper_GUI_Base_GH_ColourPickerBase Sets up all UI elements for the colour picker. This overload takes the base color, a point representing the bounds, and the colour space model as parameters. ```csharp public void SetupColourPicker(Color baseColour, Point4d bounds, GH_ColourSpace colourSpace) ``` -------------------------------- ### Get id_gh_transform Guid (C#) Source: https://mcneel.github.io/grasshopper-api-docs/api/grasshopper/html/F_Grasshopper_Kernel_GH_TypeLib_id_gh_transform Retrieves the static Guid identifier for GH_Transform. This field is part of the GH_TypeLib and is used to represent the transform type within Grasshopper. ```csharp public static Guid id_gh_transform ```