Sel crossing with python

hi

I need to select some curves. I know the curves are placed on the Xaxis.

If i was drawing in rhino i would use the selcrossing command. but i cant find an alternative for it in python. Can anyone help me?

Thanks in advance

/Astrid

Maybe this will help…

https://developer.rhino3d.com/api/RhinoScriptSyntax/#selection-WindowPick

–Mitch

thanks
Very helpful

and other thing im struggling with is to split curves with a plane(WorldZXPlane).

Any advice?

here’s one example…

(Intersection events are somewhat complicated to handle)

import rhinoscriptsyntax as rs

def SplitCrvsWPlane():
    crvs=rs.GetObjects("Select curves to split with plane",4,preselect=True)
    if not crvs: return
    #can change this
    plane=rs.WorldZXPlane()
    
    for crv in crvs:
        #for each curve, intersect with the plane
        insec=rs.PlaneCurveIntersection(plane,crv)
        if insec:
            #empty list to hold intersection parameters
            params=[]
            for event in insec:
                #add parameter of point intersection (or near end of overlap)
                params.append(event[5])
                #rs.AddPoint(event[1]) #uncomment to put point at intersection
                if event[0]==2:
                    #overlap intersection, add parameter of far end of overlap
                    params.append(event[6])
                    #rs.AddPoint(event[2]) #uncomment to put point at intersection
            #split curve at all parameters found, delete originals
            rs.SplitCurve(crv,params,True)
SplitCrvsWPlane()

Otherwise you can get the bounding box of all curves, create a plane surface big enough to cover all the curves, then script rs.Command(“Split”) to split the curves with the plane (then delete the plane).

HTH, --Mitch