RhinoCommon UnrollSurface differs from UnrollSrf command

Have a look at the file in attachment. When I use the UnrollSrf command I get a flat polysurface with smooth edges. When I use RhinoCommons UnrollSurface I get a surface with ugly jaggered edges. How can I achieve the result from the UnrollSrf command using Rhinocommon?

For repeating the problem, try this code using Python:

import rhinoscriptsyntax as rs

obj = rs.GetObject()
rs.UnrollSurface(obj)

211214 UnrollSrf vs sr.UnrollSurface.3dm (116.0 KB)

Hi @siemen,

it uses the Absolute tolerance of your document which is 0.1 millimeters. You can either lower it under Document Properties > Units or set it in the function call:

import rhinoscriptsyntax as rs

obj_id = rs.GetObject("Surface to unroll", 8, True, False)
if obj_id:
    rc = rs.UnrollSurface(obj_id, False, None, 0.00001)

it takes longer to unroll but looks better.
_
c.

Hi @clement. Can you specify what uses Absolute tolerance?
When I use the document tolerance (0.1 mm) for rs.UnrollSurface I get the same crappy result with deviations of 1-1.5 mm and UnrollSurface command take the document units automatically and I get a smooth result? Why does this differ so much?

import rhinoscriptsyntax as rs

obj = rs.GetObject()
tol = rs.UnitAbsoluteTolerance()
rs.UnrollSurface(obj,False,None,tol)

It also like the UnrollSrf command creates a polysurface. How does one achieve that with rs.UnrollSurface?

Hi @siemen, my guess is that the _UnrollSrf command either does some tolerance reduction on it’s own and since it’s not merging the results as rs.UnrollSurface does, it’s outcome looks better. Probably the wobble you see is caused by the merging, i’m not sure.

@dale, can you look at this and explain why the results are wobbly, even with tight tolerances ?

thanks,
c.

It seems that the _UnrollSrf command has more going on behind the scenes.

This code produces the same results as the _UnrollSrf command. (Note: I’m using a GhPython component in grasshopper)

# input x type hint set to Brep

import Rhino

doc = Rhino.RhinoDoc.ActiveDoc

x.Faces.SplitFacesAtTangents()

for face in x.Faces:
    face.ShrinkFace(Rhino.Geometry.BrepFace.ShrinkDisableSide.ShrinkAllSides)

unroll = Rhino.Geometry.Unroller(x)
unroll.AbsoluteTolerance = doc.ModelAbsoluteTolerance
unroll.RelativeTolerance = doc.ModelRelativeTolerance

breps, curves, points, dots = unroll.PerformUnroll()

a = Rhino.Geometry.Brep.JoinBreps(breps, doc.ModelAbsoluteTolerance)

unroll_srf.gh (9.9 KB - Your geometry is internalized in this file)

-Kevin