How to pass a bunch of different geometries in one variable to a function


#1

Hi,

I’m trying to find a way on how to repeat the functinoal from the BoudingBox function on RhinoPython in C#.

The goal would be to create a function, that returns a BoundingBox with the Right XFORM applied to it - just like in PythonScript.

However, I’m already stuck with passing the parameters.
PYTHON:

def BoundingBox(objects, view_or_plane=None, in_world_coords=True):

My TRY in C# Code:

public static BoundingBox BoundingBox(GeometryBase[]geometry, Plane plane, bool inWorldCoords=true)

Problem would be, that GeometryBase doesn’t support Points (as far as I know). The fact that Plane is not optional doesn’t really strike me as a serious problem.

Can anyone help?

Thanks
Karl


(Dale Fugier) #2

Rhino.Geometry.Point3d does not inherit from Rhino.Geometry.GeometyBase. But, Rhino.Geometry.Point does, and it is used by Rhino.DocObjects.PointObject. Note, the data member for Rhino.Geometry.Point is a Rhino.Geometry.Point3d object.

You might consider having two versions of your BoundingBox function: one that requires a Plane arugment and one that does not.


#3

Thanks Dale,

Your are right. I could create a second version (Don’t know why I didn’t think of that).

Thanks for clarifing this. I will try to get it running with the geometry base.

All the best,
Karl