Skip to content

Instantly share code, notes, and snippets.

@geyang
Created February 26, 2024 08:19
Show Gist options
  • Save geyang/5a1aef3dbb4ab9ab7d42cfe690e1ccb5 to your computer and use it in GitHub Desktop.
Save geyang/5a1aef3dbb4ab9ab7d42cfe690e1ccb5 to your computer and use it in GitHub Desktop.
Python script for simplifying mesh files in a URDF
import trimesh # Replace with your chosen library
files = ['obj/calf.obj',
'obj/hip.obj',
'obj/thigh_mirror.obj',
'obj/thigh.obj',
'obj/trunk.obj',
]
for file in files:
mesh = trimesh.load(file)
simplified_mesh = mesh.simplify_quadratic(target_face_count=1000) # Replace with desired number
trimesh.exchange.export.export_mesh(simplified_mesh, "simplified_"+file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment