This documentation is for the free plugin Py4D in CINEMA 4D R11.5 and not for the C4DSDK of Python in CINEMA 4D R12. For R12, please visit PluginCafe.com

c4d.SplineObject – an polygon class

This is a very simple to use class for splines. Also check out a helper class in the c4d.utils module called SplineHelp.

class c4d.SplineObject

SuperClass

PointObject

Methods

static SplineObject.__init__(pcnt, type)
Parameters:
  • pcnt (int) – Point count.
  • type (int) –

    Spline type. Check out Spline Type.

    Tlinear Tlinear.
    Tcubic Cubic.
    Takima Akima.
    Tbspline B-Spline.
    Thermite Hermite.
Return type:

SplineObject

Returns:

The new object.

SplineObject.GetInterpolationType()

Get the type of spline.

Return type:

int

Returns:

The type of spline. Check out Spline Type.

Tlinear

Tlinear.

Tcubic

Cubic.

Takima

Akima.

Tbspline

B-Spline.

Thermite

Hermite.

SplineObject.IsClosed()

Checks if spline is closed.

Return type:bool
Returns:Returns True if the spline is closed.
SplineObject.GetSplinePoint(t[, segment=0])

Get the spline point at a position along the given segment.

Parameters:
  • t (float) – The position 0.0<=t<=1.0 along the segment.
  • segment (int) – The segment
Return type:

Vector

Returns:

The spline point

SplineObject.GetSplineTangent(t[, segment=0])

Get the spline tangent at a position along the given segment.

Parameters:
  • t (float) – The position 0.0<=t<=1.0 along the segment.
  • segment (int) – The segment to get the point in.
Return type:

Vector

Returns:

The spline point

SplineObject.GetSegment(id)

Returns information about the segment.

Note

0 <= id < GetSegmentCount.

Example:

segment = spline.GetSegment(0)
print segment["cnt"], segment["closed"] #is int, bool
Parameter:id (int) – The segment.
Raises IndexError:
 Raise if segment index is out of range.
Return type:dict
Returns:The segment.
SplineObject.SetSegment(segment, cnt, closed)

Set properties of the segment.

Parameters:
  • id (int) – The segment
  • cnt (int) – The count of points.
  • closed (bool) – True if the segment is closed.
Raises IndexError:
 

Raise if segment index is out of range.

SplineObject.GetSegmentCount()

Returns the count of segments.

Return type:int
Returns:The count.
SplineObject.ResizeObject(pcnt[, scnt=-1])

Change the number of segments and points for this spline. If scnt is -1 or not set, the method of PointObject.ResizeObject is used.

Parameters:
  • pcnt (int) – The new point count.
  • scnt (int) – The new segment count.
Return type:

bool

Returns:

Success of changing the number of points and segments.

SplineObject.SetDefaultCoeff()

Initialise the spline with default coefficients.

Return type:bool
Returns:True if successful, otherwise False.
SplineObject.GetTangentCount()

Returns the count of tangents.

Return type:int
Returns:The count.
SplineObject.GetTangent(id)

Return a tangent:

tangent = spline.GetTangent()
print tangent["vl"], tangent["vr"]
Parameter:id (int) – The tangent index.
Raises IndexError:
 Raise if tangent index is out of range.
Return type:dict of Vector
Returns:Left and right part that defines the tangent.
SplineObject.SetTangent(id, vl, vr)

Set a tangent:

spline.SetTangent(index=12, vl=tangent["vl"], vr=tangent["vr"])
Parameters:
  • id (int) – The tangent index.
  • vl (Vector) – The left tangent.
  • vr (Vector) – The right tangent.
Raises IndexError:
 

Raise if tangent index is out of range.

Spline Type

Tlinear

../../../../../../../../_images/tlinear.png

Tcubic

../../../../../../../../_images/tcubic.png

Takima

../../../../../../../../_images/takima.png

Tbspline

../../../../../../../../_images/tbspline.png

Thermite

../../../../../../../../_images/thermite.png

Table Of Contents

This Page