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

On this page

  • Parameters
  • Returns
  • See Also
  • Notes
  • Examples
  1. Objects
  2. create_bob

create_bob

create_bob(
    vertices=None,
    edges=None,
    faces=None,
    name='NewObject',
    collection=None,
    uuid=None,
)

Create a BlenderObject wrapper around a new Blender object.

Parameters

Name Type Description Default
vertices ndarray or None Array of vertex coordinates. Each row represents a vertex. Default is None. None
edges ndarray or None Array of edge indices. Each row contains indices of vertices forming an edge. Default is None. None
faces ndarray or None Array of face indices. Each row contains indices of vertices forming a face. Default is None. None
name str Name of the created object. Default is “NewObject”. 'NewObject'
collection bpy.types.Collection or None Blender collection to link the object to. Default is None. None
uuid str or None Directly set the UUID on the resulting BlenderObject rather than generating one. Default is None. None

Returns

Name Type Description
BlenderObject A wrapped Blender object with additional functionality.

See Also

: The underlying function used to create the Blender object.

Notes

If uuid is provided, it will be set both on the BlenderObject wrapper and the underlying Blender object.

Examples

import numpy as np
from databpy.object import create_bob
vertices = np.array([[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]])
bob = create_bob(vertices=vertices, name="MyObject")
print(bob.name)
print(len(bob))
bob.named_attribute("position")
MyObject
4
array([[0., 0., 0.],
       [1., 0., 0.],
       [1., 1., 0.],
       [0., 1., 0.]])