Como puedo escribir vtkLineWidget a un archivo stl ?

Como puedo optener polydata de un widget para escribirla en un stl ?
pseudocode:
writer.setInputData(lineWidget.getOutputData());

Hi Javi,

This is an English speaking discourse, would you mind translating it in English ?

Thanks,
J.

A widget is not just a mesh and therefore can not be saved to stl directly. But you could you use a vtkLineSource instead.

How can I get polydata from a widget to write it to an stl ?
pseudocode:
writer.setInputData(lineWidget.getOutputData());

Thank you I hadn’t thought of that
How can I get the two points from vtkLineWidget ?

You need to get the points from the widget state, e.g.:

lineWidget.getWidgetState().getHandle1().getOrigin()
lineWidget.getWidgetState().getHandle2().getOrigin()

Thank you.
How can I change the colour of the line ?
There is a documentation like this one https://vtk.org/doc/nightly/html/annotated.html for vtk.js