Data input returns a 'Point3d' instead of a 'Point'

Hi all,

I am passing some Point to Data Ouput component and what I got from Data Input is a Point3d.
I am using a Point because inheritance GeometryBase, I can get access to UserDictionary.
Is there a way to preserve this type?

Thanks.

My guess is, that the wrapped Data of GH_Point is the very basic Structure Point3d and not the Object Point

GH_Point pt = new GH_Point();
A = pt.TypeDescription;
// 3D Point coordinate

And according to your example it looks like GH_Point CastTo() does not provide casting to Point.
I thought (not tested) the T / Type parameter is used with the following syntax.
And CastTo will return true on successful casting - so it is more a “TryCast / TryConvert / TryPharse”.

bool success = geo.CastTo<Point3d>(out pt);
// or short circuit inline
if (geo is GH_point && geo.CastTo<Point3d>(out pt)
{
    // ...
}

of course you could implement your own Datatype wrapping Point. The API provides a nice example with more information and will serve as startingpoint.

kind regards -tom

Hi @Tom_P,
Thanks for your message.
Because Dato output ‘convert’ to GH_Point; inevitably I can’t get the Point I am passing.
I could wrap the Point class, or at the moment I solved serializing using ToJson.

Thanks.

@Tom_P
I tested using this example here.

And seems the Data input doesn’t like the custom Goo.