Some questions

   2187   11   1
User Avatar
Member
538 posts
Joined: Dec. 2006
Offline
1. Fastest way to get points count from geometry with Python. At now I simply use int(hou.hscriptExpression('npoints(“%s”)' % sop_path))

2. Is it possible to get Edit SOP ‘Apply’ button press count?
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Member
1906 posts
Joined: Nov. 2006
Online
vux
1. Fastest way to get points count from geometry with Python. At now I simply use int(hou.hscriptExpression('npoints(“%s”)' % sop_path))
len(hou.node(sop_path).geometry().iterPoints())
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
538 posts
Joined: Dec. 2006
Offline
graham
vux
1. Fastest way to get points count from geometry with Python. At now I simply use int(hou.hscriptExpression('npoints(“%s”)' % sop_path))
len(hou.node(sop_path).geometry().iterPoints())

I think it is not faster than hscript expression
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Member
1906 posts
Joined: Nov. 2006
Online
Define faster. Faster to type? Faster to execute?

That's the correct way to query the number of points using Python and also the fastest to execute, because it's instant.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
538 posts
Joined: Dec. 2006
Offline
Ok. Can you prove that it faster in execution?
Edited by - Dec. 12, 2015 06:03:56
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Member
538 posts
Joined: Dec. 2006
Offline
What is nearpoint expression function python analog?

findClosestPoint(pos3) → hou.Point or None

This method is not yet implemented.
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Member
538 posts
Joined: Dec. 2006
Offline
2. Is it possible to get Edit SOP ‘Apply’ button press count?
Ok. How to know that user modified geo with Edit SOP? Node.cookCount() is very different. Even changing soft radius change cookCount
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Member
1906 posts
Joined: Nov. 2006
Online
vux
Ok. Can you prove that it faster in execution?
It runs in a millisecond for a 100 million point mesh, is that proof enough?

As you've noticed, the nearpoint equivalent is not implemented and thus there is not one. You could write your own using inlinecpp or could try a numpy/scipy approach like this: https://github.com/captainhammy/Houdini-Toolbox/blob/master/python/ht/geometry/pointcloud.py [github.com]

Since the cook count just cares how many times the node has recooked it's not going to be reliable. I'm pretty sure there is no way to get the information you are looking for.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
538 posts
Joined: Dec. 2006
Offline
It runs in a millisecond for a 100 million point mesh, is that proof enough?
I was joking ) I can`t measure difference

You could write your own using inlinecpp
Good idea, but I need python solution for crossplatform. Maybe when Houdini distributive for Windows will contain compiler )
IMO in my case nearpoint expression is better way
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Member
538 posts
Joined: Dec. 2006
Offline
I found solution to check dirt Edit SOP.

if input_geo.averageEdgeLength() != edit_geo.averageEdgeLength():
print ‘Changed with Edit SOP’
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Member
538 posts
Joined: Dec. 2006
Offline
I forgot about intrinsic values:
geo.intrinsicValue('pointcount')
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Member
538 posts
Joined: Dec. 2006
Offline
Is it possible to unset “Draw Realtime” in Stroke SOP with Python or hscript?
https://gumroad.com/alexeyvanzhula [gumroad.com]
  • Quick Links