deepCopy in vtk.js

Hi,

In the C++ version we can deepCopy a polyData, but in vtk.js I don’t know how to do it because there is not deepCopy function callable from the polyData object, is there a way to do it?

Thank you

You can do vtkObj.getJSON(), deep copy the result using whatever JS mechanism/library you want (e…g structuredClone), then use vtk(copy) to make a new copy.

There is a naive way like so

dsDest = vtk(dsSrc.getState())

Thank you @Forrest , Thank you @Sebastien_Jourdain

But from where I can import vtk() please?

Thank you !