How to use Semantics Utils in Isaacsim

i try to use
add_update_semantics(prim: pxr.Usd.Prim
, semantic_label: str
, type_label: str = ‘class’
, suffix=‘’ ) → None

for update label already usd in sceen

semantics.add_update_semantics(prim=f"/hospital/SM_WheelChair_01a2.usd",
sematic_lavel=“Chair”,)

it’s not working could anyone help me please.

Hi there,

it seems you are trying to add the semantic data directly to the usd file. You should however use the prim loaded in your stage.

Here is a snippet that might help:

from pxr import Semantics
from omni.isaac.core.utils.semantics import add_update_semantics

stage = omni.usd.get_context().get_stage()
prim = stage.DefinePrim("/MyCube", "Cube")
add_update_semantics(prim, "cube")

semantic_api = Semantics.SemanticsAPI.Get(prim, "Semantics")
type_attr = semantic_api.GetSemanticTypeAttr()
data_attr = semantic_api.GetSemanticDataAttr()

print(f"semantic type: {type_attr.Get()}, semantic data: {data_attr.Get()}")
2 Likes

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