Python Equivalent of Cut Plane Command

Does anyone know a quick, reiterable way to generate a surface at the intersection of a plane and lofted surface?

Essentially i’m looking to determine the cross-sectional area along an airplane at various stations which I would define the location of.

Any help would be appreciated, Thanks!


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: 
        print "No surface(s) built"
if __name__=="__main__":

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


1 Like