Updating a spline
-
Hi
How to update a spline if the number of points changes ?
If the number of points is the same, we can use the following function:
def spline_update(spline,tabPoint): dim = len(tabPoint) for i in range(0,dim): spline.SetPoint(i,tabPoint[i]) spline.Message(c4d.MSG_UPDATE) return spline
If the number of points changes, we must use the ResizeObject() method
I'm looking for an example, which will save me from doing tests.
-
-
Hello @Kantronin,
I have moved your topic due to being in the wrong forum. You might want to look at our geometry_splineobject_s26.py example, as it demonstrates all fundamental aspects of the type, including resizing it.
Cheers,
Ferdinand -
I made this function which works fine:
def spline_update(doc,spline,tabNewPoint): tabPoint = spline.GetAllPoints() dim = len(tabNewPoint) if len(tabPoint) != dim: spline.ResizeObject(dim) for i in range(0,dim): point = tabNewPoint[i] spline.SetPoint(i,point) spline.Message(c4d.MSG_UPDATE) return spline