Access Grasshopper

grasshopper

(Dimi Christop) #1

Hi
i have this rhino plugin in windows (rhino 5) and would like to port it to Mac Rhino 5.4xx (latest)
At some commands in the plugin i need to access Grasshopper to issue a
gh.DisableBanner(); and gh.LoadEditor(); etc

The code is as follows but as soon as GetPluginObject is executed the RhinoPlugin exits.
I also can not access the Grasshopper.Plugin or Grasshopper.Instances. namespaces, I tried to add a reference to Grasshopper but it does not show up. The nugget package that shows up In VisualStudio for Mac lists that its only for Rhino5.
How do i get access to Grasshopper?

Thanks

       // Get the Grasshopper plug-in object.
        dynamic gh = RhinoApp.GetPlugInObject("Grasshopper");

        // Load Grasshopper and open the algorithm file.
        gh.DisableBanner();
        gh.LoadEditor();

        // Disable auto saving to avoid dialogs that require use action.
        var s = Grasshopper.Instances.Settings;
        s.SetValue("AutoSave:Enable", false);

Grasshopper SDK for Mac
(Dimi Christop) #2

I am also not able to Create any grasshopper plugin with the VStudio Mac Rhino Addin from the Gallery

Selecting the grasshopper template, Results in missing Rhino and Grasshopper packager,
I was able to find through Nuget the right RhinoCommon but not a suitable grasshopper.
Are we able to create a grasshopper mac plugin with the latest mac rhino?
Following the Guide http://developer.rhino3d.com/guides/grasshopper/your-first-component-mac/ does not work due to these problems


14

42


Access Grasshopper Through RhinoPlugin
(Dimi Christop) #3

It seems that although i have the latest Rhino Mac installed and there are no newer Rhino Mac VIP
05

There is no build in grasshopper.dll bundled with Rhino on Mac, i looked through /Applications/Rhinoceros.app/Contents/Resources/
There are build in RhinoCommon, Rhino.UI, Eto dlls but no Grasshopper.
Using the nuget grasshopper or RhinoCommon packages on Mac result in a plug-in not compatible.

It seems Grasshopper development is not possible at mac at this time,
irrespective what the Developer Documentation says.


(Curtis Wensley) #6

Hey @dimi.christop,

The Grasshopper project template actually assumes that you are using the RhinoWIP.app, not Rhinoceros.app. It needs to be updated now that Grasshopper is built in to the official v5 release. I have created a YT issue to fix that up.

For now, what you can do is this.

  1. Create a Grasshopper component using the project template.
  2. Right click on the project node and go to Tools > Edit File
  3. Replace any occurrence of RhinoWIP.app with Rhinoceros.app
  4. Save and close the csproj
  5. Run & Enjoy!

Hope this helps!
Curtis.


(qythium) #7

Hi, I think you can find it in the following location, along with GH_IO, GH_Util, and all the built in components :slight_smile:

/Applications/Rhinoceros.app/Contents/Resources/ManagedPlugIns/GrasshopperPlugin.rhp/Grasshopper.dll


(Dimi Christop) #8

Hi
thanks a lot both post were very helpful i was able to compile a Grasshopper template.
My goal was to access using a Rhino plugin the grasshopper plugin to se some states
dynamic gh = RhinoApp.GetPlugInObject(“Grasshopper”);
gh.DisableBanner();
gh.LoadEditor();

I experience some strange behaviour and I don’t know if this is related tho this thread.
The strange thing now is that if i create a Rhino plugin form the template and add manually the grasshopper.dll from the location described above the Plugin command is not recognised anymore. As soon as i uncheck the the Grasshopper.dll the plugin command is found again. This is very strange as on windows i could access grasshopper from a Rhino plugin.

Thanks
Dimi


(Curtis Wensley) #9

Hi @dimi.christop,

Just to follow up, there is now a new version of the VS for Mac addin here that has updated templates.

I’m not sure why you are seeing that behaviour, but it could be a bug in VS for Mac. What I’d try is to reference the correct assemblies, then close VS for Mac and reopen. You may have to clean your bin/obj folders as well.

Hope this helps!
Curtis