samfisher

samfisher

About Me

Connect

LOCATION
Not Specified
ウェブサイト

Houdini Engine

Availability

Not Specified

Recent Forum Posts

Get point indices in prims with Python 2016年3月9日16:46

Hi,
I am trying to access the point indices prims are made up of in Python.

Currently I am doing this with:

for k in geo.prims():
MyCurrentFace = k
NumVertsCurrentFace = MyCurrentFace.numVertices()

for Verts in MyCurrentFace.vertices():
VertsCurrentFace = Verts.point().number()
print VertsCurrentFace




It works but it is relatively slow.
In another thread where I asked how to access point positions I was told that it would be very fast with using:

hou.Geometry.pointFloatAttribValues(geo,“P”)

That worked very fast.
So my question is, is it possible to get the point indices of individual faces in a similar way?

I have so far tried to create relevant Attributs with nodes such as the attribcreate node, but I wasn´t sucessful.
I did some other tests and manged to create Attributes such as Normals and similar things with nodes which I was then able to access with Python. But I have so far not managed to create Attributes for point index per prim.

Getting locations of points with Python is slow 2016年3月8日17:02

Thank you, this is a lot faster.

I am interested in pointFloatAttribValues. How do I find out which other Attributes besides “P” I can use in pointFloatAttribValues?
I checked in the manual but I can not find a list of Attributes. Hadn´t you told me I would never have known that “P” works. How would one find that out?

Getting locations of points with Python is slow 2016年3月8日14:44

Hi,

I am trying to collect the locations off all points in a mesh with python. Currently I am doing that with the following line:

MyNumPoints = len(MyNode.geometry().points())

for i in range(MyNumPoints):
hou.node.geometry().points().position()


The script gets exremely slow on meshes that have around 1000 points or more.
Is there a better way to access point positions via Python?

Or is it perhaps better to use hscript or VEX for something like that?