| """ |
| Script to create Arnold_rigid.usd with proper RigidBody API |
| Run this in Isaac Sim's Script Editor (Window > Script Editor) |
| |
| Instructions: |
| 1. Open Isaac Sim |
| 2. Window > Script Editor |
| 3. Copy and paste this entire script |
| 4. Click "Run" button |
| """ |
|
|
| from pxr import Usd, UsdGeom, UsdPhysics |
|
|
| |
| arnold_usd = "/home/hcl4070-1/Desktop/taowen/projects/isaaclab_twist2_g1/assets/sofas/Arnold.usd" |
| output_usd = "/home/hcl4070-1/Desktop/taowen/projects/isaaclab_twist2_g1/assets/sofas/Arnold_rigid.usd" |
|
|
| |
| stage = Usd.Stage.CreateNew(output_usd) |
|
|
| |
| UsdGeom.SetStageUpAxis(stage, UsdGeom.Tokens.z) |
| UsdGeom.SetStageMetersPerUnit(stage, 0.01) |
|
|
| |
| arnold_xform = UsdGeom.Xform.Define(stage, "/Arnold") |
| arnold_prim = arnold_xform.GetPrim() |
|
|
| |
| stage.SetDefaultPrim(arnold_prim) |
|
|
| |
| arnold_prim.GetReferences().AddReference("./Arnold.usd") |
|
|
| |
| rigid_body_api = UsdPhysics.RigidBodyAPI.Apply(arnold_prim) |
| rigid_body_api.CreateRigidBodyEnabledAttr().Set(True) |
| rigid_body_api.CreateKinematicEnabledAttr().Set(True) |
|
|
| |
| collision_api = UsdPhysics.CollisionAPI.Apply(arnold_prim) |
|
|
| print(f"✓ Created {output_usd}") |
| print(f"✓ Root prim: {stage.GetDefaultPrim().GetPath()}") |
| print(f"✓ Applied APIs: {arnold_prim.GetAppliedSchemas()}") |
|
|
| |
| stage.GetRootLayer().Save() |
| print("✓ File saved successfully!") |
| print("\nNow you can use this USD file with RigidObjectCfg in Isaac Lab") |
|
|