Hello! I am attempting to write a custom data writer using python, but I have run into an interesting problem
the larger the mesh, the longer each query to a mesh can take, so I am trying to reduce my queries and do everything in memory
my question: is there a way to query all of a node's geo data and attributes in a single query?
or do I have the “fastest” option currently where I pre-allocate my list and then query each attribute in a for loop
numberOfPoints = len(objG.points()) + 1
vertPos = *numberOfPoints
uvPos = *numberOfPoints
vertColor = *numberOfPoints
for point in objG.points():
pointNumber = point.number()
vertPos = point.position()
uvPos = point.attribValue('uv')
vertColor = point.attribValue('Cd')
geometry get all attributes in one query (Python Module)
6547 4 2-
- MikePaixao
- Member
- 36 posts
- Joined: Sept. 2014
- Offline
-
- pelos
- Member
- 624 posts
- Joined: Aug. 2008
- Offline
-
- MikePaixao
- Member
- 36 posts
- Joined: Sept. 2014
- Offline
-
- graham
- Member
- 1926 posts
- Joined: Nov. 2006
- Offline
You should also take a look at hou.Geometry.pointFloatAttribValues(). This function will return a single list of all the values for all the points on your geometry in a very fast manner.
vertPos = objG.pointFloatAttribValues(“P”)
This however returns a flat list instead of a list of 3 sized tuples. You can use the numpy module to reshape that list (which I think there should be examples of in the help for that function, or one similar to it).
vertPos = objG.pointFloatAttribValues(“P”)
This however returns a flat list instead of a list of 3 sized tuples. You can use the numpy module to reshape that list (which I think there should be examples of in the help for that function, or one similar to it).
Graham Thompson, Technical Artist @ Rockstar Games
-
- MikePaixao
- Member
- 36 posts
- Joined: Sept. 2014
- Offline
Thanks! this was exactly what I was looking for!
and I will also add in-case anyone else ever has a similar question to mine
I then got stuck on how to query the points.numbers() to a primitive or point group
groupPoints = geo.globPoints('groupName')
I think I am finally starting to get a grasp on the built in help files
and I will also add in-case anyone else ever has a similar question to mine
I then got stuck on how to query the points.numbers() to a primitive or point group
groupPoints = geo.globPoints('groupName')
I think I am finally starting to get a grasp on the built in help files
todo: add signature
-
- Quick Links


