databpy 0.11.0
  • Home
  • Attributes
  • API
  • Changelog
  1. Objects
  2. create_curves_object
  • Function reference
  • Attribute
    • named_attribute
    • store_named_attribute
    • remove_named_attribute
    • list_attributes
    • AttributeDomains
    • AttributeTypes
    • AttributeArray
    • Attribute
    • attribute.guess_atype_from_array
  • Collections
    • create_collection
    • move_to_collection
  • Objects
    • create_object
    • create_mesh_object
    • create_curves_object
    • create_pointcloud_object
    • create_bob
    • evaluate_object
    • GeometrySet
    • BlenderObject
    • BlenderObjectAttribute
    • BlenderObjectBase
  • Errors
    • DatabpyError
    • NamedAttributeError
    • AttributeNotFoundError
    • AttributeMismatchError
    • LinkedObjectError
  • Utilities
    • require
    • require_data
    • mesh_data
    • curves_data
    • pointcloud_data
    • volume_data
    • active_scene
    • active_object
    • centre
    • lerp
  • Nodes (deprecated)
    • nodes.new_tree
    • nodes.swap_tree
    • nodes.custom_string_iswitch
    • nodes.append_from_blend
    • nodes.new_socket
    • nodes.tree_interface
    • nodes.input_socket
    • nodes.output_socket
    • nodes.socket_value
    • nodes.set_socket_value
    • nodes.MaintainConnections
    • nodes.DuplicatePrevention

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 (the hair curves type, not the legacy Curve type).

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, which links it to a collection named “Collection”, created if needed. None

Returns

Name Type Description
Object The created curves object.

Raises

Name Type Description
ValueError If only one of positions and curve_sizes is given, or their 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])
create_mesh_object
create_pointcloud_object