Generic geometry class in RhinoCommon similar to IGH_GeometricGoo

Hi,

I would like to perform series of simple transformation of geometrical objects such as move, plane to plane orientation, scale.

But the input type of geometry can be meshes, polylines, curves, points.

Is there a possibility to cast those geometrical types to one type (Rhinocommon) similar to IGH_GeometricGoo , that I could perform transformation?

More simply the input to code is unknown what geometry type it is, but what is known that only transformation will be applied to them.

Or it is better to have my own custom class with specific types that shares transformation matrix operations?

Hi @Petras,

RhinoCommon’s geometric base class is Rhino.Geometry.GeometryBase. Any class that inherits from this can be easily transformed by calling it’s GeometryBase.Transform override.

Does this help?

– Dale

Dear Dale,

Thank you for a response.

Is it enough to cast geometry objects like this:

GeometryBase geo = (GeometryBase)(forinstancePolyline);

Hi @Petras,

To convert between compatible types, you can use the as keyword.

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/as

– Dale