From be50c5e3847d6090845d97d3c3bf76325c4f039b Mon Sep 17 00:00:00 2001 From: lukestroh Date: Tue, 11 Mar 2025 12:21:17 -0700 Subject: [PATCH 1/2] mesh downloader update --- pybullet_tree_sim/utils/mesh_downloader.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pybullet_tree_sim/utils/mesh_downloader.py b/pybullet_tree_sim/utils/mesh_downloader.py index 1414a12..840040d 100644 --- a/pybullet_tree_sim/utils/mesh_downloader.py +++ b/pybullet_tree_sim/utils/mesh_downloader.py @@ -17,14 +17,18 @@ def get_filename_from_url(url: str) -> str: def is_download_needed(target_file_path: str) -> bool: if not os.path.exists(meshes_path): + print(f"Creating path {meshes_path}") os.mkdir(meshes_path) return True + if not os.path.exists(os.path.join(meshes_path, "trees")): if not os.path.isfile(os.path.join(meshes_path, "pybullet-tree-sim-meshes.zip")): # TODO: pass name into func return True else: + print(f"File {os.path.join(meshes_path, "pybullet-tree-sim-meshes.zip")} already exists") return False else: + print(f"Path {os.path.join(meshes_path, 'trees')} already exists.") return False @@ -58,6 +62,7 @@ def download_file(url: str, target_file_path: str) -> bool: def unzip(zip_file: str): + print(f"Extracting file {zip_file}") with zipfile.ZipFile(zip_file, "r") as zipper: zipper.extractall(os.path.dirname(zip_file)) return From 943073e7d2067863efcb4290f474c2acb673c751 Mon Sep 17 00:00:00 2001 From: lukestroh Date: Tue, 11 Mar 2025 12:24:04 -0700 Subject: [PATCH 2/2] mesh_downloader update --- pybullet_tree_sim/utils/mesh_downloader.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pybullet_tree_sim/utils/mesh_downloader.py b/pybullet_tree_sim/utils/mesh_downloader.py index 840040d..dbe785d 100644 --- a/pybullet_tree_sim/utils/mesh_downloader.py +++ b/pybullet_tree_sim/utils/mesh_downloader.py @@ -65,6 +65,10 @@ def unzip(zip_file: str): print(f"Extracting file {zip_file}") with zipfile.ZipFile(zip_file, "r") as zipper: zipper.extractall(os.path.dirname(zip_file)) + print(f"Files extracted") + + if not os.path.exists(meshes_path): + print(f"Cannot find path {meshes_path}, error with process. Try running the file directly.") return