I am trying to do some of your samples from documentation - What is sc?

Your example Omni UI Scene Documentation has this:

What is sc? sc is undefined or something to that extent.

I am missing an import statement again? Sample docs for beginners of this API would be better off with everything defined.

scene_view = sc.SceneView(
aspect_ratio_policy=sc.AspectRatioPolicy.PRESERVE_ASPECT_FIT,
height=200
)

with scene_view.scene:
sc.Line([-0.5,-0.5,0], [-0.5, 0.5, 0], color=cl.red)
sc.Line([-0.5,-0.5,0], [0.5, -0.5, 0], color=cl.green)
sc.Arc(0.5, color=cl.documentation_nvidia)

Hi @DataJuggler. Yes, the missing import is:

from omni.ui import scene as sc

Thank you. Just a suggestion, if you update the page it might help the next person not ask.

I wish I wasn’t trying to learn all this with 24 hours till contest end!

Yes. I’ve created OM-60348 to update the docs.

I got one step further. Now I get this:

2022-08-18 17:36:28 [Error] [omni.ui.python] NameError: name ‘cl’ is not defined

cl? Is there some place I can look these up so I don’t have to bother you?

This has something to do with color. cl.green, cl.red, etc.

Thanks

To solve the cl issue:

from omni.ui import color as cl

To find this, I searched all the Python files installed with Omniverse and I found an example list.

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