Detect which cylinder is full cylinder and which is piece of cylinder

I’m trying to find cylinder surface in below model. How to detect which cylinder is full cylinder and which cylinder face is piece of cylinder. How to differentiate it.
image This face is detecting as cylinder

and this cylinder surface getting as two cylinder


Hi Bhavita,

so you got a hold of the Brep and it’s underlying Face and I guess you used:


…which will only return a boolean value?

If that is the case maybe you can try to check if the surface is closed in a particular direction.

Tell me if that works…if not, we can try something else.


Hello Milos,
Thanks for reply, I tried the same property for both models which I previously share but both faces getting closed in u direction…However I just want to know How to detect which face is full cylinder and which face is piece of cylinder because piece of cylinder is also getting as full cylinder. I’m unable to detect that.


Hi @Bhavita_Patil, in addition to Milos’ suggestion, you might as well check for brep_face.IsSurface to rule out the trimmed and untrimmed cylinders…


Hello clement,
I tried that but ,that’s also not working

Can you upload a sample model and write what the script must do precisely start from the beginning to the end?
So we can help you better

1 Like

In the given model, our aim is to identify holes which are complete cylinders. we have some condition written once we have the object of the surface but while iterating over the faces of the brep body they are getting half at a time. Also, the index of other half is not consecutive to the first half.


Here attaching the sample code
RhinoDoc activeDoc = RhinoDoc.ActiveDoc;
IEnumerable brepObjects = activeDoc.Objects.GetObjectList(ObjectType.Brep);
RhinoObject object1 = brepObjects.ElementAt(0);
bool hasBrepForm = object1.Geometry.HasBrepForm;
Brep brepBody = Brep.TryConvertBrep(object1.Geometry);

BrepFace face1 = brepBody.Faces.ElementAt(17);
A = face1;

A = face1.IsCylinder();   
A = face1.IsClosed(0);
A = face1.IsSurface;

How to identify the holes as complete cylinder.


Help me understand this a little better.
So you have plates (example) and these plates have cylinder holes.
Are holes that start as a circumference always the type of cylinder holes, or sometimes the end2 of the hole is particular such that It’s not considered an hole?

So my question is : Are all inside circular edges always holes?
I’d like to understand the definition of cylindrical holes and your specific usecase because there are plenty of solutions, but I’d like to go the easiest route

@Bhavita_Patil, the easiest would be if you post some geometry so we can find out if your cylinders are split in half, eg. because they where imported from iges…

Also, are you testing against brep faces or the underlying surface ? Are you sure that face1.IsClosed(0) is testing the correct direction ?

Btw. you might check these scripts to merge the cylinders.


Have you considered extracting the Brep Edges from each Brep?

And then for each edge check if it is a circle (using Curve.IsCircle() )?

That way you could find Breps or Brep Faces that have circular holes (or even the exact number of circular holes). Of course, if you have Breps that have a circular form, this might be a problem because it will “catch” them as well…just brainstorming…but I think the solution might be in the direction of checking if the edges are circles…even if you try to do that on the cylinders themselves. If you know (for example) that the holes are always of certain sizes, you can also limit the search only to those sizes (to avoid catching other circles)

P.S. I wrote this in your other post, but here it is as well…
…you can test all the Brep faces to see if they are Cylinders. Once you collect them (all those halves of cylinders), you can try to Join them. As a result, you should get your Cylinders (as Breps). If you want to test if those Breps are then Cylinders, you can then also try to examine the Edges of those Breps to determine if they are Circles, or you could check if all faces (or “both” faces, assuming that now they will have 2) are Cylinders.