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

**URL:** <https://discourse.slicer.org/t/how-can-i-call-slicer-util-getnode-function-in-cpp-code/8255>\
**Category:** Development\
**Created:** [September 2, 2019, 5:55am UTC](https://discourse.slicer.org/t/how-can-i-call-slicer-util-getnode-function-in-cpp-code/8255 "2019-09-02T05:55:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JaceYang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jaceyang/32/3686_2.png) [@JaceYang](https://discourse.slicer.org/u/JaceYang)\
**Post date:** [September 2, 2019, 5:55am UTC](https://discourse.slicer.org/t/how-can-i-call-slicer-util-getnode-function-in-cpp-code/8255/1 "2019-09-02T05:55:23Z")

</div>

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](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/c/8c1267841eb613518921e770355c2f5a36235b84.png)  
In other words,how can I get the threeDView node in cpp code?  
Any help will be appreciated.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [September 2, 2019, 1:54pm UTC](https://discourse.slicer.org/t/how-can-i-call-slicer-util-getnode-function-in-cpp-code/8255/2 "2019-09-02T13:54:24Z")

</div>

> [@JaceYang](#):
>
> We can get node using Slicer.util.getNode in python console and scripted extensions.But how can I call this function in cpp code?

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/main/Base/Python/slicer/util.py#L852>

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