How to move curve point in python

Hi, I’m trying to adjust curve point by python. But I can’t make it works. Please help me, thanks!

import rhinoscriptsyntax as rs
import scriptcontext as sc
obj = rs.GetObject(“Select a curve”)
point=rs.CurvePoints(obj)
pp=sc.doc.Objects.AddPoint(point[1])
#3d point
rs.MoveObject(point[1],[0,0,0])
#guid
rs.MoveObject(pp,[0,0,0])

I think the rs.CurvePoint() call probably created a copy of the list of control points
You need to somehow point directly to NurbsCurve.Point property
Here I have a (perhaps clumsy) solution…

import rhinoscriptsyntax as rs
import Rhino.Geometry as rhg
import Rhino as rh
import scriptcontext as sc

c = rs.GetCurveObject()[0]
robj = sc.doc.Objects.FindId(c)
crv = robj.Geometry
nurbs = crv.ToNurbsCurve()

# below line is an example; do what you need in your case
nurbs.Points[1] = rhg.Point3d(5,5,0)

sc.doc.Objects.AddCurve(nurbs, rh.DocObjects.ObjectAttributes())
sc.doc.Objects.Remove(robj)