Accessing value in ordered menu
1841
6
2
regart
Member
5 posts
Joined: 12月 2013
オフライン
2024年8月6日 9:41
Hi, I guess I have a very simple question, since i am very new to python.
On a wrangle I created an ordered menu.
the Menu Python Script looks like that:
node = kwargs . get ( 'node' )
names = []
geo = node . geometry ()
wall_IDs = geo . stringListAttribValue ( "wall_ids" )
for id in wall_IDs :
names . append ( id )
names . append ( id )
return names
I read from a detail string array called "wall_ids" and the menu gets created as expected. All items from the string array appear in the drop down menu.
But when I try to simply access the chosen string value from the created parm with something like :
I get a -1 as a value instead of the actual string value.
Could somebody help me out here?
regart
Member
5 posts
Joined: 12月 2013
オフライン
2024年8月13日 3:08
Does anyone have an idea why the access to the string value does not work?
animatrix_
Member
5089 posts
Joined: 2月 2012
オフライン
2024年8月13日 5:11
Hi,
Could be how you are accessing the current node. I would just do it like this:
node = hou . pwd ()
geo = node . geometry ()
ASquirrel
Member
312 posts
Joined: 3月 2023
オフライン
2024年8月13日 6:36
make sure you wall_id attribute don't already exist as a different type, the fact you say your value is '-1' tell me that this attribute already exist in your network, since a badly configured chs() should simply return an empty string.
Head of Pipeline @ LightVFX
vikus
Member
247 posts
Joined: 5月 2017
オフライン
2024年8月13日 7:36
regart I get a -1 as a value instead of the actual string value.Not sure but it could be a bug. I remember facing the same issue some time ago since then I use string parms as menus to pass string values.
regart
Member
5 posts
Joined: 12月 2013
オフライン
2024年8月13日 7:43
Thanks for your replies!
I tried
instead of
node = kwargs . get ( 'node' )
this didn't seem to change anything. The dropdown menu works, just like before. Meaning the string values from the array are listed as expected.
Also I made sure the the attribute didn't exist in the first place.
But still, when I try to access the parm with vex from the wrangle, I get a -1 as a result.
regart
Member
5 posts
Joined: 12月 2013
オフライン
2024年8月13日 7:52
viklc regart I get a -1 as a value instead of the actual string value. Not sure but it could be a bug. I remember facing the same issue some time ago since then I use string parms as menus to pass string values.Thank you! By using string parms, it works!