name Method in hou.Attrib: how to extract name only?

   1524   2   0
User Avatar
Member
43 posts
Joined: Sept. 2010
Offline
Hi folks,

I try to get the name of point Attributes via Python.
I tried it with the “name” Method of the “hou.Attrib” class.

The Problem: I don´t only the name, I get some extra information, I don´t want to have.

For Example: I want the name ‘P’ and I get this:
<bound method Attrib.name of <hou.Attrib Point ‘P’ (3 Floats) of geometry in /obj/geo1/blabla_1>>

Do somebody know what to do? Would be nice!


Greetings Gerd

________________________

PS:
Code looks like this:


node = hou.node('/obj/geo1/blabla_1')

for attrib in node.geometry().pointAttribs():
print(attrib.name) #with a tab before the print() of course
User Avatar
Member
387 posts
Joined: Nov. 2008
Offline
You get method as return value, if you want return value of this method call it with brackets: attrib.name()


import hou
node = hou.node('/obj/geo1/color1')

for attrib in node.geometry().pointAttribs():
print(attrib.name())
User Avatar
Member
43 posts
Joined: Sept. 2010
Offline
Cool - thank you. It works now!
That was the problem. Very general I think … good to know!!!

Greetings Gerd!
  • Quick Links