Curves derive from the GeometryBase class and thus needs to be encoded to be sent to compute. Points and other structs are sent a bit differently. We’re still trying to work this out so it is less confusing. For a curve you could do:
const curvePoints = new rhino.Point3dList()
curvePoints.add( 0, 0, 0 )
curvePoints.add( 5, 5, 0)
curvePoints.add( 10, -5, 0 )
curvePoints.add( 15, 5, 0 )
curvePoints.add( 20, 0, 0 )
const nurbsCurve = rhino.NurbsCurve.create( false, 3, curvePoints )
//this is what you should send to compute
const curveDataToCompute = JSON.stringify( nurbsCurve.encode() )
console.log( curveDataToCompute )
Unfortunately I cannot show the definition file… but it turns out that your solution works! The problem is when I want to use the same code in a solution based on compute.appserver. So I will look for discrepancies in the coming days. Additionally, I had a problem on the Rhino Compute side, where I got an error:
Your responses have been very helpful! Thanks.
Could you kindly advise on how to send an entire Rhino document to the evaluate definition?
In the image below, I hope to send a rhino document to the “RH_IN:rhinoFile” node.
The samples on Github first parses through the objects, and then sends extracted data to definition. I prefer to control this logic in Grasshopper instead.
My current setback is that the “RH_IN:rhinoFile” node is unable to accept the document that I’m feeding it. I’ve tried encoding and JSON.stringify() the rhino document, but I am still unsuccessful. You may reference my 2 failed attempts below.