Select primitives with python in Scene Graph Tree in Solaris

   740   1   1
User Avatar
Member
7 posts
Joined: March 2019
Offline
Hi guys,

I am trying to use Python to select primitives in the Scene Graph Tree, but I am not successful.

According to the documentation here
https://www.sidefx.com/docs/houdini/hom/hou/LopNetwork.html [www.sidefx.com]
it looks like it should work.


However, for me, it is just selecting the root primitive and not the one specified.

I've tried two different methods, one based on the network and the other based on the viewer, but both work the same.
Can anyone help me with that, please?

import hou

#Get current network
viewer = hou.ui.paneTabOfType(hou.paneTabType.SceneViewer)
network = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor).pwd()

#OPTION 1
viewer.setCurrentSceneGraphSelection("/pig/geo")

#OPTION 2
network.setSelection("/pig/geo")
Edited by shamanek - May 21, 2025 07:33:37

Attachments:
screenshot1.png (982.0 KB)

User Avatar
Member
7 posts
Joined: March 2019
Offline
shamanek
Hi guys,

I am trying to use Python to select primitives in the Scene Graph Tree, but I am not successful.

According to the documentation here
https://www.sidefx.com/docs/houdini/hom/hou/LopNetwork.html [www.sidefx.com]
it looks like it should work.


However, for me, it is just selecting the root primitive and not the one specified.

I've tried two different methods, one based on the network and the other based on the viewer, but both work the same.
Can anyone help me with that, please?

import hou

#Get current network
viewer = hou.ui.paneTabOfType(hou.paneTabType.SceneViewer)
network = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor).pwd()

#OPTION 1
viewer.setCurrentSceneGraphSelection("/pig/geo")

#OPTION 2
network.setSelection("/pig/geo")

Ok, I figured it out. For anyone who will find it useful.

The function expects a list. So it needs to be like this

viewer.setCurrentSceneGraphSelection(["/pig/geo"])
  • Quick Links