Find_matching_prim_paths just with a part of the prim_path

Hi everyone,

I have some struggle with the function find_matching_prim_paths

I want to find the prim_path of a prim which contain a specific expression like “Geometry” for example.

I first used the get_parent, get_children functions and try to find the string inside each prim_path recursively and then I found the find_matching function but for now I don’t find how to get it work.

To test it I first past “/World/Geometry” and it work well because it’s the exact expression but as the api doc mention, I understand that we can put a regex expression like " .*Geometry.*" but unfortunately it won’t work well…

Maybe I’m misunderstanding something in the doc or in it’s just not the right way to use it.

Is it something possible with this function or do I have to retry the get_parent, get_child workaround ?

Thanks a lot and have a good day !

Hi @quentin.deyna

Can you please use as an alternative the following snippet, while we investigate more about the implementation?

import re
import omni.isaac.core.utils.stage as stage_utils
import omni.isaac.core.utils.prims as prims_utils

paths = [res.string for prim in stage_utils.traverse_stage() if (res:=re.search(".*Geometry.*", prims_utils.get_prim_path(prim)))]

print(paths)
3 Likes

Hi @toni.nv

Thanks a lot for your help!

Your snippet works really well, it’s exactly what I want.
I encounter an error :

py stderr]: OSError: [Errno 90] Message too long

But it was that the prim it found was too long to be printed and by just accessing the first item with print(paths[0]) it works perfectly.

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