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 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.
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.
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)