Geometry Output for Different Types

I have a case where a component has to output different geometry types:

protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) {
        pManager.AddGeometryParameter("O", "O", "Output", GH_ParamAccess.tree);

I output different geometry types by casting to GeometryBase:
By different geometry types I mean: Curves, Polylines, Surfaces, Meshes and Planes.

   var geo = new DataTree<GeometryBase>();
geo.Add(GH_Convert.ToGeometryBase(SomeGeometry), path);

The problem happens when I try to convert a Plane to GeometryBase.
During the conversion the plane becomes a small rectangle surface.

How can I output planes properly?

Hi @Petras_Vestartas, Since Planes are not derivatives of GeometryBase Class, you will not be able to sort them by Geometry types. You need to explicitly check for Object Type “Plane”.
Also, the Input Parameter and the output parameter keep them as AddGenericParameter, because Rhino common will automatically convert the planes into surfaces if you keep the parameter type to AddGeometryParameter.


Thanks works perfect.

I was trying to avoid object type:
var geo = new DataTree<object>();

But I believe this is the only way.