c4d.SplineObject

Cinema 4D gives you a generous number of predefined curves. Add to this the possibility to convert vector based artwork files from other programs and to add graphic characters and you have a large number of spline primitives at your fingertips. All of these spline primitives are parameterized. This means that the spline is merely the graphical representation of a mathematical formula built controlled by parameters you can edit the Attribute Manager.

Inheritance

Parent Class:

Members

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

    Spline type. Check out Spline Types.

    SPLINETYPE_LINEAR Linear.
    SPLINETYPE_CUBIC Cubic.
    SPLINETYPE_AKIMA Akima.
    SPLINETYPE_BSPLINE B-Spline.
    SPLINETYPE_BEZIER Bezier.
Return type:

c4d.SplineObject

Returns:

The new object.

SplineObject.GetInterpolationType()

Get the type of spline.

Return type:int
Returns:The type of spline. Check out Spline Types.
SPLINETYPE_LINEAR Linear.
SPLINETYPE_CUBIC Cubic.
SPLINETYPE_AKIMA Akima.
SPLINETYPE_BSPLINE B-Spline.
SPLINETYPE_BEZIER Bezier.
SplineObject.IsClosed()

Checks if spline is closed.

Return type:bool
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.
Raises:

IndexError – If the segment index is out of range : 0<=segment<GetSegmentCount().

Return type:

c4d.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.
Raises:

IndexError – If the segment index is out of range : 0<=segment<GetSegmentCount().

Return type:

c4d.Vector

Returns:

The spline point.

SplineObject.GetSegment(id)

Returns information about the segment:

segment = spline.GetSegment(0)
print segment["cnt"], segment["closed"] # int, bool
Parameters:id (int) – The segment.
Raises:IndexError – If the segment index id is out of range : 0<=id<GetSegmentCount().
Return type:dict{cnt: int, closed: bool}
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 – If the segment index is out of range : 0<=segment<GetSegmentCount().

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 PointObject.ResizeObject() of PointObject 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"]
Parameters:id (int) – The tangent index.
Raises:IndexError – If the tangent index id is out of range : 0<=segment<GetTangentCount().
Return type:dict{vl: Vector, vr: 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 (c4d.Vector) – The left tangent.
  • vr (c4d.Vector) – The right tangent.
Raises:

IndexError – If the tangent index id is out of range.

Spline Types

Linear

Type: SPLINETYPE_LINEAR

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

Cubic

Type: SPLINETYPE_CUBIC

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

Akima

Type: SPLINETYPE_AKIMA

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

B-Spline

Type: SPLINETYPE_BSPLINE

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

Bezier

Type: SPLINETYPE_BEZIER

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