stassius

Houdini_read_text_file

Oct 28th, 2017
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. import os
  2. import hou
  3. node = hou.pwd()
  4. geo = node.geometry()
  5.  
  6. # Add code to modify contents of geo.
  7. # Use drop down menu to select examples.
  8. fileParm = node.parm("txt").evalAsString()
  9. attrName = node.parm("attr").evalAsString()
  10. with open(fileParm, 'r') as f:
  11.     lines = f.read().splitlines()   # Read lines
  12. f.close()
  13. Attrib = geo.addAttrib(hou.attribType.Point, attrName, "")
  14. for line in lines:
  15.     pt=geo.createPoint()  
  16.     pt.setAttribValue(Attrib, line)
Advertisement
Add Comment
Please, Sign In to add comment