How to convert detail attributes into a wall of text

   4053   3   2
User Avatar
Member
10 posts
Joined: March 2016
Offline
Hi! I'm building my pergola and designing it beforehand in Houdini of course.
I'm having a little trouble converting all my detail attributes into a wall of text into a font node like so:

From this:

To this:



For now I've typed all the text by hand just to take a screenshot by I would like it to be done automotically.
Any ideas?
Thanks so much!
User Avatar
Member
648 posts
Joined: July 2005
Offline
Try details(), however in this case its more typing than direct data-entry into the font sop.

If there's heaps of items you can parse a csv to point attributes, format the table as a detail string, then read the whole thing into font in one hit.

Attachments:
details.zip (15.2 KB)

User Avatar
Member
359 posts
Joined: April 2017
Offline
This isn't too bad with a little Python. You'll have more flexibility formatting your strings and such with Python over HScript.

Assuming your detail attributes already exist on some node, you just have to create an expression on the Text attribute of your Font SOP, then right-click and change the expression language to Python. Then try this code:

node = hou.node("../attribwrangle1") # this should point to the node with the detail attrs
geo = node.geometry()

detail_attrs = geo.globalAttribs()
output = ""
if detail_attrs:
    for attr in sorted(detail_attrs, key=lambda x: x.name()):
        value = geo.attribValue(attr)
        out = "{} = {}".format(attr.name(), value)
        output = output + out + "\n"

return output

Python's string format function is great, you can do a lot with it beyond just simple substitution.
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
User Avatar
Member
10 posts
Joined: March 2016
Offline
toadstorm
This isn't too bad with a little Python. You'll have more flexibility formatting your strings and such with Python over HScript.

Assuming your detail attributes already exist on some node, you just have to create an expression on the Text attribute of your Font SOP, then right-click and change the expression language to Python. Then try this code:

node = hou.node("../attribwrangle1") # this should point to the node with the detail attrs
geo = node.geometry()

detail_attrs = geo.globalAttribs()
output = ""
if detail_attrs:
    for attr in sorted(detail_attrs, key=lambda x: x.name()):
        value = geo.attribValue(attr)
        out = "{} = {}".format(attr.name(), value)
        output = output + out + "\n"

return output

Python's string format function is great, you can do a lot with it beyond just simple substitution.


Omg this works perfectly thank you so much!
  • Quick Links