Stefano Nicolis
SteN
About Me
EXPERTISE
Hobbyist
INDUSTRY
Film/TV
Connect
LOCATION
Not Specified
WEBSITE
Houdini Skills
Availability
Not Specified
Recent Forum Posts
Why are values inaccurate in Houdini? April 18, 2017, 9:47 a.m.
benCNever, never do that, never try to compare two float to see if they are equal: it will never work.
I was just using an “if” statement to check if the value was exactly equals to “0.7382” but it returns nothing.
I had the same problem (see here [sidefx.com]) and what you have to do instead is compare a value (the value you are looking for) to a range, with your example you can write the following code:
if(value > 0.73 && value < 0.74) { //Do stuff }
Or also:
float _tolerance = 0.01; if( (value - 0.7834) <= _tolerance) { //Do stuff }
So basically to get that to work you dont check if the two values are equal, but if the two values are more or less close
String comparison in Hscript April 16, 2017, 1:12 p.m.
tamteThanks!
you have to use strcmp(){ if(strcmp(chs("../random_node/geotype"), "poly")==0) { return 1; } }
and not sure but the values you are refering here (“none”) or in your file (“primitive”) are not valid for group geotype parm, so it would never switch to one anyway
the valid values are:
'all', ‘bezierc’, ‘bezier’, ‘mesh’, ‘circle’, ‘MetaSQuad’, ‘meta’, ‘nurbc’, ‘nurb’, ‘PackedAgent’, ‘AlembicRef’, ‘PackedDisk’, ‘PackedFragment’, ‘PackedGeometry’, ‘part’, ‘PasteSurf’, ‘poly’, ‘polysoup’, ‘sphere’, ‘tetrahedron’, ‘trifan’, ‘tristrip’, ‘tribez’, ‘tube’, ‘vdb’, ‘volume’
I didnt know the strcmp() function, now it works.
That chs(“../random_node/geotype”) I just used it as an example, the real channel is referring to an ordered menu wich contains a “none” option in it
String comparison in Hscript April 15, 2017, 5:02 p.m.
edward
Theexpression returns a float, not a string. For strings, you needch()(note the s after ch).chs()
Yea I forgot to mention: it doesnt work even with the chs() function.
Here's an example file.
(Im still working in H15.5)