C# Brep.CreateOffsetBrep(...) return empty Array

I allways get an empty Brep array if i try to:

Brep u = surface.CreateExtrusion(line, true);
Brep[] bigger_u = Brep.CreateOffsetBrep(u, 0.2, true, true, doc.ModelAbsoluteTolerance, out var test1, out var test2);

test1 and test2 are null.

The Brep u is an simple Object like a straight tube or a straight cylinder and if i use the OffsetSrf command inside Rhino the command success without problems.

As i understand the documation souldnt the command return always some kind of breps and/or brepfaces?

Hi @atelierholder,

This Python script seems to work:

import Rhino
import scriptcontext as sc

p0 = Rhino.Geometry.Point3d(0,0,0)
p1 = Rhino.Geometry.Point3d(10,10,0)
crv = Rhino.Geometry.LineCurve(p0, p1)

dir = Rhino.Geometry.Vector3d.ZAxis * 5
srf = Rhino.Geometry.Surface.CreateExtrusion(crv, dir)
brep = srf.ToBrep()

tol = sc.doc.ModelAbsoluteTolerance
out_breps, out_blends, out_walls = Rhino.Geometry.Brep.CreateOffsetBrep(brep, 2, False, False, tol)
for b in out_breps:
    sc.doc.Objects.AddBrep(b)
    
sc.doc.Objects.AddBrep(brep)
sc.doc.Views.Redraw()

– Dale

Your code is working but if i try to create an offset with an solid brep it failed every time.

Do i need to prepare the brep bevor i try to create an offset? Make it deformable or something like this?

Hi @atelierholder

Changing this:

out_breps, out_blends, out_walls = Rhino.Geometry.Brep.CreateOffsetBrep(brep, 2, False, False, tol)

to this:

out_breps, out_blends, out_walls = Rhino.Geometry.Brep.CreateOffsetBrep(brep, 2, True, False, tol)

in the above code will create a solid.

If you have some code that you think should work but it does not, please post it here so we can review.

Thanks,

– Dale