Case #3: Search Asset Database with USD Search and Write Python with USD Code API#
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 API makes it possible for the developer to ask an API to find the desired assets. USD Code API 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.
Learn more about USD Search API.
Steps#
Enable the Sample Browser by navigating to Window>Browsers>Examples.
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.
Open the USD Code API extension. Click
New Chat
and selectUSD Search
from the node dropdown.Enter the prompt
Large Storage Racks
in the prompt window. Press theExecute Code
icon.Click and drag one of the result assets to add it to your scene.
View the asset in your scene to determine if it is a good fit.
Right click the payload in the stage panel and select
Copy Prim Path
.Open the USD Code API extension, click
New Chat
, and selectUSD Code Interactive
from the node dropdown.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 theExecute Code
icon. Try various methods for duplicating the prim. For example, with the prim selected you can prompt:duplicate the selected prim 3 times...
.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).
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.