generative modeling for Rhino
I need some help on passing Rhino.Geometry.point from one grasshopper component to another. I have tried passing it as a geometryBase and i receive a casting error. Basically i need to pass a point with a string attached to it. Any ideas?
Tags:

Hi Erik,
you could pass it as a complete string. Maybe even as xml. Would that be ok?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Permalink Reply by Erik Thorson on November 1, 2011 at 11:17am Well not really. The issue is that i have a component that ideally excepts curves, points or breps with strings attached to them. All of which are fine as GeometryBase objects except for the point. How would you go about this? Does the Point type not inherit GeometryBase?

Rhino.Geometry.Point does derive from GeometryBase.
My guess is that Point is converted to Point3d and then stored inside a GH_Point instance. This will strip any user-text. Breps and Curves are wrapped without being converted to a simpler type.
You may need to create your own data type for this, something that can store Breps, Curves, Points and separate strings. Quite a lot of work all in all.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Permalink Reply by Erik Thorson on November 1, 2011 at 3:08pm For now im just going to pass tiny curves and use their end points. Hopefully in the future i can get back to this problem and do it properly. Thank you for the help anyway.
I might be misunderstanding your issue, but if you are trying to extract/assign the Point3d from a Point object, check the "Location" property. The Point class inherits from GeometryBase, Point3d is a Struct.
Cheers,
Jon

Hi Jon,
the problem afaiu is that it's not possible to maintain UserStrings because Point is automatically downcast to Point3d inside Grasshopper. So when you attach a UserString to a Brep or a Curve it survives the process, but not so for Point.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
© 2012 Created by Scott Davidson.
Powered by