Using Rhino.Runtime.Skin virtual methods to set AppearanceSettings


(Chris Rafuse) #1

Hi All,

I’m trying to wrap the Rhino executable so it appears to be my own application. To that end, I’m trying to show/hide menu items and change AppearanceSettings.

I’ve followed the steps to creating a custom skin Creating A Skin and it appears that the app loads the .rhs file (the splash screen is gone, and the app has an open filehandle to the .rhs file).

I’ve overriden OnEndLoadAtStartPlugIns and ShowSplash and have the following code in both:

.RhinoApp.Write(“Hellow World!”);
Rhino.ApplicationSettings.AppearanceSettings.MenuVisible = false;
Rhino.ApplicationSettings.AppearanceSettings.CommandPromptBackgroundColor = System.Drawing.Color.Yellow;

However, none of these calls are visible in the running application. What am I missing ?


#2

And why do you do such a thing?


(Chris Rafuse) #3

Because Rhino has all of the functionality required, but can not be distributed as a linked library to another executable. The only way to use its functionality is to wrap the Rhino executable. Compare that to writing a 3D modeling API yourself (because there are so few out there), and the answer seems clear.


(Dale Fugier) #4

Hi @chris.rafuse,

Turning off Rhino UI components, such as the menu, etc., is something you should from within a companion plug-in, no from a Skin DLL.

Does this help?

– Dale


(Chris Rafuse) #5

HI Dale,

I will try developing a companion plug-in to test it out and get back to you. Sounds like plan so far.

Can you guess as to why calls like RhinoApp.Write() would not work when called from OnEndLoadAtStartPlugIns ?


(Chris Rafuse) #6

Also, is it possible to hide the file menu ? Replace it with your own ?


(Dale Fugier) #7

Hi @chris.rafuse,

I doubt Rhino is really ready to do anything when this function is called. Better to create an On Idle event handler, which will be called when Rhino is up and running.

It is. There is an app setting to turn off the menu. If you want to replace it, consider providing your own custom .RUI file that has menus. You can also replace the menus from a C++ Skin DLL. Here is an example:

https://github.com/mcneel/rhino-developer-samples/tree/6/cpp/SampleSkin

– Dale


(Chris Rafuse) #8

Hi @dale ,

Thanks for the info. I decided to familiarize myself with customizing menus by following Adding a Custom Menu

I have Rhino 6 loading the PlugIn DLL with the code from the tutorial, but Rhino crashes when I click the ‘Tools’ menu after I run the command associated with ‘CCommandMyMenu’. I stepped through with the debugger and the call to InsertPlugInItemToRhinoMenu returns TRUE.

The code can be found here

The C++ code doc indicates that the custom menu methods of CRhinoApp may not be implemented ?


(Dale Fugier) #9

Hi @chris.rafuse,

There is a custom skin sample in the Rhino developer samples repo:

https://github.com/mcneel/rhino-developer-samples

Build the SampleSkin and SampleSkinHander projects found in the cpp folder.

– Dale


(Chris Rafuse) #10

Thanks Dale,

I apologize: I missed the override of MainRhinoMenu in SimpleSkinApp.cpp. I now have the main menu replaced with events being handled by the plugin.

Thank you for you help.