Convert Rhino.Geometry.Brep to Rhino.GeometryBase

Hi,

this might be a rather stupid question.
But when I create a Rhino.Geometry.Brep or a Rhino.Geometry.Sphere and I want to pass them into a block I will need to pass a Rhino.GeometryBase.

Is there a more efficient way than to add the brep or sphere to the document first and then getting it’s geometry?

Thanks,
T.

Hi @tobias.stoltmann,

Since Brep is inherited from GeometryBase, you could directly pass it into a block

            Brep myBrep;
            Sphere mySphere;

            List<GeometryBase> geometriesForMyBlock = new List<GeometryBase>();
            geometriesForMyBlock.Add(myBrep);
            //As sphere is a value type, convert it to Brep first
            geometriesForMyBlock.Add(mySphere.ToBrep());
1 Like

@Darryl_Menezes, yes indeed.
Thanks a lot :slight_smile: