Python Equivalent of Cut Plane Command

@rleader,

you might just intersect your plane with the loft and from the (closed) curve(s) create planar surface(s). Below is an example using the WorldXY Plane. Once you have the resulting planar surface, print out the area.

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
    
def DoSomething():
    id = rs.GetObject("Select surface or polysurface", 8+16, True, False)
    if not id: return
    
    tol = scriptcontext.doc.ModelAbsoluteTolerance
    brep = rs.coercebrep(id, True)
    plane = Rhino.Geometry.Plane.WorldXY
    
    rc, crvs, pts = Rhino.Geometry.Intersect.Intersection.BrepPlane(brep, plane, tol)
    if not rc: return 
    
    breps = Rhino.Geometry.Brep.CreatePlanarBreps(crvs)
    if not breps: return 
    
    ids = [scriptcontext.doc.Objects.AddBrep(b) for b in breps if b.IsValid]
    if len(ids) != 0: 
        rs.SelectObjects(ids)
    else:
        print "No surface(s) built"
    
if __name__=="__main__":
    DoSomething()

To move the plane around, just change it`s origin.

c.

1 Like