Apply semantics to object child

I have a xform that consist of two different meshes (Pallet + Cardbox).
image

Importing it by

rep_pallet_group = rep.create.from_usd(pallet_usd, semantics=[('class', 'target_pallet')], count=count)

will apply the semantics to both. But I only want to apply semantics to the Pallet, not the Cardbox.

I found this tutorial: Semantic Schema Editor — Omniverse Robotics documentation
but I am using a python script.

How can this be solved using python? Thanks in advance.

You can achieve that with rep.get.xform described here: PYTHON API — omni_replicator 1.10.10 documentation

After you get the xform you want to apply the semantics to, you then rep.modify.semantics on it.

1 Like

You would apply semantics to it after creating it instead of at creation time.

rep_pallet_group = rep.create.from_usd(pallet_usd,  count=count)

pallet_prims = rep.get.xform(path_pattern='Pallet_B1$')  # Uses regular expression matching
with pallet_prims:
  rep.modify.semantics(semantics=[('class', 'target_pallet')])
1 Like

Thanks, I used your provided solution, but then I receive following assertion:

Replicator/SDGPipeline/OgnWriteSemantics: [/Replicator/SDGPipeline] Assertion raised in compute -
Error in ‘pxrInternal_v0_22__pxrReserved__::UsdStage::_SetValueImpl’ at line 6174 in file /buildAgent/work/ac88d7d902b57417/USD/pxr/usd/usd/stage.cpp : ‘Empty typeName for </Replicator/Ref_Xform/Ref/pallet_B1_Cbox_A1.semantic:class_target_pallet:params:semanticType>’

We sometimes see that error when trying to apply semantics to a large number of prims.

It’s a somewhat known error, but it has been difficult to reproduce for us.

Which version of Replicator are you seeing this error message in? It is possible we have a workaround in the latest version

I reduced the number of prims to 1 and still get the same error.

I am using Version 2023.1.1. with omni.replicator.core-1.10.20+105.1.lx64.r.cp310. Let me know about the workaround and I am going to test it.

Is there any news regarding the workaround I can test?

Can you try Replicator 1.11.+ (available in Isaac 4.+)

Hey Dennis,

I updated according to your suggestion and can confirm the issue is gone now. Thanks for your help.

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