Grasshopper Python and plugins

Hi
Is it possible to control settings of plugins installed in Rhino with GhPython?

It probably depends on a lot of things, but you can certainly access the Rhino.Plugins namespace and go from there.

1 Like

Thank you i will try that

I think you maybe want to call this method:

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_PlugIns_PlugIn_GetPluginSettings.htm

And get/set the settings in this dictionary:

https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_PersistentSettings.htm

Yes i tried that , but i don’t have any idea i will check the link

import rhinoscriptsyntax as rs
import Rhino as rh

a = rh.PlugIns.RenderPlugIn.Id
print a

#rh.PlugIns.RenderPlugIn.GetPluginSettings(

This is again pure guesswork, but I think methods such as Rhino.PlugIns.PlugIn.GetPluginSettings take the guid of the plugin. Which you can find here, for Grasshopper for instance:

1 Like

Thanks , very helpful but i don’t get settings

What do you mean by plugin settings?

For example i have Maxwell render and i want control its settings with Grasshopper

That’s just the class instance object, you’ll need to traverse this and get/set the settings. Try calling e.g. this property on your a variable, see if that returns a list of the parent settings (again, this is mostly conjecture as I’ve never fiddled with this part of RhinoCommon):

https://developer.rhino3d.com/api/RhinoCommon/html/P_Rhino_PersistentSettings_Keys.htm

I have no idea about that
i get the ID from the name but other things are not easy to get; i will try to understand

image

Why are you trying to get these settings with RhinoCommon instead of importing the Maxwell dotnet library and create your own instance of the class?

I don’t have experience with that
What i want is like when i adjust camera settings of rhino
I want control maxwell settings , i don’t want create a plugin

Which SDKs does Maxwell for Rhino expose? I searched but I cannot find definitive information.

Regarding general render settings, maybe @andy, who wrote our “RDK” (Render Developement Kit for Rhino) can tell more, or maybe @dale has heard some additional information and can share.

The plugin of course already exist but what i need is to control the settings already exist in rhino
i don’t know about programming and sdk
i asked in maxwell forum but still no answer since weeks

Can you add a link here?
If they only provide the plug-in, it might not be enough to easily script the plug-in itself.

They provide the plugin and Pymaxwell to create plugins or anything related to maxwell
So i think in Grashhopper is possible and i see someone created some component for maxwell materials and it is available in food4rhino.
my request here about adding support for grasshopper to the plugin(like vray)

https://forum.maxwellrender.com/viewtopic.php?f=153&t=45110&start=105

other request:

https://forum.maxwellrender.com/viewtopic.php?f=10&t=45400

I’ve been trying to piece together this thread and your other thread on importing PyMaxwell in GHPythonRemote and I’m not 100% sure what it is you are trying to do. I’m assuming it is to take some geometry that has been baked in Rhino from a GH definition, and render it using the Maxwell renderer with custom parameters from GH. You might be setting yourself up for some unnecessary pain with this.

It feels like PyMaxwell in GH would be quite a difficult way to achieve that, as it doesn’t look like it interacts with the Maxwell in Rhino plugin. Rather, I think it lets you read a Maxwell scene file, modify it and render it programatically as if you were using the plain Maxwell GUI (no Rhino involved). Unless Maxwell in Rhino has an API that you can interact with in some way, trying to keep all the code in Rhino/GH will be difficult. If there is such an API or SDK, the approach in this thread is surely your best bet, without GHPythonRemote.

Maybe a better approach would be to find a way to export your Rhino geometry to a format that Maxwell can read, and then use PyMaxwell outside of Rhino to render this file? Again, no GHPythonRemote needed here.

Thank you but the two threads are differents and what i want is different ideas
the other thread i want to use Pymaxwell to modify maxwell scenes ,i already did that before with python.
but in this one i want know if it is possible to contol any plugin parameters ( maxwell as example)
for example maxwell render exist in the menu with all parameters
i can get the id but how i can get those parameters to change them with grasshopper

Hi @seghierkhaled

Maxwell needs to give you an interface (usually called Application Programming Interface, API), so that you can change its parameters. Otherwise, the only official way to control a third-party add-on we can suggest is to instrument the mouse, which I don’t think it is something you are planning on doing.

This means that asking on the Maxwell forums was a good idea!