Grasshopper component folder
Grasshopper component folder
- 1 Grasshopper component folder
- 2 Latest commit
- 3 Files
- 4 How do I install a custom GHX component?
- 5 How to install Ladybug for Grasshopper
- 6 Check you have the right software
- 7 Install Ladybug
- 8 Food4Rhino
- 9 Your First Component (Windows)
- 10 HelloGrasshopper
- 11 Next Steps
- 12 Related topics
- 13 Footnotes
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Clone with HTTPS
Use Git or checkout with SVN using the web URL.
Want to be notified of new releases in RobotExMachina/Machina-Grasshopper ?
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
If nothing happens, download Xcode and try again.
Launching Visual Studio
|Type||Name||Latest commit message||Commit time|
|Failed to load latest commit information.|
Machina for Grasshopper
Thanks for downloading Machina for Grasshopper, a Machina-based Grasshopper package for robot control.
Download the latest release. Just as with any other Grasshopper plugin, just drop the main .gha and .dll files in Grasshopper’s Components library. Make sure to right-click on both files and unblock them if necessary. Also, if running Windows 10, make sure you have extracted the files from the .zip file with something other than Window’s native extracter, such as 7Zip, WinRAR or similar (see below for reasons).
In order to install Machina for Grasshopper, you need to follow the following steps.
Go to the releases section and download the latest version of the distributable.
Extract the contents of the MachinaGrasshopper_vX.X.X.zip file somewhere in your computer: if you are running Windows 10, make sure extract the files from the .zip file with something other than Window’s native shell extracter (the one you use when double clicking on the file or right-clicking and choosing Extract ), such as 7Zip, WinRAR or similar. Failure to do so may cause Window’s security settings to internally flag the .dll file as downloaded-from-internet-suspicious, and block it forever.
Paste these files in Grasshopper’s Components folder: open Rhino and Grasshopper, and in GH, go to File > Special Fodlers > Components Folder . This should open a Windows Explorer window in a folder of the kind C:UsersyourUsernameAppDataRoamingGrasshopperLibraries . Once in this folder, paste the previously extracted .gha and .dll files there. You are welcome to also paste the sample files there as well, or keep them somewhere for your reference.
Unblock the files: in your Components folder, right click on Machina’s .gha and .dll files, choose Properties , and make sure they are unblocked in the lower right end of the popup menu.
Restart both Grasshopper and Rhino for the changes to take effect.
There are a bunch of Grasshopper files in the samples folder that comes with this package. These files will help you understand how to setup a Machina project. I will write a dedicated walkthrough section sometime soon.
A full set of tutorials on how to use the Machina framework can be found here:
Tutorials playlist: https://www.youtube.com/playlist?list=PLvxxYImPCApXj3tHVKmpTS_AuMPngnA47
Instructions on how to setup your machine to work with the Machina framework can be found here: https://www.youtube.com/playlist?list=PLvxxYImPCApUffcv_KtdR-sQydA4O4CPH.
A playlist of projects built by the community with different Machina flavors: https://www.youtube.com/playlist?list=PLvxxYImPCApXZ-yBCUtGzVWb2ZhduaSXR
Machina for Grasshopper is built on top of Machina, an open-source platform for action-based control of mechanical actuators.
Machina is also available for Autodesk’s Dynamo. Their API and Actions list is 99% identical.
Here are some videos of things you can do with Machina:
Working with robots is dangerous. Robotic actuators are very powerful machines, but for the most part extremely unaware of their environment; if it collides with something, including yourself, it will not detect it and try to keep going, posing a threat to itself and the operators surrounding it. This is particularly relevant when running in ‘automatic’ mode, where several security measures are bypassed for the sake of performance.
When using robots in a real-time interactive environment, please make sure:
- You have been adequately trained to use that particular machine,
- you are in good physical and mental condition,
- you are operating the robot under the utmost security measures,
- you are following the facility’s and facility staff’s security protocols,
- and the robot has the appropriate guarding in place, including, but not reduced to, e-stops, physical barriers, light curtains, etc.
Machina is in a very early stage of development. You are using this software at your own risk, no warranties are provided herewith, and unexpected results/bugs may arise during its use. Always test and simulate your applications thoroughly before running them on a real device. The author/s shall not be liable for any injuries, damages or losses consequence of using this software in any way whatsoever.
Want to help develop/document Machina for Grasshopper? Get in touch! 🙂
The development of Machina was sponsored by Autodesk, Inc, as part of a summer research residency project in Boston, 2016. Please take a look at the detailed list of acknowledgments
Machina was created and is maintained by Jose Luis Garcia del Castillo.
How do I install a custom GHX component?
I feel like I’m missing something obvious. I’m reading through the SDK documentation on how to create a custom Grasshopper component. I’ve created the class library, inherited from GH_Component, built the dll, and renamed it to a GHA file.
But how do I tell grasshopper to load my GHA file?
Replies to This Discussion
drag and drop the gha file onto your grasshopper window. It should install on it’s own.
This won’t work for updates yet, I don’t think. But it does work for initial install.
Permalink Reply by Benjamin Golder on February 22, 2011 at 6:05pm
Permalink Reply by Eric Anastas on February 22, 2011 at 6:46pm
It appears that dragging in the GHA file just copies the files into the following user folder:
So I assume that Grasshopper just searches these folders for GHA files to load when it starts up?
Permalink Reply by David Rutten on February 23, 2011 at 12:22am
there are three ways to do this:
1) If you’re called David Rutten and about 1.95m high you’re allowed to put the GHA file in
2) If you’re a user who wants to install a GHA file written by someone else then you should put the file in Application DataGrasshopperLibraries You can either do so manually or drag+drop the gha file into Grasshopper and a copy of it will be placed in that folder (as you noted)
3) If you’re a developer who wants to compile and test your GHA assembly, I recommend you add an additional GHA folder path to the Grasshopper loading sequence. You can do this via the _GrasshopperDeveloperSettings command. Any GHA file in any of the folders listed there will be loaded.
Note that if you compile the GHA files yourself, you’ll end up with two different ones if you use the default Visual Studio setup. Namely one file in binDebug and another in binRelease, depending on the build flavour you pick at any given time. This is annoying. Really annoying.
I highly recommend you change the default behaviour of VS to always put the compiled file into just bin This will prevent Grasshopper loader conflicts.
Permalink Reply by David Rutten on February 23, 2011 at 12:24am
ok 4) If you’ve written an installer for your GHA and insist on putting it in a custom folder (maybe next to an RHP file that belongs to the same project) then you can change the grasshopper settings xml file from within your installer. This is basically the same as adding an extra search path via the _GrasshopperDeveloperSettings command, but it doesn’t involve starting Rhino.
Permalink Reply by Eric Anastas on February 24, 2011 at 1:22am
Permalink Reply by kristoffer josefsson on June 27, 2011 at 4:42am
Permalink Reply by Danny Boyes on June 27, 2011 at 4:57am
File menu > Special Folders will take you to the location of the xml file
Permalink Reply by Karamba3D on October 24, 2013 at 3:36am
I would like to install a GH plug-in that relies on a C++ dll. When placed in the ‘Components’-folder however Windows does not find the dll.
Would it make sense that Grasshopper adds the path to the ‘Components’-folder to the Windows ‘Path’ environment variable so that C++ dlls are automatically found there?
Permalink Reply by David Rutten on October 24, 2013 at 8:47am
do not put your files in the Components folder, that folder gets nuked when a Grasshopper update is installed. Either put it in %appdata%GrasshopperLibraries or use an RHI installer* or use a custom installer and put a *.ghlink file in the %appdata%GrasshopperLibraries folder.
We will try and load .NET dlls from all sensible locations, but I don’t think we handle C++ dlls at this point. I sincerely doubt we’ll be messing with environment variables (there’s all sorts of user privilege problems there I think). If the dll you need is next to your GHA file, you should be able to load it yourself from a GH_AssemblyPriority derived class.
* I’m not entirely sure whether this will work yet for non RHP installs, but this will definitely be the official recommended method soon
Permalink Reply by Giulio Piacentino on February 23, 2011 at 2:36am
(from 7:30 to about 8:30)
McNeel Europe, Barcelona
Permalink Reply by Nathaniel Musial on October 3, 2015 at 8:21am
How to install Ladybug for Grasshopper
Ladybug is a free plugin for Grasshopper that uses the EnergyPlus engine to provide a range of environmental calculations and visuals for input geometry. This guide will show you how to install Ladybug.
If you are looking to install the more recent Ladybug + Honeybee components for Grasshopper, this guide will help you too.
Check you have the right software
Firstly, you need Rhino 5. Rhino 4 won’t do! You can download a free trial here .
You also need Grasshopper, a free plugin for Rhino. Download the latest version here.
Then you need GHPython. Download it, and unzip it. In GH, open your components folder:
This should open a folder in a location like C:UsersjramsdenAppDataRoamingGrasshopperLibraries . Paste GHPython.gha into this folder.
Visit the Ladybug page, take a read of it and have a look at the video. Then download the unlocked version from the page (or quicklink here). This should download a zip folder. Unzip this folder (the next step won’t work if you don’t unzip it first!).
Within the folder should be about 28 .ghuser files. Select them all and drag them directly into the GH window.
Done! To double-check, go to your GH User Object folder under the Special Folders as above (e.g. C:UsersjramsdenAppDataRoamingGrasshopperUserObjects). The .ghuser folders should be in here.
Now a new tab should have appeared in your GH window called Ladybug.
There are 5 categories of components, labelled 0-4. In using Ladybug, these are run through roughly in order.
Meshedit is a set of components which extend Grasshopper’s ability to work with meshes.
- Mesh from points
- Mesh cull unused vertices
- Mesh flip
- Mesh unify normals
- Mesh weld vertices with threshold
- Mesh Area
- Mesh Volume
- Mesh explode
- Mesh convert quads to triangles
- Mesh add attributes
- Mesh extract attributes
- Mesh find naked edges
«based on MIConvexHull by David Sehnal, Matthew Campbell»
- Convex Hull Points 2D/3D
- Convex Hull Mesh/Plankton Mesh
- Delaunay Tetrahedron Polyline/Plankton Mesh
- Voronoi Polyline/Plankton Mesh
If you find anything else useful please let us know!
- In Grasshopper, choose File > Special Folders > Components folder. Save the gha file there.
- Right-click the file > Properties > make sure there is no «blocked» text
- Restart Rhino and Grasshopper
if you encounter any problems or you need help, join our discussion now:
Your First Component (Windows)
This guide walks you through your first custom Grasshopper component library using Visual Studio.
It is presumed you already have the necessary tools installed and are ready to go. If you are not there yet, see Installing Tools (Windows).
We will use the Grasshopper Assembly templates to create a new, basic, component library called HelloGrasshopper.
If you are familiar with Visual Studio, these step-by-step instructions may be overly detailed for you. The executive summary: create a new project using the Grasshopper Assembly template, build and run, and then make a change.
We are presuming you have never used Visual Studio before, so we’ll go through this one step at a time.
- If you have not done so already, launch Visual Studio (for the purposes of this guide, we are using Visual Studio 2017 Community Edition and C#).
- Navigate to File >New >Project…
- A New Project wizard should appear. In the left column, find the Installed >Templates >Visual C# >Rhinoceros section. In the central list, select the Grasshopper Add-On template…
- For the purposes of this Guide, we will name our demo plugin HelloGrasshopper. At the bottom of the window, fill in the Name field. Browse and select a location for this project on your disk…
- The New Grasshopper Assembly dialog appears. Check the Provide sample code checkbox.
- This is where you fill out information about your first component:
- Add-on display name: the name of component library itself.
- Name: the name of the component as displayed in the ribbon bar and search menus.
- Nickname: the default name of the component when inserted into the canvas.
- Category: name of tab where component icon will be shown.
- Subcategory: name of group inside tab where icon will be shown.
- Description: description shown in tooltip when mouse is over the component icon in the menu.
- For the purposes of this guide, we will accept the defaults and click Finish…
- A new solution called HelloGrasshopper should open…
- Before we do anything, let’s build and run HelloGrasshopper to make sure everything is working as expected. We’ll just build the boilerplate Plugin template. Click Start (play) button in toolbar corner of Visual Studio (or press F5) to Start Debugging…
- Rhinoceros launches.
- Since this is the first time you are debugging the components, you need to tell Grasshopper where to look. In the Rhino command prompt, run the GrasshopperDeveloperSettings command…
- Uncheck the Memory load *.GHA assemblies using COFF byte arrays checkbox.
- Click the Add Folder button and add your bin output folder of your project to Grasshopper’s search path. NOTE: You only need to do this step once during the development of your component, unless you move it elsewhere.
- (Optional) Automatically start Grasshopper every time Rhino starts…
- Navigate to Tools >Options >General.
- In the Run these commands every time Rhino starts text area, type _Grasshopper then click OK.
- Run the Grasshopper command to start Grasshopper. If you don’t blink, you might see Grasshopper say it is loading “HelloGrasshopper” in the status bar of the splash screen.
- Navigate to Curve >Primitive in the components menus. You should see HelloGrasshopper in the list with a blank icon. Drag this onto the canvas. The component should “work.”
- Exit Rhinoceros. This stops the session. Go back to Visual Studio. Let’s take a look at the…
- Use the Solution Explorer to expand the Solution (.sln) so that it looks like this… NOTE: Depending on your edition of Visual Studio, it may look slightly different.
- The HelloGrasshopper project (.csproj) has the same name as its parent solution…this is the project that was created for us by the Grasshopper Assembly template wizard earlier.
- Properties contains the AssemblyInfo.cs source file. This file contains the meta-data (author, version, etc) about the component library.
- References: Just as with most projects, you will be referencing other libraries. The Grasshopper Assembly template added the necessary references to create a custom Grasshopper component.
- GH_IO — or GH_IO.dll — is the Grasshopper Input/Output library required to read and write Grasshopper files.
- Grasshopper — or Grasshopper.dll — is the Grasshopper base namespace.
- RhinoCommon — or RhinoCommon.dll — is the Rhinoceros .NET SDK.
- System, System.Core, System.Drawing, System.Windows.Forms are .NET foundational libraries.
- HelloGrasshopperInfo.cs contains the component library information, such as the name, icon, etc.
- HelloGrasshopperComponent.cs is where the action is. Let’s take a look at this file…
Open HelloGrasshopperComponent.cs in Visual Studio’s Source Editor (if it isn’t already).
Notice that HelloGrasshopperComponent inherits from GH_Component …
HelloGrasshopperComponent also overrides two methods for determining the input and output parameters …
The actual work done by the component is to be found in the SolveInstance method…
As you can see, this is where the action happens. This boilerplate component creates a spiral on a plane. Just to make sure everything is working, let’s change the default plane on which the spiral is constructed. On line 1 67, in SolveInstance , notice that an XY plane is constructed…
Further down in the SolveInstance method, you will notice that the input data is being fed into this plane…
Go back to the RegisterInputParams , and find the line where the Plane input is registered. The last argument being fed to the method — Plane.WorldXY — is the default value of the input…
Change the default value of the Plane input to be Plane.WorldYZ …
- Set a breakpoint on line 1 99 of HelloGrasshopperComponent.cs. You set breakpoints in Visual Studio by clicking in the gutter…
- Build and Run.
- In Grasshopper, place a HelloGrasshopper component on the canvas…as soon as you do, you should hit your breakpoint and pause…
- The reason you hit the breakpoint is because the SolveInstance method was called once initially when the component was placed on the canvas. With Rhino and Grasshopper paused, in Visual Studio switch to the Autos tab (if it not already there). In the list, find the plane object. Our plane is a Rhino.Geometry.Plane with a value of
…an YZ plane, the default, as expected.
- Continue in Grasshopper by pressing the Continue button in the upper menu of Visual Studio (or press F5)…
- Control is passed back to Grasshopper and the spiral draws in the Rhino viewport. Now, place an XY Plane component on the canvas and feed it as an input into HelloGrasshopper’s Plane input. Notice you hit your breakpoint again, because the SolveInstance is being called now that the input values have changed.
- Exit Grasshopper and Rhino or Stop the debugging session.
- Remove the breakpoint you created above by clicking on it in the gutter.
Congratulations! You have just built your first Grasshopper component for Rhino for Windows. Now what?
You’ve built a component library from boilerplate code, but what about putting together a new simple component “from scratch” and adding it to your project? (Component libraries are made up of multiple components after all). Next, check out the Simple Component guide.
Line numbers in Visual Studio can be enabled and disabled in Tools > Options… > Text Editor section > All Languages entry > General sub-entry > Settings subsection > check Line numbers. Click OK to close the Options dialog. ↩ ↩ 2