Help: rs.JoinSurfaces() doesn't work if surfaces are not joinable

I need to join multiple surfaces, some are sharing edges, and some are not, but rs.JoinSurfaces() will only return one polysurface or none, so what should I do if I need it to use it to make two or more polysurfaces?

How can I quickly check if two surfaces are joinable?

Something like:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino 

tol=sc.doc.ModelAbsoluteTolerance
srfIDs=rs.GetObjects("Select surfaces to join",8+16,preselect=True)
breps=[sc.doc.Objects.Find(srfID).Geometry for srfID in srfIDs]
joined=Rhino.Geometry.Brep.JoinBreps(breps,tol)
joinedIDs=[sc.doc.Objects.AddBrep(brep) for brep in joined]
rs.DeleteObjects(srfIDs)
print "{1} {0} joined into {2} {0}".format("surfs/polysrfs",len(srfIDs),len(joined))

–Mitch

You wizard… I’ll digest it once I have time… If I can :smile:

I just took advantage of the fact that in Rhinocommon, JoinBreps() works like Rhino’s join command, it joins what it can and returns the joined pieces. What is in fact missing from Python rhinoscriptsyntax is in fact JoinsurfacesEx (already in vb Rhinoscript) which doesn’t care about order…

–Mitch

Thanks!

@dale can you add JoinsurfacesEx to the wishlist?