Culling Vertical Faces in a group of surfaces

Dear All

I have 2 Polysurfaces attached here.which you can see have returns on the edges and I am trying to use GH to isolate the top surfaces only (ie. omit the returns).

I have tried to use Area and the smaller than method hoping the cull the larger areas but it isnt so accurate as some of the end top surfaces are so tiny that they are included in the cull pattern.

I then thought maybe I can cull the surfaces according the their normals, in this case maybe I can isolate the surfaces with normals pointing “upwards” (the top surfaces) and not to the sides (the returns).
I think this approach would be a bit more accurate than the area method as the difference are more apparent.
I am however, stuck at the :Normal" method as to what factors to use in order to isolate only the top surfaces. I would think it would be the Z component.

Would someone please give me a clue or lend a hand?

Thank you so much

Yutaka
Vertical Srf Select question.gh (75.8 KB)

Your file is missing the input surfaces. Right click the surface compnent and internalise the surfaces.

Hello Martin

Thanks for the reminder, here is the internalized file,
Kind regards

Yutaka
Vertical Srf Select question.gh (656.1 KB)

None of the surfaces are exactly horizontal.

I’m actually confused whether you want the horizontal or vertical faces? :slight_smile:

You can calculate the dot product and then use a similarity component to get faces which are close to horizontal…

nearly_horizontal_srf.gh (643.5 KB)

1 Like

Thank you Martin for your suggestion, my intention is basically to take away all the vertical faces and yes none of the faces are horizontal as the surfaces are 3d curves so this is a particularly difficult issue to solve.

I have tried to increase the threshold to a bit bigger to allow more faces to be included but the result is a mixture of vertical and “horizontal” faces.

nearly_horizontal_srf_1.gh (656.7 KB)

In order to get the vertical faces, I think you need a small trick. The dot product of two perpendicular vectors is 0. I have not been able to get the similarity component to work comparing against a value of 0. But the dot product is also the cosine of the angle so you can compare against 0.5*pi. At that point you could also just calculate the angle between the face vector and the Z vector.

nearly_horizontal_srf_1.gh (666.8 KB)

1 Like

Hi Martin thank you for your efforts and help, certainly gained a lot in the process!

A different approach:

  1. Join the surfaces from your original file into Breps.
  2. Split the Breps based on face-to-face angles.
  3. Cull the smallest Brep (the one you’re calling “vertical” or “returns”).
  4. Cull inward facing Breps (original post said “isolate the top surfaces only”).

I used this short python script to split the Breps:

import Rhino
import System
import System.Collections.Generic.IEnumerable as IEnumerable
import scriptcontext as sc

tol = sc.doc.ModelAbsoluteTolerance

# Brep.Split Method (IEnumerable<Curve>, Double)
# Splits a Brep into pieces using curves, at least partially on the Brep, as cutters.
a = b.Split.Overloads[IEnumerable[Rhino.Geometry.Curve], System.Double](c, tol)

brep_face_angles_kr-01.gh (625.4 KB)

-Kevin