Get Advanced Options in C++?

Hi,

I need to get and change some advanced options like in this thread Need to set Advanced Options in script runtime, in C++.

I tried this line with no success:
CRhinoSettings* settings = CRhinoSettings::GetPlugInSettings(RhinoApp().RhinoCurrent_UUID(), false);

settings is a null pointer… How should I get it properly?

Thanks,
Pablo

Hi @Pablo_Garcia-Amorena,

What “advanced options” are you trying to get?

– Dale

Hi
I think you want to retrieve OpenGL settings which are available at
RhinoApp().AppSettings().OpenGLSettings()

For details:
https://developer.rhino3d.com/api/cpp/class_c_rhino_open_g_l_settings.html

Hi @dale,

I’m referring to the options I get in Rhino Options -> Advanced. For example I want to get Rhino.Options.Appearance.ViewportBackgroundColor and modify it. In C# it’d be something like this:

PersistentSettings settings = Rhino.PlugIns.PlugIn.GetPluginSettings(RhinoApp.CurrentRhinoId, false);
PersistentSettings options = settings.GetChild("Options");
PersistentSettings appearance = options.GetChild("Appearance");
appearance.SetColor("ViewportBackgroundColor", Color.FromArgb(255, 0, 0, 0));

How to do it in C++? It’s to be inserted in a skin project I’m developing.

Many thanks,
Pablo

Why don’t you just do this? Your Skin project references RhinoCommon…

Rhino.ApplicationSettings.AppearanceSettings.ViewportBackgroundColor =
    System.Drawing.Color.FromArgb(255, 0, 0, 0);

In C++, you’d do this:

CRhinoAppAppearanceSettings settings = RhinoApp().AppSettings().AppearanceSettings();
settings.m_viewport_background_color = ON_Color::Black;
RhinoApp().AppSettings().SetAppearanceSettings(settings);

– Dale

I’m writing it in C++, as the related skin plugin is also in C++.

Thanks! It works.

Pablo