bentraje Posted December 22, 2021 Share Posted December 22, 2021 (edited) Hi, Is there a way I can get the manipulator handles coordinates? (i.e. world space position)? My use case for this is to create joints in the center of my selection. That's why I need the world space position. The closest documentation I retrieved is this one: https://www.sidefx.com/docs/houdini/hom/state_handles.html But AFAIK, it is referring to binding manipulator handles to custom tools. Edited December 24, 2021 by bentraje Quote Link to comment Share on other sites More sharing options...
bentraje Posted December 24, 2021 Author Share Posted December 24, 2021 (edited) Oh, after rummaging through the documentation, there is no one method that does it. So I got the manipulator handles by simply 1) Getting the selected points 2) Getting their position coordinates and dividing them by the total number of selected points. You can check the sample script here: import toolutils selection = toolutils selection = selection.sceneViewer().selectGeometry() node = selection.nodes()[0] geo = node.geometry() points_patt = selection.selectionStrings(False)[-1] geo.globPoints(points_patt) pt_list = geo.globPoints(points_patt) center_pos = [0,0,0] idx = 0 for pt in pt_list: pos = pt.attribValue("P") center_pos[0] += pos[0] center_pos[1] += pos[1] center_pos[2] += pos[2] idx += 1 center_pos[0] = center_pos[0] /idx center_pos[1] = center_pos[1] /idx center_pos[2] = center_pos[2] /idx print (center_pos) Edited December 24, 2021 by bentraje Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.