July 30, 2020

How to work with GHPython

GHPython is the bridge we can have Python by IronPython within Grasshopper3D. RhinoCommon has been based on .NET and if we want to have access to code in Python, we cannot unless something takes place in between to translate codes and get access to the main library. Thus the question “Why IronPython?” has been replied by

IronPython is an excellent addition to the .NET Framework, providing Python developers with the power of the .NET framework. Existing .NET developers can also use IronPython as a fast and expressive scripting language for embedding, testing, or writing a new application from scratch. The CLR is a great platform for creating programming languages, and the DLR makes it all the better for dynamic languages. Also, the .NET framework (base class library, presentation foundation, etc.) gives developers an amazing amount of functionality and power.

IronPython’s exact task is to create such an environment to work through .NET. Getting back to how to work with GHPython tells us to check what differences from Grasshopepr3D canvas to API classes are. Grasshopper canvas is not that intangible to understand and everyone who has experience working with even a beginner compromises how to deal with it. We have each add-on beside its components as a tab where we could find categories from analyzer components, generative, primitive, and utility ones. On each component, we have three sections whereby wires we connect for transforming data and objects through. These sections are:

  • Inputs: Input Parameters presenting data or geometrical objects
  • Method or Function: Main Function defines Connections & Rules
  • Outputs: Final Output presenting data or operated object

In parallel, while we work with Grasshopper Python script editor to have our workflow directly connected to RhinoCommon, we have to know python basics, the API itself, and also the constituents and structures of them. I will talk over more about the details of RhinoCommon in other posts but, generally speaking, where we talk about RhinoCommon, we have to know there are Namespaces, classes, also methods, constructors, properties, events, and attributes. To have the best execution out of these series of items, we need to know where they are and where they should be applied. The image presented below this post also shows key parts of the editor window and some coding examples by different kinds related to python codes from different aspects. You can find everything about RhinoCommon here: There are lots of great dialogues and instructive information in Rhino Discourse where “How to …” question and answer forum is being followed by Rhino experts and other users in a highly diverse range of discussions.

Coding, Computational Design, Lectures and Presentations, OpenSource , ,
0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments