Convert Brep to extrusion (RhinoCommon)

Hi,

I’m looking for a way to convert a Brep (has extrusion shape) into an Extrusion object.

Looks like the ConvertExtrude command exists if we look here:

But I can’t find it in RhinoCommon anywhere. Clues @pedrocortes ?

Hi @sonderskovmathias ,
That ConvertExtrude converts extrusions to breps. Basically what “.ToBrep()” method does.
You are looking for the opposite functionality?

Ah yes, what a shame - I was looking for the opposite.

I know it is not that straight forward nor as computationally lightweight, but I thought it already existed that’s why I asked. My misreading.

In my knowledge no such RhinoCommon method exists (convert Brep to Extrusion).
Unless something changed in Rhino 8 recently, but I doubt.

I would say, you have to make it with Rhino.Geometry.Extrusion.Create, by using the outer curve of the brep’s “extrusion like face” (for a cylinder, that would be example one of the two circular faces):

1 Like

I’m having trouble imagining how that would work without more information.

On the computational side, would it start guessing faces and edges to extrude from and an extrusion vector/path to see if the result matches the brep? That’s a difficult problem to work with.

On the interpretation side, if you handed it a brep that was a cube, there are 6 obvious possible extrusions and no apparent way to tell which one you want.

Do you have more information about the instances you’re actually working with to make the problem easier to describe?

A practical example might be if the way you create the breps always results in something that is a simple extrusion from the X-Y plane upon which one and only one face of the brep ‘sits’.

Hi @sonderskovmathias,

There isn’t anything in Rhino to convert an extrusion-compatible Brep into an Extrusion. I know we’ve mulled this over.

– Dale

1 Like