create_pointcloud_object
create_pointcloud_object(positions=None, name='PointCloud', collection=None)
Create a new Blender point cloud object.
Parameters
| positions |
np.ndarray |
The point positions as a numpy array with shape (N, 3). If None, creates an empty point cloud object. Defaults to None. |
None |
| name |
str |
The name of the object. Defaults to ‘PointCloud’. |
'PointCloud' |
| 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
|
Object |
The created point cloud object. |
Examples
import numpy as np
from databpy import create_pointcloud_object
# Create point cloud with 100 random points
positions = np.random.random((100, 3))
pc_obj = create_pointcloud_object(positions, name="MyPC")
print(len(pc_obj.data.points)) # 100