Skip to content
Advertisement

VTK with multiple combined STL files

I’m working on a project with python and VTK. I successfully managed to combine three STL files, with a python STL libraray. After that, I visualize this combined.stl file in VTK like this:

JavaScript

So far so good. But now I want to colorize/highlight one of those STL-objects. (All STLs together form a bigger object, so the positioning is important and has to stay the same. So the whole thing needs to stay one vtkActor at the end.)

I think it’s not possible to do the colorization in the combined STL file, because the combined file doesn’t keep track of the original objects (maybe there is also a solution here, please correct me if I’m wrong). So I guess I need a different solution.

I already tried it with this CompositePolyDataMapper example (https://lorensen.github.io/VTKExamples/site/Python/CompositeData/CompositePolyDataMapper/), but I don’t know how I can get from vtkSTLReader to an object I can put into the vtkMultiBlockDataSet.

Does someone know a solution for my problem?

Thank you in advance.

Advertisement

Answer

Ok, I could solve the problem by myself. If somebody has a similar problem the solution was pretty easy:

JavaScript

The vtkAssembly class lets you add actors to it and if you interact with it, it works like one actor.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement