Skip to content

Export uncolored point clouds to XYZ - #2630

Merged
mikedh merged 1 commit into
mikedh:release/rigidfrom
INo-xious:fix/xyz-export-uncolored
Oct 20, 2026
Merged

mikedh merged 1 commit into
mikedh:release/rigidfrom
INo-xious:fix/xyz-export-uncolored

Conversation

@INo-xious

Copy link
Copy Markdown
Contributor

Exporting an uncolored PointCloud to XYZ crashed: colors is an empty array, not None, so np.hstack failed. Colors are now stacked only when there is one per point, like the PLY exporter.

import numpy as np
import trimesh

cloud = trimesh.PointCloud(np.random.default_rng(7).random((10, 3)))
# on main: ValueError: all the input arrays must have same number of dimensions
e = cloud.export(file_type="xyz")
assert all(len(line.split()) == 3 for line in e.splitlines())
back = trimesh.load(trimesh.util.wrap_as_stream(e), file_type="xyz")
assert np.allclose(back.vertices, cloud.vertices)

Added test_xyz_export_uncolored (fails on main); ran test_points.py, test_xyz_colors.py, test_export.py and ruff.

AI-assisted.

@mikedh
mikedh changed the base branch from main to release/rigid October 20, 2026 17:36
@mikedh
mikedh merged commit da291f6 into mikedh:release/rigid Oct 20, 2026
1 check passed
@mikedh

mikedh commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants