Hi rajaa… that is peculiar, because if I open that file, and explode and seldup there are no duplicates, and if I count the surfaces there are no double caps… are you sure you found two?
When I extract the outer surfaces in the above image from the polysurface, then MergeAllFaces the remaining part, it merges fine. I was able then to rejoin the extracted surface. MergeAllFaces had trouble rejoining that outer face correctly after merging the rest of the piece.
Hi Rajaa,
I have had an idea on how to improve MergeAll, so I just spent some hours coding a solution.
First I found that it generated the same error, but not a bad object, so I replaced rs.DuplicateEdgeCurves() with rs.DuplicateSurfaceBorder() and then it works fine.
The tool I made is fast and accurate now. It handles surfaces that are coplanar but not joinable and gives a better result on multi coplanar surfaces.
Rhinos tool tool over 3 minutes on a polysurface that my script used 6 seconds to complete, with better result:
How fast will it do the attached…? MergeAllFaces takes… takes… well, I’m still waiting…
–Mitch
OK, finally it finished - I don’t know how long it took, but about 15 minutes I guess - however there are holes everywhere… Not a really fair test though, there are non-manifold edges everywhere… I’m just being nasty.
This is probably a fairer test - 144 overlapping boxes, no non-manifold edges to confuse things.
Your script finished in a little over 6 seconds here, but didn’t get most of the upper/lower “merge-able” surfaces. MergeAllFaces took around 5 minutes, but did get them all…
As you know, a general solution that carters for most cases can be much slower than one that solves a subset of cases, but it sure is important to find ways to improve the speed of the command. Here are a couple example cases that would be interesting to see if your script merges.
It does, it checks for any coplanar surfaces, so it should be robust.
And I found the bug @Helvetosaur (and @John_Brock ), the command “rs.JoinSurfaces()” returns only one surface, even if the result is multiple surfaces…
In order for rs.JoinSurfaces to work, they have to be in “joinable” order (which is unlikely in your case). Otherwise, you’re better off scripting rs.Command("_Join") - or perhaps RhinoCommon Rhino.Geometry.Brep.JoinBreps() method, which I think can deal with stuff that’s out of order.
I am working on it, to fix some other bugs, but did a stupid thing and pasted it onto an empty script, and then I terminated Rhino and lost it all… pft… have to re do it, I had solved the multiple coplanar surfaces that didn’t join.
I just ended up rewriting the tool, so it handled some other situations better.
But I ran into a problem with planar surf, it doesn’t handle self intersecting curves like it should.
I’ll post that as a new topic.
would be a great new feature, if such a command could merge also cylinder faces. Still better it would be if even divide 3d curved G2 surfaces within a PolySrf could be merged in a smart manner.