Jump to content

[solved]Filtering string paths by "/"


teddy28

Recommended Posts

Hi there,

 

I am working with alembic files from maya which I want to use as packed rbd inside Houdini. I want to specify some groups in maya to mark as same path attribute so I can pack it by name.

For example I got 2 obj from maya which the hierarchy path is

/aaa/bbb/cc/dShape

/aaa/bbb/ee/fShape

How can I only get the /aaa/bbb/ as the name attribute to make them as one.

 

Or there is other better method for that?

Thank you very much!

Edited by teddy28
solved
Link to comment
Share on other sites

python code / drop it in the text editor 

node = hou.pwd()
geo = node.geometry()

for count in range(2):
    for prim in geo.prims():
        path=prim.attribValue("path")
        newPath=path[:path.rfind("/")]
        prim.setAttribValue("path",newPath) 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...