Hello friends, I have a 3d slab brep, and the final goal is to extract the outer boundary of the top of the slab. I’ve managed to get the top surface as a single polysurface but I am not sure how to proceed. Files are attached. Any help is appreciated!
Welp, would like to edit the main post but it won’t let me… Correction: I thought I got it, but I didn’t, so I failed to get the top surface geometry. I planned to get all surfaces’ normal and only keep those with a positive z value to get all the top-facing ones, but the result is not consistent; many top surfaces were eliminated, and many bottom surfaces were selected. scratching my head now….
i don t see myself as a gh buddy nor a spaghetti-master … but lets try to help:
OrientationIsReversed
Please note, that BrepFaces might have a reversed orientation compared to the underlaying surface. This property is as far as I see not exposed to vanilla Gh.
This is why my definition is lazy: i extract the “around-faces” by an angle-threshold against Z-Axis and join the remaining Faces - expecting 2 Breps (top and bottom).
Then sort them by maximum z.
Of course this could be addressed by scripting-Component.
DubBoarder
looks like there is no DubBoarder in vanilla gh. BrepEdge.Valence will tell if the Edge is naked / therefore part of the boarder.
I solved this by a small script without any error-handling (are there any naked edges ? are the results of JoinCurves closed …) :
private void RunScript(Brep brep, ref object a)
{
List<Curve> crvs = new();
foreach(BrepEdge edge in brep.Edges)
{
if (edge.Valence == EdgeAdjacency.Naked)
crvs.Add(edge.DuplicateCurve());
}
a = Curve.JoinCurves(crvs);
}
Absolutely wonderful! I guess using the 0.5,0.5 uv point for surface normal is more efficient than ‘surface centroid - closet point to brep - surface normal‘?
Hi Tom, this is another great solution, thank you so much! I figured out my previous script was using the ‘closest point to surface’ instead of ‘closest point to brep’, which is causing some normals to be misinterpreted as the opposite direction.
is not correct - as the domain of the surface is not addressed “normalized”.
this is why i use the grouped/named “domain center” section.
but yes addressing a point on a surface by u,v is much faster then calculating area centroid and closest point. but does not look like performance is important for this sketch.
the selected solution does not address the topics title issue “boundary”
Yes, some surfaces, especially the ‘less planar ones’ or the long, curved ‘side (vertical) strips’ will often show you the area centroid in a location that’s not directly on the object—which is 100% normal given an area centroid does not equate to evaluating a surface.
I’d be careful with this, not all breps go into ‘mesh’ smoothly, as you can see by how long that mesh outline is taking. It’s probably an easier shot to rely on the already-separated surfaces (unless the goal is indeed just the actual outline, not the border—in that case, though, I’d sill attempt to grab the borders, project them flat and unify regions (if the goal is a 2D boundary like ‘mesh outline’) OR {again} grab the borders, join them and leave them where they are (if the goal is a 3D boundary).
Hi Tom, thank you! Your solution is also super helpful! I had to select Rene’s reply as the solution just because his message came in sooner, and he explained the boundary extraction in the text. Again, I very appreciate everyone’s help!