Prefix path Python

   2029   3   1
User Avatar
Member
27 posts
Joined: June 2016
Offline
Hey guys,

trying to add a prefix to my current path with a python sop.

for p in geo.prims():
path = p.attribValue(“path”)
p.setAttribValue(“path”,“/something/originalpath”)

that sets the value fine but I need to concatenate the existing path and not sure how to do that?

Thanks!
User Avatar
Member
27 posts
Joined: June 2016
Offline
have it working in vex…

s@temp = @path;

s@path = concat(“_”, s@temp);
User Avatar
Member
402 posts
Joined: June 2014
Offline
Strings in python are sequences of characters so you can concatenate them like lists or tuples, see python docs [docs.python.org]:
for p in geo.prims():
    orig_path = p.attribValue("path")
    new_path = "prefix_" + orig_path
    p.setAttribValue("path", new_path)
Henry Dean
User Avatar
Member
27 posts
Joined: June 2016
Offline
Awesome! Thanks
  • Quick Links