user: Show practical ways to work with Spline(bpy_struct) in a Blender add-on or script – include code.

assistant: # Spline(bpy_struct)

base class — [`bpy_struct`](bpy.types.bpy_struct.html#bpy.types.bpy_struct "bpy.types.bpy_struct")

*class* bpy.types.Spline(*bpy_struct*)
:   Element of a curve, either NURBS, Bézier or Polyline or a character with text objects

    bezier_points
    :   Collection of points for Bézier curves only

        Type:
        :   [`SplineBezierPoints`](bpy.types.SplineBezierPoints.html#bpy.types.SplineBezierPoints "bpy.types.SplineBezierPoints") [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of [`BezierSplinePoint`](bpy.types.BezierSplinePoint.html#bpy.types.BezierSplinePoint "bpy.types.BezierSplinePoint"), (readonly)

    character_index
    :   Location of this character in the text data (only for text curves)

        Type:
        :   int in [0, inf], default 0, (readonly)

    hide
    :   Hide this curve in Edit mode

        Type:
        :   boolean, default False

    material_index
    :   Material slot index of this curve

        Type:
        :   int in [0, 32767], default 0

    order_u
    :   NURBS order in the U direction. Higher values make each point influence a greater area, but have worse performance.

        Type:
        :   int in [2, 64], default 0

    order_v
    :   NURBS order in the V direction. Higher values make each point influence a greater area, but have worse performance.

        Type:
        :   int in [2, 64], default 0

    point_count_u
    :   Total number points for the curve or surface in the U direction

        Type:
        :   int in [0, inf], default 0, (readonly)

    point_count_v
    :   Total number points for the surface on the V direction

        Type:
        :   int in [0, inf], default 0, (readonly)

    points
    :   Collection of points that make up this poly or nurbs spline

        Type:
        :   [`SplinePoints`](bpy.types.SplinePoints.html#bpy.types.SplinePoints "bpy.types.SplinePoints") [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of [`SplinePoint`](bpy.types.SplinePoint.html#bpy.types.SplinePoint "bpy.types.SplinePoint"), (readonly)

    radius_interpolation
    :   The type of radius interpolation for Bézier curves

        Type:
        :   enum in [`'LINEAR'`, `'CARDINAL'`, `'BSPLINE'`, `'EASE'`], default `'LINEAR'`

    resolution_u
    :   Curve or Surface subdivisions per segment

        Type:
        :   int in [1, 1024], default 0

    resolution_v
    :   Surface subdivisions per segment

        Type:
        :   int in [1, 1024], default 0

    tilt_interpolation
    :   The type of tilt interpolation for 3D, Bézier curves

        Type:
        :   enum in [`'LINEAR'`, `'CARDINAL'`, `'BSPLINE'`, `'EASE'`], default `'LINEAR'`

    type
    :   The interpolation type for this curve element

        Type:
        :   enum in [`'POLY'`, `'BEZIER'`, `'NURBS'`], default `'POLY'`

    use_bezier_u
    :   Make this nurbs curve or surface act like a Bézier spline in the U direction

        Type:
        :   boolean, default False

    use_bezier_v
    :   Make this nurbs surface act like a Bézier spline in the V direction

        Type:
        :   boolean, default False

    use_cyclic_u
    :   Make this curve or surface a closed loop in the U direction

        Type:
        :   boolean, default False

    use_cyclic_v
    :   Make this surface a closed loop in the V direction

        Type:
        :   boolean, default False

    use_endpoint_u
    :   Make this nurbs curve or surface meet the endpoints in the U direction

        Type:
        :   boolean, default False

    use_endpoint_v
    :   Make this nurbs surface meet the endpoints in the V direction

        Type:
        :   boolean, default False

    use_smooth
    :   Smooth the normals of the surface or beveled curve

        Type:
        :   boolean, default False

    calc_length(*\**, *resolution=0*)
    :   Calculate spline length

        Parameters:
        :   **resolution** (*int in* *[**0**,* *1024**]**,* *(**optional**)*) – Resolution, Spline resolution to be used, 0 defaults to the resolution_u

        Returns:
        :   Length, Length of the polygonaly approximated spline

        Return type:
        :   float in [0, inf]

    valid_message(*direction*)
    :   Return the message

        Parameters:
        :   **direction** (*int in* *[**0**,* *1**]*) – Direction, The direction where 0-1 maps to U-V

        Returns:
        :   Return value, The message or an empty string when there is no error

        Return type:
        :   string

    *classmethod* bl_rna_get_subclass(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The RNA type or default when not found.

        Return type:
        :   [`bpy.types.Struct`](bpy.types.Struct.html#bpy.types.Struct "bpy.types.Struct") subclass

    *classmethod* bl_rna_get_subclass_py(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The class or default when not found.

        Return type:
        :   [type](#bpy.types.Spline.type "bpy.types.Spline.type")