Solid Difference Issue

I am having this issue with solid difference in grasshopper. The result is a union instead of a diffrence and I just cannot figure out what is wrong. Baking the objects and doing manual boolean in Rhino works fine. Both surfaces/polysurfaces are good, closed, and even the surface seams are not in the way.
What could it be?

thank you for your help.solid difference (100.4 KB)

This has to do with the curve direction of your ring cross section. When that is flipped, boolean operations are messed up.

Check the file below: (8.6 KB)


thank you @martinsiegrist , wow I would have not thought of that. Now that I know, I cannot come up with any solution to check for that ? I am orienting the profile to a rail and do a sweep1. When I orient the curve at t=0 the boolean fails, any other value works correctly. However, the profile does not change direction ever, so as far as I can see, this happens internally in the sweep1, could that be true?

Have you been using Sweep1 to create this ring? The ring looked circular, so I used revolve.

You can use Evaluate Surface to check whether the surface normal is pointing outwards. (17.2 KB)


That part wasn’t included in your code though.

Using C# for adjusting the seam is rather obscure too. Standard Seam component works fine.

I am sorry, I did not know that it was relevant. I internalised the surfaces to not overcomplicate the definition for anyone willing to help. I did not know that it was possible that a surface normal of a closed untrimmed surface could point inwards. Thank you very much @martinsiegrist for pointing that out!

@Joseph_Oster the C# is for adjusting the srf seam, not the curve seam.

1 Like

If you look at the output of the Revolve, it says Untrimmed Surface. After baking the output, the What command in Rhino says it’s a closed surface. That might be confusing …

1 Like

Yet that makes no difference whatsoever.

Would still like to see your Sweep 1 code that creates the ring? That’s where the rail curve Seam (and section orientation) really matters.

1 Like

Joseph, thank you for your offer to help. Unfortunately the whole definition is quite complicated and part of a bigger “builder” system I have created and I would prefer not to share the whole thing.
My issue was definitely solved by checking for the srf normal, so thank you @martinsiegrist and of course also @Joseph_Oster for your very quick responses and help. It is very much appreciated and I can only suspect it would have taken me hours to find the issue otherwise.

I don’t want the whole thing, just the part where you create the ring using Sweep 1. Because that doesn’t work for me at all.

P.S. This is what I mean. Starting with @martinsiegrist’s code, I created a circle for a rail, adjusted its seam and Sweep 1 fails, no matter what. (As I was writing this, I added code to test alternate radii for the circle so the rail touches the top or bottom of the section curve, with the same result.)

The only way Sweep works is using SubCrv to leave a small gap at the end of the rail (yellow group). (15.6 KB)


Oh look, Sweep 2 succeeds without using SubCrv, and it doesn’t matter whether the section curve is flipped or not. (17.0 KB)

There really wasn’t enough in your posted code to thoroughly explore this issue.

1 Like

ok @Joseph_Oster , here is something I put together for you.
I am doing the sweep in python and there I can do the check for the orientation.
And yes, vanilla sweep1 in gh is very likely to fail in many cases without any helpful error message. With my curve sorting, orientation and seampoint setting I got rid of almost all problems in my “builder”. Hope it helps.

sweep = rg.SweepOneRail.PerformSweep(so,rail,profiles)
for brep in sweep: 
    if brep.IsSolid:
        dir = brep.SolidOrientation
        if dir == rg.BrepSolidOrientation.Inward:

solid difference (34.7 KB)

It helps explain how you managed to create a defective brep that causes SDiff to fail. It’s great that @martinsiegrist was able to identify the flaw without seeing your code but his solution used RevSrf, not Sweep 1, so a mystery remained for everyone else who reads this thread.

It is always very relevant to see how the defect was created. You hadn’t mentioned Python at all and tried to justify not sharing your code:

That doesn’t help anyone, except perhaps yourself. That’s not what makes this forum work. I can see the Python in your post but your latest GH file is useless to me because it requires Pufferfish.


You started this thread to ask for help, which Martin and I provided, despite your non-compliance with the forum guidelines. My Sweep 2 solution is simpler and works better than your Python/C# approach. Hope it helps. And I really hope you understand what I meant when I said this:

There really wasn’t enough in your posted code to thoroughly explore this issue.

1 Like

@Joseph_Oster Joseph, if you reread my question, I was asking why my boolean failed. Martin provided the answer and I am thankful for it. I was providing everything in the forum guidelines and removed all unecessary seeming code.
You were interested in what was causing the invalid brep to be generated and requested some more information from me, which I took 1,5 hours of my time this morning to put together for you. You were not clear about what you really want only mentioning

I understood this as YOU asking me for help, so I tried to provide it. Instead you now write this:

Excuse my bluntness, but in my estimation you have not provided any help for me and my problem at all, you were interested in something else and I was trying to provide you with the information you unclearly requested. I understand your attitude in your post as if I was ungreatful or not compliant with “how questions are asked here”. I am sorry you feel that way and kindly request that you do not waste more time with my problems that you yourself decided to spend your attention on. I was trying to be precise and providing everything that was asked of me.

Here is a definition that does not have any dependencies and uses vanilla sweep1. It also creates the same geometry.

I hope you have a nice day.
solid difference (32.0 KB)

Done. On ignore “Forever”. Bye-bye.

I am sorry you feel that way, Joseph.