Efficient way to get the number of points/prims in Python?

   708   3   0
User Avatar
Member
692 posts
Joined: Aug. 2019
Offline
I know we can do this:

point_count = len(geo.points())
prim_count = len(geo.prims())

However, this approach will actually create a python array. If there are a lot of points, it will create a huge, huge array.

How to get the number of points/prims without creating arrays?
User Avatar
Member
247 posts
Joined: May 2017
Offline
I remember there was a topic on this:

g = n.geometry()
g.intrinsicValue('pointcount')
User Avatar
Member
692 posts
Joined: Aug. 2019
Offline
vikus
I remember there was a topic on this:

g = n.geometry()
g.intrinsicValue('pointcount')

Ah, thanks!

(For completeness, there are intrinsic values for vertex and primitive count as well:



)
Edited by raincole - March 7, 2025 05:38:28

Attachments:
Screenshot 2025-03-07 183804.jpg (38.8 KB)

User Avatar
Member
247 posts
Joined: May 2017
Offline
Workaround for edges: Getting the number x elements in a geometry? [www.sidefx.com]
  • Quick Links