Hi again @dale, running into another discrepancy between the UnrollSrf command and rhinocommon implementation. Could you share some insights in the joining process after unrolling as used by the UnrollSrf command?
When I use the JoinBrep method from RhinoCommon with the tolerance used in the RhinoScriptSyntax implementation, as I got explained by Willem in this topic, it doesn’t join 1 part of the unrolled surface whereas UnrollSrf returns one single polysurface. I tried on this file using the code below:
220226 UnrollSrfJoin.3dm (240.4 KB)
import Rhino
import scriptcontext as sc
def test_unroller():
filter = Rhino.DocObjects.ObjectType.Surface | Rhino.DocObjects.ObjectType.PolysrfFilter
rc, objref = Rhino.Input.RhinoGet.GetOneObject("Select surface or polysurface to unroll", False, filter)
if not objref or rc != Rhino.Commands.Result.Success:
return
brep = objref.Brep()
if not brep:
return
bcopy = brep.DuplicateBrep()
bcopy.Compact()
bcopy.Faces.SplitFacesAtTangents()
for f in bcopy.Faces:
f.RebuildEdges(0.00001, True, True)
for f in bcopy.Faces:
f.ShrinkFace(Rhino.Geometry.BrepFace.ShrinkDisableSide.ShrinkAllSides)
bcopy.CullUnusedSurfaces()
for f in bcopy.Faces:
if f.OrientationIsReversed:
f.UnderlyingSurface().Reverse(1)
unroll = Rhino.Geometry.Unroller(bcopy)
unroll.AbsoluteTolerance = sc.doc.ModelAbsoluteTolerance
unroll.RelativeTolerance = 0.01
out_breps, curves, points, dots = unroll.PerformUnroll()
if out_breps:
joinBrep = Rhino.Geometry.Brep.JoinBreps(out_breps,sc.doc.ModelAbsoluteTolerance*2.1)
if joinBrep:
for b in joinBrep:
sc.doc.Objects.AddBrep(b)
sc.doc.Views.Redraw()
if __name__=="__main__":
test_unroller()