Skip to content

Instantly share code, notes, and snippets.

@wkentaro
Created July 20, 2020 18:17
Show Gist options
  • Save wkentaro/9c46bafe2ba7fb7350c7ce5c206dcdb7 to your computer and use it in GitHub Desktop.
Save wkentaro/9c46bafe2ba7fb7350c7ce5c206dcdb7 to your computer and use it in GitHub Desktop.
import numpy as np
import trimesh
import pickpp
models = pickpp.datasets.YCBVideoModelDataset()
# cad_ids = models.get_cad_ids(class_id=15)
cad_ids = models.get_cad_ids(class_id=20)
visual_file = models.get_cad_file_from_id(cad_ids[0])
collision_file = pickpp.utils.get_collision_file(visual_file)
print(visual_file)
print(collision_file)
visual = trimesh.load(visual_file)
collision = trimesh.load(
collision_file, split_object=True, group_material=False
)
if isinstance(collision, trimesh.Scene):
for name, geometry in collision.geometry.items():
geometry.visual.vertex_colors = np.random.random((3,))
else:
collision.visual.vertex_colors = np.random.random((3,))
scene = trimesh.Scene()
scene.add_geometry(collision)
scene.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment