I am trying to manipulate an STL file so they appear as different colours on the screen.
Here is the code I have now, I am looping through multiple STL files. I think the only issue is my syntax, as I can not find a command that sets the data to the colour I want.
filenames = ['C1.stl','C2.stl']
print(filenames)
actors = []
for name in filenames:
reader = vtk.vtkSTLReader()
reader.SetFileName(name)
mapper = vtk.vtkPolyDataMapper()
if vtk.VTK_MAJOR_VERSION <= 5:
mapper.SetInput(reader.GetOutput())
else:
mapper.SetInputConnection(reader.GetOutputPort())
if name is 'C1.stl':
mapper.getPointData().SetColor(1.0,0,1.0)
Any help would be greatly appreciated! Thank you in advance.
I figured out the answer:
I needed to insert the code as part of my actor