Accessing a Varriable with Python SOP

   1191   3   1
User Avatar
Member
4 posts
Joined: May 2014
Offline
Hi Everyone,
I'am using a phyton sop for testing simple stuffs. What here I want to solve a simple varible acces which varriable is not in definded in this code but earlier with a AttribCreate SOP. The problem is that the variable is not
accessable by its name.
How can I solve this ?
ThANKs!


– THE CODE –

node = hou.pwd()
geo = node.geometry()

# Add code to modify contents of geo.
# Use drop down menu to select examples.

points = geo.points()

for p in points:
p.setAttribValue( “A”, 1)
User Avatar
Member
1391 posts
Joined: Dec. 2010
Offline
I think your meant is this code :



node = hou.pwd()
geo = node.geometry()




points = geo.points()

# Check if attr dosn't exist , then create it !

if not geo.findPointAttrib(“A”):
geo.addAttrib(hou.attribType.Point , “A” , 0 )




for p in points:
p.setAttribValue( ‘A’, p.number())
www.JKCompany.org
info@JKCompany.org

Rabiee.Sadjad@Gmail.Com
User Avatar
Member
4 posts
Joined: May 2014
Offline
Thanks,
Sorry maybe you missed my point. I wanted to write to an attribute which
is created by a AttribCreate SOP and access that by only its name.
How can i do that ?
G
User Avatar
Member
1391 posts
Joined: Dec. 2010
Offline
But that's work perfectly my friend , you should use setAttribValue expression !

I think your problem is for Attribute type , Integer or Float ?

If your attribute type in the AttribCreate SOP is Integer , So You should use Integer value in the Python Code and same rule for float.

Check attached project please :wink:

Attachments:
JKPythonSOP.zip (13.9 KB)

www.JKCompany.org
info@JKCompany.org

Rabiee.Sadjad@Gmail.Com
  • Quick Links