Help with orientation marker and ruler

I don’t know if this is exactly what you need but here is code I used to make the user draw a line:

lineNode = slicer.mrmlScene.CreateNodeByClass("vtkMRMLMarkupsLineNode")
lineNode.SetName("temp")
slicer.mrmlScene.AddNode(lineNode)
slicer.modules.markups.logic().AddNewDisplayNodeForMarkupsNode(lineNode)
lineNode.SetName(slicer.mrmlScene.GetUniqueNameByString("line"))

#setup placement
slicer.modules.markups.logic().SetActiveListID(lineNode)
interactionNode = slicer.mrmlScene.GetNodeByID("vtkMRMLInteractionNodeSingleton")
interactionNode.SwitchToSinglePlaceMode()
1 Like

Hey @mau_igna_06, I owe you big time! This is perfect! Wow! Made my day!

:slight_smile:

How does one delete the lines using Python?

slicer.mrmlScene.RemoveNode(lineNode) to remove

Is there a Slicer Python Scripting reference manual that I can use so that I can stop bugging you guys about every little command? Thanks! :slight_smile:

The Python script repository is a good place to start.