ladybug_rhino.versioning.component module¶
Module for exporting components from Grasshopper with all metadata and source code.
- class ladybug_rhino.versioning.component.Component(name, nickname, description, code, category, subcategory, version)[source]¶
Bases:
object
Grasshopper component wrapper used to serialize component properties to dict.
- Parameters:
name – Text for the name of the component.
nickname – Text for the nickname of the component.
description – Text for the description of the component.
code – Text for all the Python code of the component.
category – Text for all Python code in the component (including import statements)
subcategory – Text for the subcategory of the component.
version – Text for the version of the component formatted as a 3-number semantic version.
- add_input(inp)[source]¶
Add an input for the component.
- Parameters:
inp – A Port object for the input.
- add_output(out)[source]¶
Add an output for the component.
- Parameters:
out – A Port object for the output.
- classmethod from_gh_component(component)[source]¶
Create Component from a Grasshopper component object.
- Parameters:
component – A Grasshopper component object.
- to_json(folder, name=None, indent=2)[source]¶
Write the Component instance to a JSON file.
- Parameters:
folder – Text for the folder into which the JSON should be written.
name – Text for the file name for the JSON.
indent – Integer for the number of spaces in an indent.
- MAPPING = {'Food4Rhino': '{{Package_Manager}}', 'GH': '{{PLGN}}', 'Grasshopper': '{{Plugin}}', 'Rhino': '{{Cad}}', 'grasshopper': '{{plugin}}', 'rhino': '{{cad}}'}¶
- property inputs¶
Get a list of Port objects for the component Inputs.
- property outputs¶
Get a list of Port objects for the component Outputs.
- class ladybug_rhino.versioning.component.Port(name, description=None, default_value=None, value_type=None, access_type=None)[source]¶
Bases:
object
Grasshopper port wrapper used to serialize inputs and outputs to dict.
- Parameters:
name – Text for the name of the input or output.
description – Text for the description of the input or output.
default_value – Default value for the input or output.
value_type – Text the type of input or output (eg. bool)
access_type – Text for list vs. item access.