Skip to content

Commit

Permalink
fix mesh extension bug (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
codekansas authored Aug 20, 2024
1 parent 1cf5bf2 commit b667bf0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions store/app/crud/urdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ async def set_urdf(
tmesh = trimesh.load(data, file_type=suffix)
assert isinstance(tmesh, trimesh.Trimesh)
except Exception:
print(data.read())
raise BadArtifactError(f"Invalid mesh file: {name}")
meshes.append((name, tmesh))

Expand All @@ -106,7 +105,6 @@ async def set_urdf(
raise BadArtifactError("Mesh element missing filename attribute.")
filepath = Path(filename).relative_to(".")
if filepath not in mesh_names:
print(mesh_names)
raise BadArtifactError(f"Mesh referenced in URDF was not uploaded: {filepath}")
mesh_names.remove(filepath)
mesh.set("filename", str(filepath.with_suffix(".obj")))
Expand All @@ -119,7 +117,8 @@ async def set_urdf(
for name, tmesh in meshes:
out_file = io.BytesIO()
tmesh.export(out_file, file_type="obj")
info = tarfile.TarInfo(name)
obj_name = Path(name).with_suffix(".obj").as_posix()
info = tarfile.TarInfo(obj_name)
info.size = out_file.tell()
out_file.seek(0)
tar.addfile(info, out_file)
Expand Down

0 comments on commit b667bf0

Please sign in to comment.