|
|
|
|
| View previous topic :: View next topic |
| Author |
Message |
sdugaro Houdini Expert

Joined: 30 Jun 2003 Posts: 287 Location: VanCity

|
Posted: Wed Apr 11, 2012 7:44 pm GMT Post subject: hom volume primitive name |
|
|
Hi there, trying to find a way to parse volume primitives by name,
so i can infer the index of the primitive i want (in particular rest)
MMB on my incoming volume i see:
| Quote: |
Volume Resolutions:
0 (density) : [53, 98, 53] Voxel Count: 275,282
1 (vel.x) : [54, 98, 53] Voxel Count: 280,476
2 (vel.y) : [53, 99, 53] Voxel Count: 278,091
3 (vel.z) : [53, 98, 54] Voxel Count: 280,476
4 (rest.x) : [53, 98, 53] Voxel Count: 275,282
5 (rest.y) : [53, 98, 53] Voxel Count: 275,282
6 (rest.z) : [53, 98, 53] Voxel Count: 275,282
7 (rest2.x) : [53, 98, 53] Voxel Count: 275,282
8 (rest2.y) : [53, 98, 53] Voxel Count: 275,282
9 (rest2.z) : [53, 98, 53] Voxel Count: 275,282
|
And i want to get the index of the prims that start with the
name rest. Can anyone point me in the right direction?
cheers.
| Code: |
>>> n = hou.node('/obj/GET/vol_Noise/VOL_IN')
>>> g = n.geometry()
>>> prims = g.prims()
>>> p4 = prims[4]
>>> p4.type()
primType.Volume
>>> p4.number()
>>> 4
|
|
|
| Back to top |
|
 |
sdugaro Houdini Expert

Joined: 30 Jun 2003 Posts: 287 Location: VanCity

|
Posted: Wed Apr 11, 2012 7:57 pm GMT Post subject: |
|
|
ah, primitive attribute lookup:
| Code: |
>>> pattrs = g.primAttribs()
>>> pattrs
(<hou.Attrib Prim 'maximum' (1 Float) of geometry in /obj/GET/vol_Noise/VOL_IN>, <hou.Attrib Prim 'minimum' (1 Flo
at) of geometry in /obj/GET/vol_Noise/VOL_IN>, <hou.Attrib Prim 'dopobject' (1 String) of geometry in /obj/GET/vol
_Noise/VOL_IN>, <hou.Attrib Prim 'name' (1 String) of geometry in /obj/GET/vol_Noise/VOL_IN>)
>>> pattrs[-1].strings()
('density', 'vel.x', 'vel.y', 'vel.z', 'rest.x', 'rest.y', 'rest.z', 'rest2.x', 'rest2.y', 'rest2.z')
|
Afterwhich its straightforward to infer the primitive index from the name. |
|
| Back to top |
|
 |
bhaveshpandey Houdini Adept

Joined: 23 Nov 2008 Posts: 103 Location: London

|
Posted: Thu Apr 12, 2012 4:56 am GMT Post subject: |
|
|
you can use listbyvals expression.
from help:
| Quote: | string listbyvals (string surface_node, float class, string attribute, string id)
Returns a list of elements with a given value for a string attribute.
The <class> can be one of D_VERTEX, D_POINT, D_PRIMITIVE, or D_DETAIL
for the corresponding attribute class.
EXAMPLES
listbyvals("/obj/geo1/facet1", D_PRIMITIVE, "name", "piece1")
Returns a list of primitives with a value of piece1 for the name
attribute in the facet1 surface node in geo1. |
_________________ Bhavesh Pandey.
www.bhaveshpandey.com |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|
|
|
|