Decode results from GrasshopperCompute.EvaluateDefinition

Hi guys,

I am scratching my head a lot here trying to decode the results from GrasshopperCompute.EvaluateDefinition()

I can see that it’s returning me some GrasshopperObjects but I could not find an example to convert them back as Rhino.Geometry.Mesh.

Is there any C# examples on how to do it?

Here is a very spartan example: rhino-developer-samples/compute/cs/SampleGHSolve at 7 · mcneel/rhino-developer-samples · GitHub

tl;dr I did tlhis to get the resulting geometry out:

var result = Rhino.Compute.GrasshopperCompute.EvaluateDefinition(definitionPath, trees);
var data = result[0].InnerTree.First().Value[0].Data;
var parsed = JsonConvert.DeserializeObject<Dictionary<string, string>>(data);
var obj = Rhino.FileIO.File3dmObject.FromJSON(parsed);

I imagine there is probably a better way to go about it. I’ll dig in a bit further.

1 Like