The id and name of ThreeDWidget

I have created several 3dwidgets,and now I need to get ThreeDWidget.
I can’t get ThreeDWidget in order.
I get the name of ThreeDWidget first.The name doesn’t correspond to the ID.
But when I try to get qMRMLThreeDWidget through names,it has no return value.
image
The related source code of slicer as follows:
https://github.com/Slicer/Slicer/blob/main/Libs/MRML/Widgets/qMRMLLayoutManager.h#:~:text=///%20Get%203D,id)const%3B

@f1oNae, have you tried with some of the snippets in the python script repository (Script repository — 3D Slicer documentation)? More precisely, the snippets in this section may help you: Access VTK rendering classes.

Let us know if this does not help you.

2 Likes

yeah,I Iterate through all 3D views in current layout,finally find that the real name of the 3DWidget is “View1”-“View16” instead of “ThreeDWidgetX”!!!
Thanks for your help!