Normally when starting a custom made component in Rhino, you can find it in the assigned map. For example in Maths under Script with an image like below:
This is the first time I used Visual Studio (2017) on Windows (instead of Mac) and my problem is when I start Rhino I can’t find the custom component. Does is work differently on Windows?
Can someone please help me out?
Thanks a lot in advance for any help!
Kind regards,
Zooey
Icons may be on the dropdown portion of a panel only, or even hidden altogether depending on their exposure. What is the Exposure property set to in Visual Studio?
(1) and (2) are not the issue! If (1) means that while starting Rhino errors pop up. I am using Rhino 6, but Visual Studio 2017 (don’t know if that makes a difference)! How can I fix this?
Maybe. Maybe just a mention in the command line. Maybe nothing if Grasshopper thinks it somehow isn’t supposed to load it. The point is you should be able to use the component if it’s loaded.
Does it show up when you search for it from within the double-click popup? You can instantiate a component by dragging text which represents the ComponentID onto the canvas.
If neither of those things work, the most likely explanation is that the component isn’t getting loaded. Are you hitting breakpoints in Visual Studio during debugging that would indicate Grasshopper is loading your plug-in assembly?
These are the usual things that need to happen if you want to Debug a plug-in assembly using Visual Studio:
VS needs to output a file called <MyPluginName>.gha instead of <MyPluginName>.dll. The plugin wizards will usually take care of this, but if that’s not working you need to set up a post-build event by hand to rename the dll file.
This gha file will by default be in either the \bin\Debug\ or bin\Release\ folder. I actually don’t like having two versions of the same project next to each other with different states, so I change my build flavour output directory to just be \bin\ for both Debug and Release builds. I do not know if the VS wizards also sets this up this way.
Now when you build/compile your project you should get a new <MyPluginName>.gha file somewhere inside \bin\? with a current timestamp.
Next up Grasshopper needs to learn that it is supposed to load this gha file. The easiest way to set this up is to run the _GrasshopperDeveloperSettings command in Rhino and add your bin folder to the list of folders in which Grasshopper looks:
Also make sure that Memory Load *.GHA... is unchecked, or breakpoints won’t work.
Lastly, you must make sure that when you begin debugging, Visual Studio knows that it’s supposed to start Rhino. This is taken care of by the wizard, but you can also set the start action via the VS UI:
You should now be set to debug your project. Put a breakpoint on the first line of the constructor of your component and start the debugger. Rhino should load. Run the _Grasshopper command and your breakpoint should turn from an open circle into a closed disk once your plugin gets loaded. It should also hit the breakpoint as all components are constructed once during load.