Faulty Shading using 'CapPlanarHoles' method

Hello Community,
I always get shading problems when using RhinoCommon Brep.CapPlanerHoles method, no matter what kind of geometry I have:

  1. I created a Rectangle3d, made the boundary surface end extruded, and then capped it;
  2. extruded a closed curve using Surface.CreateExtrusin method, then capped;
  3. used Sweep1 along a curve ( Brep.CreateFromSweep), then capped.
    In all cases, resulting geometries are clear before capping.
    After capping I am getting ugly, jagged shading(however, the geometries look normal).
    Can anyone, please, advise me what is the cause of this or could you give me some hints on how it is possible to resolve this issue?
    I have read @Helvetosaur’s post (Surface.CreateExtrusion) and Menno Deij’s answer but I still can not find out …
    Thanks.

It’s most likely the same problem, the rectangle sweep is not split at the kinks and the resulting display mesh is bad - the Rhino mesher does not like kinked single surfaces.

Just like @Helvetosaur says, I never extrude joined curves (like Rectangle3d). I have always gotten better results by exploding the curve, extruding and then joining afterwards.

planar

Hello everyone, thank you for your replies.
@Helvetosaur it makes sense what you said, but I think there must be some method that addresses the issue decently since Grasshopper native components handle similar situations very well.
@Ashley_Cichocki do you convert the curves (in this case Rectangle3d) to PolyCurve?

I would use rs.ExplodeCurves (or DuplicateSegments) to give me a list of individual curves.

Next run a for loop over each curve, putting the extruded surfaces into a list.

Finally use rs.JoinSurfaces and then rs.CapPlanarHoles.

Apologies for not posting the python script, my python is rusty, especially the rhinoscriptsyntax.

(When you get over these little quirks in Rhino, you will be flying)

@Ashley_Cichocki,
I’m using C#, @adel.albloushi gave me a nice solution, and it worked well, but the issue was that I couldn’t use the same method for the rectangle with no fillets because then I could not convert Rectangle3d to PolyCurve( which has the method “Explode”). Your suggestion “DuplicateSegments” worked quite well for me.
Overall, the process looks a bit tricky but it works. At least now I have a clue how things are going… ))
Thank you again, :pray:

1 Like

Ah, if I’d known that you were using C# I would have given you a quick script! Glad it worked.

1 Like

Hello @Ashley_Cichocki, sorry to bother you again with my question. How do we behave when we loft curves with different segments? In this case loft between a Triangle and a Pentagon? GH native loft component splits triangle edges so that its segment numbers coincide with pentagon segments. Can you give me a hint, please?

Hi Bakuri, I’m not sure what you are trying to achieve here? I’m also not sure I know any more than you said in your question… sorry.

@Bakuri_Gogua - capping planar holes will not flip the face normals to point outwards, if they are pointed inwards.

Check the Brep’s solid orientation and, if inwards, flip the normals.

— Dale

Hello all,
Thank you @Ashley_Cichocki,
Dale, @dale you saved my day :pray: :pray: :pray: Splitting kinky faces worked well. This was a solution for the lofting issue(faulty shading). Unfortunately, I can’t mark two solutions here at the same time.