Interaction handles disappear if markup node becomes invisible

The objetive was to translate and rotate a model using the interaction handles. To do this I was recommended that I do the translation/rotation using the interaction handles to a plane and then to get it’s PointModifiedEvent connected to a UpdateTransform function that uses GetPlaneToWorldMatrix method to set up the linear transform node I apply to the model. Like it says here:


I was able to make the model rotate and translate with the plane’s interaction handles:

A = slicer.mrmlScene.AddNewNodeByClass(“vtkMRMLMarkupsPlaneNode”, “Plane”)
A.SetOrigin([0,0,-150])
A.SetNormal([0,0,1])
A.SetAxes([100,0,0],[0,100,0],[0,0,100])
A.SetAxes([100,0,0],[0,100,0],[0,0,100])

def UpdateTransform(param1=None, param2=None):
#You have to create a linear transform called LinearTransform_3 in the Transforms module
transformFid = slicer.mrmlScene.GetFirstNodeByName(‘LinearTransform_3’)
matrixScrew = vtk.vtkMatrix4x4()
A.GetPlaneToWorldMatrix(matrixScrew)
transformFid.SetMatrixTransformToParent(matrixScrew)
transformFid.UpdateScene(slicer.mrmlScene)

A.AddObserver(slicer.vtkMRMLMarkupsNode.PointModifiedEvent,UpdateTransform)

#Turn on the interaction handles
B = getFirstNodeByClassByName(“vtkMRMLMarkupsDisplayNode”,‘MarkupsDisplay’)
B.SetHandlesInteractive(True)

But the interaction handles disappear if set up the plane invisible like I was suggested above. I expected the interaction handles remained there so I can move the model.

B.SetVisibility(False)

SetVisibility controls visibility of all parts of the markups in all views. If you just want to hide the plane itself then you can set fill and outline opacity to 0.0.