Jump to content

Creating groups based on string attributes


Recommended Posts

Hey guys, I've hit a bit of a wall on how to best approach this. I have multiple items with "objName" attributes - These are prefixed with the name I want to break out and group by. IE:

objName:

CarA_hood

CarA_roof

CarA_left_mirror

CarB_windshield

CarB_left_rear_tire

CarC_hood

CarC_left_rear_tire

Using this attribute I wish to make groups: CarA, CarB, CarC. Is there an easy way to do this? I thought I might have luck in VOPS with a string split and pop node, but no dice. I've also tried doing it in a wrangle/python but I'm hitting a wall with the syntax.

 

 

 

Link to comment
Share on other sites

Thanks a ton!!!! Your wrangle code shows me exactly where I was messing up. I was trying to dump the output of the split directly into an attribute instead of keeping it a variable (as in your example). Exactly what I was looking for, thank you!

 

//s@x[] = split(s@title, "_"); <-- What I was doing wrong

 

string x[] = split(s@title, "_"); //Correct
setpointgroup(0, x[0], @ptnum, 1, "set"); //Awesome

s@item = x[0]; //Drop it into a point attr for good measure

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...