Can I load an environment file via the SDK/RDK?


I had a look to the RDK sample concerning environment (RDK Current Environment with C/C++). This example shows in my understanding, how to create another environment and make another environment active.

But is there any possibility to load an environment file (e.g. from Rhino’s Render content) via the SDK? In my case I want to load and activate a specific environment file for reflection when I change to a PlugIn specific display mode.


You can load the environment file as string in memory, then use CRhRdkContent::FromXMLStream to create the environment in memory. Then follow the sample further to set as reflection environment.

See also RhRdkLoadContentFromFile

OK, thanks! Will try that.

It works, many thanks!

Just another question concerning this topic: If I import a new environment,how can I find out if this special env is already in the document?

I tried it with comparing UUIDs, but it looks every add will create a new UUID (understandable).

Then I was looking to the function

virtual void IRhRdkCurrentEnvironment::CopyFrom ( const IRhRdkCurrentEnvironment & ce )

to replace the current envronment by my imported one. But I do not know, how to get a IRhRdkCurrentEnvironment from my imported CRhRdkEnvironment

OK, it looks as if something like this may help to identify a previously loaded render content:

const CRhRdkContent *pExistingContent = Doc->Contents().FindSimilar(LoadedEnvironment);

if (pExistingContent)
RhinoApp().Print(L"Environment already loaded previously\n");


Use the RenderCRC to determine if a render content is functionally the same.


Yup. FindSimilar will also compare the names.


Oh - and I missed one of your questions…

You get IRhRdkCurrentEnvironment from CRhinoDoc::CurrentEnvironment