How can I move, scale and rotate PolyData obtained with vtkSTLReader ?

I want to move, rotate and scale a stl using vtk.js
I only want to view it, not apply the transformation to the stl.
How can I do this?

const reader = vtkSTLReader.newInstance();
reader.setUrl("file.stl", { binary: true }).then(()=>{
    const polydata = reader.getOutputData();
    //escale, rotate, move polydata
});

You can set a userMatrix onto the actor.
To build such matrix, you can use the vtkMatrixBuilder convenient class.

how can I align the stl with a vector as if it were a cylinder ?

const cylinder = vtkCylinderSource.newInstance();
cylinder.setDirectionFrom(vector);
actor.setUserMatrix(
  vtkMatrixBuilder.buildFromDegree().rotateFromDirections([0, 0, 1], vector).getMatrix());

or something like that :slight_smile: