All I did was create two cubes and create a material, copy the commands into my extension.
Created a new project, clicked the button, and scene stayed blank.
Here is the code:
PixelToMesh.py (2.8 KB)
The error happens on this line:
omni.kit.commands.execute(‘AddGroundPlaneCommand’,
stage=Usd.Stage.Open(rootLayer=Sdf.Find(‘anon:0000014AF6CD0760:World0.usd’), sessionLayer=Sdf.Find(‘anon:0000014AF6CD0B20:World0-session.usda’)),
planePath=‘/GroundPlane’,
axis=‘Y’,
size=2500.0,
position=Gf.Vec3f(0.0, 0.0, 0.0),
color=Gf.Vec3f(0.5, 0.5, 0.5))
Am I missing an import statement for sdf?
Hi,
It seems the command is referencing an invalid rootLayer
and sessionLayer
.
Because you opened a new project, the references changed.
Try passing the stage as shown below…
By the way, for Sdf the import statement is from pxr import Sdf
import omni.kit.commands
from pxr import Usd, Gf, Sdf
stage = omni.usd.get_context().get_stage()
omni.kit.commands.execute('AddGroundPlaneCommand',
# stage=Usd.Stage.Open(rootLayer=Sdf.Find('anon:0000014AF6CD0760:World0.usd'), sessionLayer=Sdf.Find('anon:0000014AF6CD0B20:World0-session.usda')),
stage=stage,
planePath='/GroundPlane',
axis='Y',
size=2500.0,
position=Gf.Vec3f(0.0, 0.0, 0.0),
color=Gf.Vec3f(0.5, 0.5, 0.5))
1 Like
Thank you. When I get off work I will try this.
system
Closed
September 1, 2022, 10:49am
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.