How to transform GUI action into python scripting format

Isaac Sim Version

4.2.0

Operating System

Windows 11

GPU Information

  • Model: RTX 4080 Laptop

Topic Description

Detailed Description

How to transform the following action operate on GUI into python scripting format?
As shown in figure,

  1. I first create a Torus, click on torus and Add-> Physics → Particle Sampler
  2. Click on ParticleSystem and Add-> Physics → Particle Isosurface

@chinningchen not sure if this will be useful, but below is a snippet in 4.5.0 comprised of several kit commands that can achieve those GUI actions:

from pxr import Usd, UsdGeom, UsdPhysics, Sdf, PhysxSchema
import omni, omni.usd, omni.kit.commands

stage = omni.usd.get_context().get_stage()

# create a torus in stage
omni.kit.commands.execute('CreateMeshPrimWithDefaultXform',
	prim_type='Torus',
	prim_path=None)

# get the torus prim
prim = stage.GetPrimAtPath('/World/Torus')

# apply particle sampling API
omni.kit.commands.execute('AddPhysicsComponent',
	usd_prim=prim,
	component='PhysxParticleSamplingAPI')

# get the particle system prim
particleSystem = stage.GetPrimAtPath('/World/ParticleSystem')

# apply particle isosurface API
omni.kit.commands.execute('AddPhysicsComponent',
	usd_prim=particleSystem,
	component='PhysxParticleIsosurfaceAPI')

feel free to test it out (i think it should still work in 4.2.0)

and just fyi, Isaac Sim 4.2.0 is reaching EOL, so it might be a good idea to grab 5.0 preview from the github repo (GitHub - isaac-sim/IsaacSim: NVIDIA Isaac Sim™ is an open-source application on NVIDIA Omniverse for developing, simulating, and testing AI-driven robots in realistic virtual environments.) with binary package coming soon, iirc.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.