RhinoCommon HasBrepForm equivalent?

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.

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

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

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.

Thank you Menno, Steve,

Not sure how I missed that one.

Larry

I just added this function so HasBrepForm will appear in SR6

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

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

Ah, I see. Makes sense :smile:

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