Bézier/Bspline curves and surfaces

Can you please explain how to generate a nth degree Bézier/Bspline curve using a set of points in Rhino-python? If it’s achievable, I’d also like to know the process of creating a Bézier/B-spline surface using these curves.
I tried with degree two:
Screenshot 2024-04-14 at 8.03.20 PM

import rhinoscriptsyntax as rs
import scriptcontext as sc
import math

import System
import System.Collections.Generic
import Rhino
import Rhino.Geometry as geo

#Define the control points
points = [ geo.Point3d(0, 0, 0),  geo.Point3d(1, 1, 0),  geo.Point3d(2, -1, 0)]
bezier_curve = Rhino.Geometry.BezierCurve(points)

you need to define the points as Point3d - not as pure arrays of numbers.

1 Like

Hi Tom,
Thanks for the answer, I ran your code and still getting the same error message.


import Rhino
import Rhino.Geometry as rg

# define point3D points
control_points = [
    rg.Point3d(0, 0, 0),
    rg.Point3d(5, 10, 0),
    rg.Point3d(10, 5, 0),
    rg.Point3d(15, 0, 0)

curve = rg.Curve.CreateInterpolatedCurve(control_points, 3) # create interpolated curve
#Rhino.RhinoDoc.ActiveDoc.Objects.AddCurve(curve) # add interpolated curve to rhino

bezier = rg.BezierCurve.CreateBeziers(curve) # create bezier curves
for segment in bezier:

If you want to work with Bezier curves you could also translate an interpolatedCurve into bezier curves.