How do I Clone the selected prop?

I have this code to get the selected prop(s).

    def decorate_on_click():

        ctx = omni.usd.get_context()
        # returns a list of prim path strings
        selection = ctx.get_selection().get_selected_prim_paths()

        if selection is not None:

Not sure what to do with selection.

Thanks

Hi @DataJuggler. We have the CopyPrims command for that. You can review the command in the Commands window after using Edit->Duplicate.

import omni.kit.commands

omni.kit.commands.execute('CopyPrims',
	paths_from=['/World/Cube'],
	duplicate_layers=False,
	combine_layers=False,
	flatten_references=False)

Thank you. When I get off work, I will try this.

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