RhinoCommon HasBrepForm equivalent?


#1

In the prior .NET SDK I could query a generic piece of geometry using the IOnGeometry method, HasBrepForm(). I don’t see an equivalent method in RhinoCommon on GeometryBase. Is there another way to determine if an object has a Brep form in RhinoCommon without specifically testing to see if it is a Brep, a Surface, an Extrusion, etc.?

Thanks.


(Menno Deij - van Rijswijk) #2

I think you might be looking for Brep Brep.TryConvertBrep(GeometryBase)

http://4.rhino3d.com/5/rhinocommon/html/M_Rhino_Geometry_Brep_TryConvertBrep.htm


(Steve Baer) #3

Hi Larry,
It looks like this has not been added to RhinoCommon yet. I’ll try adding this for the next service release.

In the meantime, I would just write a single static helper function which just tests the types and call that in your code. Once I the function is in RhinoCommon, you can then just do a quick search/replace.


#4

Thank you Menno, Steve,

Not sure how I missed that one.

Larry


(Steve Baer) #5

I just added this function so HasBrepForm will appear in SR6


(Menno Deij - van Rijswijk) #6

How is that different from TryConvertBrep(GeometryBase):Brep?


(Steve Baer) #7

HasBrepForm is lighter in that it just returns true or false to tell you that the object could be converted to a brep. TryConvertBrep has to go through the process of actually creating a brep


(Menno Deij - van Rijswijk) #8

Ah, I see. Makes sense :smile:


#9

Thanks Steve. Lighter is better. I look forward to shedding some pounds with sr6.