How to draw a simple line with vtkMRMLMarkupsLineNode?

Hello,
I have not found how to make a simple line going from point P1 to point P2. with vtkMRMLMarkupsLineNode … I’m still on Slicer 4.11.
Could you help me?
Thank you !!

Something like

# Create line node
line = slicer.mrmlScene.AddNewNodeByClass( 'vtkMRMLMarkupsLineNode', 'TestLine')
# First point
pBegin = vtk.vtkVector3d( 0, 0, 0)
# Second point
pEnd = vtk.vtkVector3d( 100, 100, 100)
# Add points
line.AddControlPointWorld(pBegin)
line.AddControlPointWorld(pEnd)
2 Likes

Thank you for your help.
But, it doesn’t work … The row doesn’t even append in the data.

I have tested with version 4.11 from site page and it works without problems, and node is shown in subject hierarchy correctly.

Make sure that every line of code is executed correctly.

yesss… :sob: I find the problème… I totally forgot to call the function… Sorry :sob: And thank you !