-
RhinoCodePlatform.Rhino3D.Languages.Python3Script.Create();
is a static method on the basePythonScript
class that ALWAYS creates an IronPython script using the legacy IronPython plugin. -
Python3Script
is undocumented and unsupported API at this point. It does not even work in Rhino 8 as it was made to use internally in Rhino 9. - Any dll that is named
RhinoCodePlatform.*
is undocumented API
RhinoCode API
The core api for running scripts in Rhino >=8 is called RhinoCode and is under Rhino.Runtime.Code
and is still being matured under Rhino 8 and is undocumented.
However, to be a bit more future-proof use this api:
using Rhino.Runtime.Code;
using Rhino.Runtime.Code.Execution;
// context holds execution configs, and input/output parameters
var ctx = new RunContext {
AutoApplyParams = true,
Inputs = {
["x"] = 21,
["y"] = 21,
},
Outputs = {
["a"] = 0
}
};
// run script with created context
RhinoCode.RunScript("#! python 3\na = x + y", ctx);
// inspect context for return values
a = ctx.Outputs.Get<int>("a");
This api is language agnostic. Note that language specifier is added to the script itself:
NestedScripts.gh (9.4 KB)
It is worth noting that this API is fairly low level and is still maturing but all the new scripting functionality is built on top of this and does not have any legacy dependencies.