importezdxfdwg=ezdxf.readfile("simple_spline.dxf")msp=dwg.modelspace()spline=msp.query('SPLINE')[0]# take the first spline# use the context managerwithspline.edit_data()asdata:# data contains standard python listsdata.fit_points.append((2250,2500,0))points=data.fit_points[:-1]# pitfall: this creates a new list without a connection to the spline objectpoints.append((3000,3000,0))# has no effect for the spline objectdata.fit_points=points# replace points of fp, this way it works# the context manager calls automatically spline.set_fit_points(data.fit_points)dwg.saveas("extended_spline.dxf")

You can set additional control points, but if they do not fit the auto-generated AutoCAD values, they will be ignored
and don’t mess around with knot values.

importezdxfdwg=ezdxf.readfile("AutoCAD_generated.dxf")msp=dwg.modelspace()spline=msp.query('SPLINE')[0]# take the first splinewithspline.edit_data()asdata:# context mangerdata.fit_points.append((2250,2500,0))# data.fit_points is a standard python list# As far as I tested this works without complaints from AutoCAD, but for the case of problemsdata.knot_values=[]# delete knot values, this could modify the geometry of the splinedata.weights=[]# delete weights, this could modify the geometry of the splinedata.control_points=[]# delete control points, this could modify the geometry of the splinedwg.saveas("modified_spline.dxf")

Check if spline is closed or close/open spline, for a closed spline the last fit point is connected with the first
fit point:

ifspline.closed:# this spline is closedpass# close a splinespline.closed=True# open a splinespline.closed=False