Split curve in Python

How can I select a point on a curve and split the curve at that point. SplitCurve in the script below splits the curve but how do I use the point I’ve picked to make the correct Domain, or is there some other way of doing this just picking one point.

import rhinoscriptsyntax as rs

curve = rs.GetObject("Select a curve to split", rs.filter.curve)

if rs.IsCurve(curve):
    point = rs.GetPointOnCurve(curve, "Point on curve")
    if point: rs.AddPoint(point)
    domain = rs.CurveDomain(curve)
    parameter = domain[1] *.9
    rs.SplitCurve( curve, parameter )

Thanks Mark

Perhaps something like:

import rhinoscriptsyntax as rs
curve = rs.GetObject("Select a curve to split", rs.filter.curve)
if curve:
    point = rs.GetPointOnCurve(curve, "Point on curve")
    if point:
        rs.AddPoint(point)
        param=rs.CurveClosestPoint(curve,point)
        rs.SplitCurve(curve, param)

CurveClosestPoint() gets the parameter on the curve closest to given point.

HTH, --Mitch

Note that you do not need to add the point in order to use it for splitting.

Yes, thanks for mentioning that, I thought he had it in there just to see where the split would happen in the example…

Thanks for the help. And yes I was only drawing the point to see what was going on.

Mark.