Group filter expression(python) attribcreate problem

   3982   5   2
User Avatar
Member
5 posts
Joined: Oct. 2008
Offline
Hi All,

I'm a beginner with Houdini and have been following some excellent peter quint Houdini tutorials. In one he uses an added variable to drive the group filter expression. I've converted the hscript to python but am having problems accessing the newly created “myvar”. The code

if hou.lvar(“TZ”) <= 0.0:
return 1
else:
return 0

works fine, but

if hou.lvar(“myvar”) <= 0.0:
return 1
else:
return 0

does not (“myvar” being an attribute added to the object using the attribcreate node).

Thanks in advance for any suggestions.


:?

Attachments:
FilterExpressionProblem.hipnc (54.6 KB)

User Avatar
Member
818 posts
Joined: Sept. 2013
Offline
The attribute is named “myvar”, but the variable is actually named MYVAR. The default local variable name created by attribcreate is the uppercase of the attribute name. You can also see the variable name under Geometry Spreadsheet.

Attachments:
geometry_spreadsheet.jpg (21.0 KB)

Andrew / アンドリュー
User Avatar
Member
5 posts
Joined: Oct. 2008
Offline
Thanks for the reply awong. I'm very sorry but I still ‘don’t get it' ops: . I've tried renaming the var to MYVAR and still no luck. I'm also unable to locate the Detail/Varmap sheet that displays the variable name change.

I've attached a screenshot, hope this helps.

Attachments:
FilterExpressionError2.jpg (1.1 MB)

User Avatar
Member
818 posts
Joined: Sept. 2013
Offline
Since the “group1” node is in an error state, you need to select the previous node to see the attributes. Hm, but I'm not sure why MYVAR didn't work for you. Try the attached scene file.

Attachments:
filterexpressionproblem.2.hipnc (52.7 KB)

Andrew / アンドリュー
User Avatar
Member
5 posts
Joined: Oct. 2008
Offline
Hi, I checked your file and it does work, although the Detail/Var in the geometry spread sheet have changed places……but, it still does not work in the original file. I also started a fresh scene and just created a basic sphere and attribcreate and I'm having the same problem. I've attached a ‘about Houdini info file’ for your refrence.

Thanks for your advice and patience

Attachments:
Houdini_Info.txt (13.3 KB)
FilterExpressionError3.jpg (2.1 MB)

User Avatar
Member
818 posts
Joined: Sept. 2013
Offline
Ah, I should have realized you were using Houdini 15. In Houdini 15.0, the attribcreate SOP no longer create the local variable by default(because we want to favor the @attrname syntax). So you'd need to manually create it if you want to use local variable. This can be done by simply checking the “Local Variable” checkbox.

Attachments:
attribcreate.jpg (64.3 KB)

Andrew / アンドリュー
  • Quick Links