Saori Yoshimoto work notes since 2018

Wednesday, June 26, 2024

[Python]Fill in the code in wangle by python

node = hou.selectedNodes()[0]
geo = node.geometry()

--------------------------
--sample1).
code = '''@N = @N;
@v = @N;
@Cd=0;
@Cd = set( @P.y,0,0 );'''

-sample2).
codelist = []
codelist.append('s@name = "%s";' % (geo.name()))

-sample3).
g = "test"
r = "test2"
codelist = []
codelist.append('%s,%s' % (g,r))
code = '\n'.join(codelist)       
--------------------------

wrangle = geo.createNode('attribwrangle')
wrangle.parm('snippet').set(code)


Reference:

  • Fill in the code in wangle by python

https://www.sidefx.com/forum/topic/73330/?page=1#post-309997

  • String handling in python 
https://qiita.com/hiroyuki_mrp/items/1504645ab6eb1a6a4103

No comments:

Post a Comment