Seems like the RhinoCommon method yields in different results than the join command. How do I recreate the result I get from the Join Command in RhinoCommon?
import Rhino
import scriptcontext as sc
def test_joiner():
filter = Rhino.DocObjects.ObjectType.Surface | Rhino.DocObjects.ObjectType.PolysrfFilter
rc, objref = Rhino.Input.RhinoGet.GetMultipleObjects("Select surface or polysurface to join", False, filter)
if not objref or rc != Rhino.Commands.Result.Success:
return
breplist = []
for i in objref:
brep = i.Brep()
if not brep:
continue
breplist.Add(brep)
joinBrep = Rhino.Geometry.Brep.JoinBreps(breplist,sc.doc.ModelAbsoluteTolerance)
if joinBrep:
for b in joinBrep:
sc.doc.Objects.AddBrep(b)
sc.doc.Views.Redraw()
if __name__=="__main__":
test_joiner()
Thanks @Willem! That seems to work. I didn’t try the rhinoscriptsyntax method.
I have to say that these hardcoded values are hard for me to understand the logic behind it. Like, who comes up with these and how do they get to these specific numbers.
I’m always using a factor of 2.1 where 2 trimmed curves or surfaces are involved.
This value is also used in rhinoscripysyntax for joining curves and surfaces.
My reasoning for using 2.1 is:
If 2 surfaces are trimmed by eachother with tolerance_x both are allowed to be tolerance_x away form the other surface.
So In theory they can be 2 * tolerance_x apart.
However since we are dealing with floating point numbers they can be more that that apart when tested.
Thus multiplying with 2.1 adds 5% extra tolerance to catch those edge cases.