Case #3: Search Asset Database with USD Search and Write Python with USD Code NIM#

Scenario#

While setting up a new facility digital twin to train robotic systems, a developer must find and place many different objects which exist in the real facility. USD Search NIM makes it possible for the developer to ask an API to find the desired assets. USD Code NIM can help the developer write some of the python faster to modify the USD stage. In this example, we will develop a simple utility to find and place large storage racks in an open space leveraging both NIMs.

Steps#

  1. Enable the Sample Browser by navigating to Window>Browsers>Examples.

  2. In the Examples folder, double-click Warehouse to open it.

    Note

    Opening the stage will download assets and shaders. It may take a moment to load.

    ../_images/warehouse.png
  3. Open the USD Code NIM extension. Click New Chat and select USD Search from the node dropdown.

  4. Enter the prompt Large Storage Racks in the prompt window. Press the Execute Code icon.

    ../_images/case3_3.png
  5. Click and drag one of the result assets to add it to your scene.

    ../_images/case3_4.png
  6. View the asset in your scene to determine if it is a good fit.

    ../_images/case3_5.png
  7. Right click the payload in the stage panel and select Copy Prim Path.

    ../_images/case3_6.png
  8. Open the USD Code NIM extension, click New Chat, and select USD Code Interactive from the node dropdown.

    ../_images/new-chat.png
  9. Prompt USD Code Interactive with the following: duplicate the prim <copied prim name> 3 times and offset them 2m on the x axis starting from the prim's position. Click the Execute Code icon. Try various methods for duplicating the prim. For example with the prim selected you can prompt: duplicate the selected prim 3 times....

    ../_images/case3_8.png

Note

If the selected assets are coming in at the wrong scale, feel free to fix the scale in a prompt or manually scale them (.01,.01,.01).

  1. You’ve successfully added your shelves to your scene and placed them in the environment! You can utilize the same method with different assets to populate the rest of your warehouse.