Hi all,
Hi everyone,
I’m trying to use Grasshopper plugins inside a standalone C# application (Visual Studio 2019) by running Grasshopper in a headless Rhino.Inside / RhinoCore environment. As a test case, I’m attempting to call the Dendro plugin programmatically. I wrote the following test code:
// New GH document
var ghDoc = new GH_Document();
Instances.DocumentServer.AddDocument(ghDoc);
// Instantiate Dendro components
var curveToVolume = _curveToVolumeProxy.CreateInstance() as GH_Component;
var volumeToMesh = _volumeToMeshProxy.CreateInstance() as GH_Component;
if (curveToVolume == null || volumeToMesh == null)
throw new Exception("Could not instantiate Dendro components.");
ghDoc.AddObject(curveToVolume, false);
ghDoc.AddObject(volumeToMesh, false);
// --------------------------------------------------
// 1) Create DendroSettings instance via reflection
// --------------------------------------------------
object settings = Activator.CreateInstance(_dendroSettingsType);
SetDendroDoubleProperty(settings, "VoxelSize", radius / 3.0);
SetDendroDoubleProperty(settings, "Bandwidth", 1.0);
SetDendroDoubleProperty(settings, "IsoValue", 0.01);
SetDendroDoubleProperty(settings, "Adaptivity", 0.1);
var settingsGoo = new GH_ObjectWrapper(settings);
var path = new GH_Path(0);
// --------------------------------------------------
// 2) Feed CurveToVolume
// --------------------------------------------------
curveToVolume.Params.Input[0].AddVolatileData(path, 0, new GH_Curve(curve)); // C
curveToVolume.Params.Input[1].AddVolatileData(path, 0, new GH_Number(radius)); // R
curveToVolume.Params.Input[2].AddVolatileData(path, 0, settingsGoo); // S (settings)
here I can set curve and radius values. But, somehow the code doesn’t see my definition for settings. Has anyone successfully passed settings into a Dendro component programmatically?