Rhino crashes with Brep.CreateOffsetBrep

The code below sometimes crashes Rhino for me. It seems that with a small enough quantity of breps to process or a large enough time between each call to CreateOffsetBrep, the crashing can be prevented. I sent in an error report for this last weekend.

Thank you,
Steve

6.0.17269.9391, 9/26/2017
Windows 7 Professional SP1

import Rhino.Geometry as rg
import rhinoscriptsyntax as rs

def main():
    
    c = xrange(6)
    
    breps0 = [rg.Sphere(rg.Point3d(10.0*i, 10.0*j, 10.0*k), 1.0).ToBrep()
            for i in c for j in c for k in c]
    
    print "{} breps to be offset.".format(len(breps0))
    
    breps1 = []
    tolerance = rs.UnitAbsoluteTolerance()
    
    for i, brep0 in enumerate(breps0):
        rc = rg.Brep.CreateOffsetBrep(
                brep0, distance=1.0, solid=False, extend=False,
                tolerance=tolerance)
        rs.Sleep(5)
        for brep1 in rc[0]:
            if brep1.IsValid: breps1.append(brep1)
    
    print "{} valid breps from Brep.CreateOffsetBrep.".format(len(breps1))

if __name__ == '__main__': main()

Hi Steve,

Thus far, I have been unable to reproduce the crash.

216 breps to be offset.
216 valid breps from Brep.CreateOffsetBrep.

I am using a new, in house, build than you are. Can you test this again with next week’s build?

– Dale

Update: I am able to reproduce the crash, but only when I close Rhino.

I haven’t experienced a crash after closing Rhino after not crashing from that script.

rs.Sleep(5) seems to be at a threshold. If I enter a lower value or comment out that line, the probability of crashing increases significantly.

Hi Steve,

I’ve logged a bug for this.

https://mcneel.myjetbrains.com/youtrack/issue/RH-41648

– Dale

RH-41648 is fixed in the latest WIP