Hi everyone.
I want to obtain the boundary curve resulting from the intersection of a defined cutting plane through a surface. To this end I employed the AddSrfSectionCrvs in my python script. But I faced with this error and I don’t know how to figure it out.
Scurve=rs.AddSrfSectionCrvs (Object, arrPlane)

Message: ‘module’ object has no attribute ‘AddSrfSectionCrvs’

line 38, in viewportclock, “D:\Users\suuser\Documents\sample”
line 85, in , “D:\Users\suuser\Documents\sample”

AddSrfSectionCrvs is only in Rhinoscript for the moment, it is not available as a Python rhinoscriptsyntax method. You will need to work around it, one way might be to create a line that represents the cutting plane then project it onto the surface to section… Or create a plane surface and intersect it with the object to be sectioned.

Dear Helvetosaur
Thank you for your help. I already defined a plane i.e. arrplane. how can I use this plane to obtain the intersection curve between it and the object. Is there any specific command available for that?

There isn’t no, brep/plane intersection is one thing that seems to be missing from rhinoscriptsyntax. There is rs.IntersectBreps() but that would require you to make a plane surface bigger than the object to be intersected, and use that to intersect your object. That is one of several workarounds possible.

Brep/Plane intersection is available in RhinoCommon though, so below is a “handmade” function definition that more or less mimics Rhino.AddSrfSectionCrvs. You need to pass the object id and the plane as arguments, it should add the section curves to the document.

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

def AddSrfSectionCrvs(obj_id,plane,tol=sc.doc.ModelAbsoluteTolerance):
    #mimics the Rhinoscript method not available in python rhinoscriptsyntax
    #returns a list of curve ids of intersection or None if failure
    if brep:
        if insec and insec[0] and insec[1]:
            crv_ids=[sc.doc.Objects.AddCurve(crv) for crv in insec[1]]
            return crv_ids

#test function
obj_id=rs.GetObject("Select surface or polysurface to intersect",8+16,True)
if obj_id:
1 Like

Thank you for your kind help.