databpy
  • Home
  • Attributes
  • API
  1. Objects
  2. create_curves_object
  • Function reference
  • Attribute
    • named_attribute
    • store_named_attribute
    • remove_named_attribute
    • AttributeDomains
    • AttributeTypes
    • AttributeArray
  • Collections
    • create_collection
  • Objects
    • create_object
    • create_mesh_object
    • create_curves_object
    • create_pointcloud_object
    • create_bob
    • evaluate_object
    • BlenderObject
    • LinkedObjectError

On this page

  • create_curves_object
    • Parameters
    • Returns
    • Raises
    • Examples
  1. Objects
  2. create_curves_object

create_curves_object

create_curves_object(
    positions=None,
    curve_sizes=None,
    name='Curves',
    collection=None,
)

Create a new Blender curves object (new Curves type, not legacy Curve).

Parameters

Name Type Description Default
positions np.ndarray The control point positions as a numpy array with shape (N, 3). If None, creates an empty curves object. Defaults to None. None
curve_sizes list[int] | np.ndarray Number of points in each curve. For example, [4, 5, 6] creates 3 curves with 4, 5, and 6 control points respectively. Total must equal len(positions). If None, creates an empty curves object. Defaults to None. None
name str The name of the object. Defaults to ‘Curves’. 'Curves'
collection bpy.types.Collection The collection to link the object to. Defaults to None. None

Returns

Name Type Description
Object The created curves object.

Raises

Name Type Description
ValueError If positions and curve_sizes lengths don’t match.

Examples

import numpy as np
from databpy import create_curves_object

# Create 2 curves with 3 and 4 points
positions = np.random.random((7, 3))
curves_obj = create_curves_object(positions, [3, 4])