Jump to content

Python volume from string


papsphilip

Recommended Posts

I am trying to use the setAllVoxelsFromString() command but its not working.

Can someone provide an example? what does the string need to look like?

i want to fill a vector volume with values i have from a fga file. First 9 values are for volume size and bounds. The rest is the values

 

import hou
node = hou.pwd()
geo = node.geometry()


file = node.parm('file').eval()

with open(file, 'r') as f:
    data = f.read().split(',')
    volumesize = (data[0],data[1],data[2])
    bboxmin = (data[3],data[4],data[5])
    bboxmax = (data[6],data[7],data[8])
    
    data = data[9:]
    datastr = ' '.join([str(elem) for elem in data])
    
volume = geo.prims()[0]
volume.setAllVoxelsFromString(datastr)

 

Vel_field_0000.fga

fga_importer.hip

Edited by papsphilip
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...