Rhino hard crash with Rhino.Geometry.Brep.CreatePipe


While processing many curves every now and than I kept having a hard crash no crash report nothing. Finally I’ve tracked down a reproducible example.

I know the curve is far from origin, I know it has stacked controlpoints and is rather odd.

What I do not know is how to prevent Rhino from hard crashing like this.
Is there any testing I can do before passing the curve to CreatePipe?
Run the below python script on the attached file.

pipecrashtest.3dm (22.6 KB)

import rhinoscriptsyntax as rs
import math
import Rhino

#get curve in doc that causes crash
id = rs.ObjectsByName('test_curve')[0]
rail_curve = rs.coercecurve(id)

radius = 9.0
localblending = False
cap = Rhino.Geometry.PipeCapMode.None
fitrail = True
abstol = 0.1
angtol = math.radians(15)
pipes = list( Rhino.Geometry.Brep.CreatePipe(rail_curve,radius,localblending,cap,fitrail,abstol,angtol) )

for pipe in pipes:
    print 'valid : ',pipe.IsValid


Hi @Willem, it also crashes using the _Pipe command. If the curve is exploded and _SelShortCrv is used, 2 segments are found smaller than tolerance. After removing them and joining the remaining curves, _Pipe creates something ugly without crashing.

You might add a check for the boolean value returned from:


If it returns True, do not pipe it. Maybe worth to check for self intersecting rail too.


Hi Clement,

Thanks for the testing. Meanwhile I indeed made a method to sanitize the curve input one of the actions is culling short segments. Good to pointout the RemoveShortSegments method as I was duplicating segments and joining them back. I did not realize RemoveShortSegments being available for other that polylines

However I’d expect Piping to not crash this hard regardless of the input and as such consider this a bug.