Skip to content

Commit 69188ac

Browse files
authored
Distributing points randomly in 3D space (values between 0-1 on each axis) instead of stacking all points at the origin (#24)
* add readme * better import * add image
1 parent 683deb9 commit 69188ac

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ https://github.com/user-attachments/assets/1b8a26d7-ce35-4717-bf73-bc05dbf3912a
1010

1111
## How to Use
1212

13-
Option 1: Drag and drop your CSV file directly into Blenders viewport.
13+
Option 1: Drag and drop your CSV file directly into Blender's viewport.
1414

1515
Option 2: Use the menu:
1616
File → Import → CSV
1717

1818
### **Using the Data**
1919

20-
- The imported data will appear in Blenders **Spreadsheet Editor**.
20+
- The imported data will appear in Blender's **Spreadsheet Editor**.
2121
- Use the **Named Attribute** in **Geometry Nodes** to access the imported data.
2222

2323
And the data will show up in the speadsheet:
@@ -65,6 +65,9 @@ uv run -m pytest
6565

6666
## Version 0.1.8
6767

68+
- Improved default data visualization by distributing points randomly in 3D space (values between 0-1 on each axis) instead of stacking all points at the origin
69+
![image](https://github.com/user-attachments/assets/0827092c-3bf5-41fa-aeff-f8efb29877df)
70+
6871
- For performance reasons, the number of unique strings is limited to 3000 by default (processing this many strings takes about 7 seconds on a Mac M3)
6972
- Note: This limit applies to the number of unique strings, not the total count. For example, a CSV with 100,000 strings but only 100 unique values won't be affected by the limit.
7073
- You can override this limit when using the API directly:

csv_importer/parsers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def polars_df_to_bob(df: pl.DataFrame, name: str, string_limit: int = 3000) -> db.BlenderObject:
9-
vertices = np.zeros((len(df), 3), dtype=np.float32)
9+
vertices = np.random.random((len(df), 3)).astype(np.float32)
1010
bob = db.create_bob(vertices, name=name)
1111

1212
update_bob_from_polars_df(bob, df, string_limit=string_limit)
@@ -17,7 +17,7 @@ def update_obj_from_csv(obj: bpy.types.Object, csv_file: str, string_limit: int
1717
bob = db.BlenderObject(obj)
1818
df = pl.read_csv(csv_file)
1919
if len(df) != len(bob):
20-
bob.new_from_pydata(np.zeros((len(df), 3), dtype=np.float32))
20+
bob.new_from_pydata(np.random.random((len(df), 3)).astype(np.float32))
2121
update_bob_from_polars_df(bob, df, string_limit=string_limit)
2222

2323

0 commit comments

Comments
 (0)