| import os |
| from isaacsim import SimulationApp |
|
|
| |
| simulation_app = SimulationApp({"headless": True}) |
|
|
| from pxr import Usd |
|
|
| |
| USD_PATH = os.path.abspath("/workspace/IsaacLab/GR-1/GR1T2_fourier_hand_6dof/GR1T2_fourier_hand_6dof.usd") |
| |
| LOG_FILE = os.path.abspath("usd_structure.log") |
|
|
| stage = Usd.Stage.Open(USD_PATH) |
|
|
| if not stage: |
| print(f"[LỖI] Không thể mở file: {USD_PATH}") |
| else: |
| print(f"⏳ Đang quét cấu trúc file USD và lưu vào {LOG_FILE}...") |
| |
| |
| with open(LOG_FILE, "w", encoding="utf-8") as f: |
| f.write("=========================================================\n") |
| f.write(f"🔍 CẤU TRÚC CÂY THƯ MỤC CỦA FILE: {USD_PATH}\n") |
| f.write("=========================================================\n\n") |
| |
| |
| for prim in stage.TraverseAll(): |
| path = str(prim.GetPath()) |
| |
| |
| depth = path.count('/') - 1 |
| indent = " " * depth |
| |
| name = prim.GetName() |
| prim_type = prim.GetTypeName() |
| type_str = f"[{prim_type}]" if prim_type else "[No Type]" |
| |
| |
| f.write(f"{indent}├── {name} {type_str}\n") |
| |
| |
| f.write(f"{indent}│ └─ Path: {path}\n") |
|
|
| f.write("\n=========================================================\n") |
| |
| print("✅ Đã xuất log thành công! Bạn có thể mở file để xem.") |
|
|
| simulation_app.close() |