Application data bound to vtkActor

Is there a way to associate private data with an actor in vtkjs?

I want to be able to get back a handle to some application state when picking.

Is using a JS Map my best option?

Thanks.

You can easily do that on any vtk Object.

const noWarning = true;
actor.set({
  userData: { ... }
}, noWarning);

const userData = actor.getReferenceByName('userData');

Thanks. It would be great if some of this lower level functionality was documented a little better (observation, not criticism). Vtk.js has its own way of doing lots of things, some of which brought over from VTK, so even fairly experienced JS programmers can’t necessarily rely on standard patterns to figure things out on their own.

1 Like