How can I call Slicer.util.getNode function in cpp code?

Hello,everyone:
We can get node using Slicer.util.getNode in python console and scripted extensions.But how can I call this function in cpp code?
I want to call the qMRMLThreeDView.resetFocalPoint when I click the Display 3D button to make the 3D model be in the center of the 3D view.
image
In other words,how can I get the threeDView node in cpp code?
Any help will be appreciated.

The python api is mostly just a layer on top f the C++ code so you can do the same things. Have a look at the python implementation and you can map it to the corresponding C++.

https://github.com/Slicer/Slicer/blob/b0443c748cb51904dfd82fa603b4353a335e3364/Libs/MRML/Core/vtkMRMLScene.h#L262

1 Like