Hi everyone,
I was trying to use some grasshopper-based analysis results in my native Rhino Plugin. Let’s assume I want to use this data as some Head-Up Display using with DisplayConduits.
When I try to reach values using with this code; (It was just for test)
string componentName = "";
RhinoGet.GetString("Which component do you want to search?", false, ref componentName);
ComponentFunctionInfo component = Components.FindComponent(componentName);
string result = component.OutputDescriptions[0];
Console.WriteLine(result );
When I debug this code lines in Rhino typing componentName
,
Although component exist in Grasshopper with its name, Components.FindComponent
function returns null
.
What am I missing?
Thanks in advence,
-Oğuzhan
[UPDATED QUESTION]
I solved returning null
problem, I’ve just noticed that it was a typing error.
My question now, how possibly I can reach output values of component on runtime? Where is gh data stored in Rhino?
Thanks
private void RunScript(Guid id, ref object A)
{
var component = Component.OnPingDocument().FindComponent(id);
A = component.Params.Output[0].VolatileData.AllData(false);
}
VolatileData.gh (8.6 KB)
1 Like
Hi @Mahdiyar,
I got your point, it can be useful for me, briefly I guess I need to use Grasshopper library in my native Rhino plugin as reference, right? Because Component
object coming from Grasshopper.Kernel namespace, thats why I couldn’t reach this objects in VisualStudio.
Thanks for your explanatory answer!
-Oğuzhan
Hi @Mahdiyar,
I tried your way in VisualStudio but there is a problem that I have been encounteering. In Grasshopper, C# Script Component has some default definitions intrinsically like Component
in region of Member.
#region Members
private readonly RhinoDoc RhinoDocument;
private readonly GH_Document GrasshopperDocument;
private readonly IGH_Component Component;
#endregion
In your way you are using this intrinsic definitions to call ...OnPingDocument().FindComponent(id);
this part, but in my native Rhino plugin I cannot use Component
object, because it cannot initialized. Do you have any suggestion?
-Oğuzhan