I am using RhinoIdle to collect selected objects like Curve, Brep, Point3d etc…
Casting from GeometryBase to Curve and Brep is successful but I cannot cast to Point3d in order to collect selected points to my lists. How possibly can I collect selected points in my dictionary. I put sample of in order to compare Curve and Point3d in RhinoIdle event handler.
You cannot cast to Point3d, because Point3d is a struct which does not derive from GeometryBase. You must cast to the Rhino.Geometry.Point class instead, and then extract the Point3d coordinate later.
Hello all,
I’m still struggling to correctly cast GeometrBase to Point3d. @DavidRutten, @oguzhankoral please can you check the pic, what am I doing wrong?
Seems like you are trying to map point to GeometryBase, but it is actually an abstract class, it is created internally by RhinoObject. To retrieve GeometryBase, you need to add that point object onto Document first. Then you can cast its Point3d back to GeometryBase.
@Bakuri_Gogua there is nothing wrong with the code you have posted, and the if is an excellent way of checking. Assuming that Point class is Rhino.Geometry.Point. But what you are doing is quite strange (unless you’re trying to copy the object?), the geometry object was/is already a Point Can you elaborate on what it is you’re trying to achieve?
hello @dale, thank you for your reply.
I have an input type GeometryBase and I am trying it to accept a point input but getting an error: Invalid cast: Point » GeometryBase. I tried hard but nothing worked.(((
GH native component Polar Array has the same input type(Generic Geometry) but freely accepts a point as input. Please can you help me achieve the same for my component?
does it(GH native component Polar Array) use a GeometryBase as input type or IGH_GeometricGoo?