How to save the graphics file created by the widget

Dear VTK team,

I draw the lines with the mouse and want to save then like .vtk file, see the example LineWidget
I’m looking for a way to save all the lines data to an file in VTK.js. Could you please advice me something?
Thank you.

For the LineWidget example, you will have to manually extract your state and save it.

state = getWidgetState()
serializedState = {
  handle1: state.getHandle1().getOrigin(),
  handle2: state.getHandle2().getOrigin(),

You could also try to use state.getState(), which should output a serialized form, but I don’t remember if there were cyclic issues with the widget state object. Probably not, so it’s worth a try.

Thanks for your help. :grinning:
I’ll try