Closed brep get negetive volume

hi, m new to rhino common, and wrote a ghpython component to extrude a curve both direction to get a closed brep, but the volume of brep is a negative value. please help. (5.8 KB) volume.3dm (32.3 KB)


import rhinoscriptsyntax as rs
if rs.IsCurvePlanar(crv) and rs.IsCurveClosed(crv):
    normal = rs.CurvePlane(crv)[3]
    crv = rs.MoveObject(crv, -normal * left)
    a = rs.ExtrudeCurve(crv, rs.AddLine([0,0,0], normal * (left+right)))


import Rhino.Geometry as rg
isplanar, plane = crv.TryGetPlane()
if isplanar and crv.IsClosed:
    normal = plane.Normal
    crv.Translate(-normal * left)
    a = rg.Extrusion.Create(crv, left+right, True) (7.3 KB)

thank you very much. but what’s wrong with my codes. still don’t know why get negative volume.

You breps solidOrientation was inward, you need to flip them:

so = x.SolidOrientation
if (int(so) == -1):
a = x (7.4 KB)

Thanks for the quick reply. After i bake the brep to rhino, the volume is positive. The solid orientation is only in rhino common?

As far as I know, rhinoscriptsyntax always creates outward breps, So you don’t need to check it manually:

1 Like

Thank you. :+1: