c4d.SplineObject

class 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.

The instance object class of type Ospline.

See also

Spline Types.

Methods Signatures

SplineObject.__init__(self, pcnt, type)

type pcnt

int

SplineObject.GetInterpolationType(self)

Get the type of spline.

SplineObject.IsClosed(self)

Checks if spline is closed.

SplineObject.GetSplinePoint(self, t[, segment])

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

SplineObject.GetSplineTangent(self, t[, segment])

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

SplineObject.GetSegment(self, id)

Returns information about the segment.

SplineObject.SetSegment(self, id, cnt, closed)

Set properties of the segment.

SplineObject.GetSegmentCount(self)

Returns the count of segments.

SplineObject.ResizeObject(self, pcnt[, scnt])

Change the number of segments and points for this spline.

SplineObject.SetDefaultCoeff(self)

Initialise the spline with default coefficients.

SplineObject.GetTangentCount(self)

Returns the count of tangents.

SplineObject.GetTangent(self, id)

Return a tangent.

SplineObject.SetTangent(self, id, vl, vr)

Set a tangent.

Inheritance

Parent Class:

Methods Documentation

SplineObject.__init__(self, 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.

SplineObject.GetInterpolationType(self)

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(self)

Checks if spline is closed.

Return type

bool

Returns

True if the spline is closed.

SplineObject.GetSplinePoint(self, 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(self, 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(self, id)

Returns information about the segment.

>>> op.GetSegment(0)
{'closed': True, 'cnt': 4}
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(self, id, 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(self)

Returns the count of segments.

Return type

int

Returns

The count.

SplineObject.ResizeObject(self, 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(self)

Initialise the spline with default coefficients.

Return type

bool

Returns

True if successful, otherwise False.

SplineObject.GetTangentCount(self)

Returns the count of tangents.

Return type

int

Returns

The count.

SplineObject.GetTangent(self, id)

Return a tangent.

>>> data = op.GetTangent(0)
>>> data
{'vl': Vector(0, -83, 0), 'vr': Vector(0, 83, 0)}
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(self, id, vl, vr)

Set a tangent.

>>> # This is a continuation of the GetTangent() example.
>>> op.SetTangent(2, data["vl"], data["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.