Grasshopper C# exception

Hi there, I have a bit of a tricky question, but hoping someone might be able to help me!

I am working with a grasshopper C# script. I am modifying a ParametricCamp script (available here Computational Design Live Stream #28 - YouTube) for my purposes. The ParametricCamp script works with a particular set of motion sensors and takes the location and orientation data into grasshopper via the C# script. The code takes the position of each sensor data point and then builds a plane using this data point and the x and y orientations of the two sensors. I’ve attached the original script with my notes here. (20.0 KB)

I am also using motion sensor data, but the structure of my data is slightly different. The location of each data point is the structured the same, but the orientation in my data set uses quarternions. So I need to modify the orientation section of the original code. With the help of a friend, we have tried to modify the script, however we are getting a couple of exceptions when trying to run the code. I’ve attached the modified code here: (16.9 KB)

The exceptions are:
On line 90:
Plane pl0 = ToPlane(origin0, q); - Grasshopper is saying that the ToPlane function is for use with a Vector3d, quarternion quat combination, but we’re trying to use it with a Point3d, quarternion quat combination. So I’m getting the error 'cannot convert from ‘Rhino.Geometry.Point3d’ to ‘Rhino.Geometry.Vector3d’

Then on line 115:

return new Plane(origin, vx.Vector, vy.Vector); I’m getting the error 'cannot convert from ‘Rhino.Geometry.Vector3d’ to ‘Rhino.Geometry.Point3d’ (I think because this argument is based on a Vector3d object for the origin, but we’ve previously defined it as a Point 3d object?)

So we seem to be running into some conflicts between Point3d and Vector3d definitions.

Would greatly appreciated if any has suggestions on how we might be able to fix this.

All the Best

could you please also upload an (even small sampled) csv file to be used with the definition?

I’d replace Vector3D with Point3D here:

Hi, yes absolutely, I tried adding the whole thing earlier but was far too large! Here’s a small section - with the rotation / orientation data for one sensor in columns 3-6


MotionDataExert.csv (7.4 KB)

if the data maintains the very same structure, then these index should be ok:

you’ll need to change this according to the number of lines to be red in your -bigger- data file:

does this look like the output you were expecting? (18.2 KB)

Yes, thank you so much inno, that makes sense and seems now to be working fine!

thanks again

1 Like