Sending Point geometry back to GH via rhino.compute

Hi all!

I am trying to send point geometry back to a grasshopper definition via rhino compute.

Perhaps @AndyPayne or @stevebaer might know something about this.

The array of coordinates is formatted to branch [0] but receives the error:

"Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: {. Path ‘values[4].InnerTree.0[0].data’

what is the correct format for sending an array of values? I have tried the below variations but still not accepted:

param5 DataTree: {“data”:{“ParamName”:“RH_IN:points”,“InnerTree”:{“0”:[{“data”:[{“X”:1616.51,“Y”:4282.157,“Z”:0},{“X”:4802.936,“Y”:3519.08,“Z”:0},{“X”:-1958.594,“Y”:3401.964,“Z”:0},{“X”:-3240.851,“Y”:2638.887,“Z”:0}]}]}}}

param5 DataTree: {“data”:{“ParamName”:“RH_IN:points”,“InnerTree”:{“0”:[{“data”:{“X”:1616.51,“Y”:4282.157,“Z”:0}},{“data”:{“X”:4802.936,“Y”:3519.08,“Z”:0}},{“data”:{“X”:-1958.594,“Y”:3401.964,“Z”:0}},{“data”:{“X”:-3240.851,“Y”:2638.887,“Z”:0}}]}}}


Are there any examples or guides for how to structure the datatree in JS for sending back complex geometries of array back to rhino.compute?

Thank you!

Michael

If you use contextual inputs like you are doing, you do not need to group and label the input with RH:IN.

I would rename the input to something else like “points”.

Then you’d have:

const param5 = new RhinoCompute.Grasshopper.DataTree('points')

1 Like

Thanks that worked!

Just a question on other geometry types such as sending meshes.

Can they be converted using .3dm library and sent across the same way or do just the vertices need to be sent and then reconstructed within the grasshopper script?

1 Like

You should be able to send all Rhino objects in the same way!

1 Like