TrimBrep does not work

Trim Brep does not work in Rhino6 but it work in Rhino5.

import rhinoscriptsyntax as rs

obj = rs.GetObjects("Select surface or polysurface to trim")
cutters = rs.GetObjects("Select cutting surface or polysurface")
trim = rs.TrimBrep(obj[0],cutters[0])
print trim

TrimBrep.3dm (99.1 KB)

Your file tolerance is too large for the size of the objects. If you use normal Rhino Trim or Split, the front solid cylinder won’t trim. If you make the file tolerance 0.001, both the normal Rhino commands as well as the script work.

1 Like

Thank, that’s better, but the direction is the opposite! I checked the geometry by Dir, but there was no difference.

In Rhino 5 it is how I want,

In Rhino 6 it is the opposite.

When I cut with the second objct the all pipes disappear.

image

But, When I cut in the middle, all works fine.

image

TrimBrep test2.3dm (195.4 KB)

Hi @onrender,

TrimBrep call the RhinoCommon Brep.Trim method to do the grunt work. The documentation for that gives a better explanation of the scope and limitations of the trim. Maybe that will shed some light?
Brep.Trim Method (Brep, Double) (rhino3d.com)

HTH
Jeremy

Hi Jeremy,

Thank you for the help. Unfortunatelly, Rhino is not consistent in TrimBrep.

Rhino 5 cuts Surface and Polysurface - Removes part inside
Rhino 6 cuts only Polysurface - Removes the part outside

Are you aware the open surface has its normal pointing inwards instead of outwards? Furthermore your closed surface is grouped for no obvious reason. Once the open surface normals point outwards, at least the commands Trim and Split work like expected.