You’re a wizard, Daniel! Thanks for sharing this.
WOOOOOOW
i will open it right now!!! but amazing!!! THANKS SO MUCH
man this is all I NEEDED!!!
<3
when i finish my project I will attach some image to let you know how helpful you were!!!
Would it be possible to make it macOS compatible please?
When I open it, it asks for the KangarooSolver.dll. I downloaded the latest K2 Release from Food4Rhino and placed only the dll into the GH components folder, since Kangaroo is already included somewhere else, but I couldn’t find it.
However, the C# component still raises 2 warnings and an error.
Both warning (CS1701) are about the version of RhinoCommon. The component asks for some kind of runtime policy?
The error (CS0246) is due to the fact that the component can’t find the type or namespace KPlankton
. An assembly reference seems to be missing!
I have the Plankton dlls installed inside the components folder.
Hi @diff-arch,
This script isn’t actually using KPlankton at all, I must have left that reference in by mistake.
If you delete line 27 (‘using KPlankton’) in the ShrinkByColour script I think it should work for you.
The other warnings can be ignored.
Hm, line 27 is double RestLength = L * (c.R / 255.0);
and I’ve searched the rest of the code and there is no using KPlankton
or Kplankton
to be found anywhere?
The script editor is split in two!
The top part includes only one line, where the ShrinkByColour
class is instantiated and output through A
.
The bottom part includes the ShrinkByColour
class with all its methods. Nothing more.
try opening your own C# button
and copy the information of Daniel’s
the first part in the top window and the second part in the bottom window and try to run it
i used to have mac and C# codes used to work the same
I see what you mean now.
I’m actually not sure whether it is currently possible to reference the KangarooSolver.dll included with Rhino from a Grasshopper C# script component on a Mac. I think the file is contained in the Rhinoceros.app bundle, but there doesn’t seem to be any way to get to this from the C# script assembly reference manager.
@dan might know if there is a way around this?
it should be possible
Have you checked if you have the Kangaroo 2
if you have the previous one is not gonna work, you need to have the solver of Kangaroo 2
Perhaps. App bundles on macOS are just directories with a special .app extension that makes them look/behave like an application. The full path to that solver would likely be:
/Applications/Rhinoceros.app/Contents/Frameworks/RhCore.framework/Versions/A/Resources/ManagedPlugIns/GrasshopperPlugin.rhp/Components/KangarooSolver.dll
Thanks Dan.
I can find the dll in the location you say via Finder, but I’m still at a loss how to actually add it in the C# component’s Referenced Assembly>Add window, because there the applications are all greyed out and there seems to be no way to explore their contents.
Oh yeah, that’s probably by design. This dirty-hack might work, as a temporary shim:
- Use Finder to rename Rhinoceros.app to Rhinoceros (remove the extension). macOS will ask if you are sure and tell it you want to (this is non-destructive as long as you change it back).
- Launch Rhino by going to the /Applications/Contents/MacOS/ folder and double-click the Rhinoceros executable (it should start via Terminal).
- Try to reference the assembly at the path above.
- When done, quit Rhino, then add the .app extension back to Rhinoceros to turn it back into an app.
Probably not a good long-term solution, so we might need to gin-up a better workaround if this is a frequent need.
PS: In most Finder windows, there’s a “Show Package Contents” item in the right-click menu, but I bet the explorer window in GH lacks that option.
Yep, as a long term macOS user, I’m aware of that. Thanks for the absolute path to the dll. Entering this when prompted for an unresolved reference solved the issue I had!
@DanielPiker, @dan, entering the path into the dialogue, instead of the whole app renaming business seems to be a better, less unprofessional idea (for a pro app)!!
Another long-term solution could simply be to make Rhino/Grasshopper aware of where official dependencies (like K2) are located on Windows AND macOS, so that it knows what to chose in each case. Seems to work fine on Windows…
Another curiosity is that the IMG (Import Image) component seems to differ between the Windows and Mac version. I couldn’t get the component from Daniel’s file to run without errors, however when I replaced it, it worked fine.
Ah yes, I was forgetting it gives you a chance to resolve it with a file path when you first open. Much easier! (Dan’s workaround did work though) Thanks both
Turns out, it doesn’t even work with the latest version from Food4Rhino. You need the official compiled library that comes bundled with Rhino since release 6.
I ran in to the same issue. Tried to paste the file path mentioned by Dan, however the text turns red and I cannot confirm it:
Also tried the workaround and follow the file path manually however GrasshopperPlugin.rhp
is greyed out…
Is there something that I have overlooked?
Hey,
The absolute unix path pointing to the KangarooSolver.dll for the latest version of Rhino 7 is:
/Applications/Rhino\ 7.app/Contents/Frameworks/RhCore.framework/Versions/A/Resources/ManagedPlugIns/GrasshopperPlugin.rhp/Components/KangarooSolver.dll
However, since we’re dealing with some sort of Windows workflow here that haphazardly also seems to work on macOS, you need to get rid of the backslash that escapes the whitespace between .../Rhino\ 7.app/...
. Naked whitespace is not allowed on unix-based systems, is considered a special character, and as such needs to be escaped with a backslash.
My guess is that this confuses the C# “path parser”, since it expects only back- or forward slashes. This dialogue doesn’t seem to be fully ported for good multi-platform support. It still needs some love!
I’ve tested it and am confident that the following path should work (if you’ve installed Rhino in the default location)!
/Applications/Rhino 7.app/Contents/Frameworks/RhCore.framework/Versions/A/Resources/ManagedPlugIns/GrasshopperPlugin.rhp/Components/KangarooSolver.dll
Previously, Rhino was called “Rhinoceros.app” by default, which didn’t pose an issue.
Thank you for detailed answer!
this path worked!
Have a great weekend!
Rudi
Kein Problem! Dir auch ein schönes Wochenende!
Yess! Worked on Macbook m1 pro Monterey Rhino7