Houdini select first bit of path attribute

   168   1   0
User Avatar
Member
1 posts
Joined: May 2024
Offline
Hi!

I have some geometry with a path primitive attribute. I want to delete this whole attribute, except the bit after the first /.

For example:


path = /Ex_car/SOSm:DLP/SOSm:DLP_chr/SOSm:DLP_chrShape

//Let's say I want to create a new attribute

new_path = /Ex_car


The length of the path can be different each time and ideally I'd like do this in a primitive wrangle.

I found some ways to isolate the last part of the path. But for some I can't seem to find a way to isolate the first part.


I'm fairly new to Houdini, so my question might be stupid
Edited by telrich - May 9, 2024 10:56:24
User Avatar
Member
7816 posts
Joined: Sept. 2011
Offline
Use the split function:
https://www.sidefx.com/docs/houdini/vex/functions/split.html [www.sidefx.com]

string parts[] = split(path, '/');
string newpath = '/' + join(parts[:1], '/');
  • Quick Links