using string to name an attribute? SOLVED

   2115   3   0
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Hi!

I made a string variable that allow me to choose a name in the channel.

string myAttName = chs("my_attribute_name");

How can I use that string to decide the name of another attribute?

-Olivier
Edited by olivierth - Aug. 20, 2020 15:09:34
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
hello this might help you and it should be an interesting reading regarding performance
https://www.sidefx.com/forum/topic/68088/ [www.sidefx.com]
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Ah! Found a way.

I used the setpointattrib fonction:

string myAttName = chs("my_attribute_name");
setpointattrib(0, myAttName, @ptnum, @Cd.r, "set");
Edited by olivierth - Aug. 20, 2020 15:12:03

Attachments:
Houdini_use_string_to_set_attrib_name.JPG (46.3 KB)

User Avatar
Member
7762 posts
Joined: Sept. 2011
Online
olivierth
Ah! Found a way.

I used the setpointattrib fonction:

string myAttName = chs("my_attribute_name");
setpointattrib(0, myAttName, @ptnum, @Cd.r, "set");

A better way is to use the bindings tab.
Leave the code as:

@myattrib = @Cd.r;

And then in the bindings tab, add a binding from myattrib to your attribute name. One is the vex name the other is the attribute name. That way you can change the attribute name, or even put nothing!, to change the name of the attribute created.
  • Quick Links