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!
How to convert detail attributes into a wall of text
4406 3 2- tutumannyaque
- Member
- 10 posts
- Joined: 3月 2016
- Offline
- anon_user_40689665
- Member
- 648 posts
- Joined: 7月 2005
- Offline
- toadstorm
- Member
- 377 posts
- Joined: 4月 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:
Python's string format function is great, you can do a lot with it beyond just simple substitution.
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]
- tutumannyaque
- Member
- 10 posts
- Joined: 3月 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