I have two vtkSplineRepresentation () and two viewports. I want to bound a view with a Spline. I know that in order to do this I have to create an Actor. But the problem is that I do not know how. I tried the VtkActor command but I only show a ball, not a set of points, I also tried LineActor but I got an error. Can anybody help me?
The function is as follow:
def Spline(self,crv,ren,iren):
extract = vtk.vtkExtractVOI()
puntosVTK=dental_curve.puntos_vtk(crv)
spline = vtk.vtkSplineWidget()
spline.InitializeHandles(puntosVTK) #insertamos los puntos
spline.SetCurrentRenderer(ren)
spline.SetDefaultRenderer(ren)
spline.SetInputConnection(extract.GetOutputPort())
spline.SetInteractor(iren)
spline.ProjectToPlaneOn()
spline.SetProjectionNormalToXAxes()
spline.On()
return spline
You need to get the polydata from your vtkSplineRepresenatation (through GetPolyData()) and pass it to a vtkPolyDataMapper, then use the vtkPolyDataMapper to your actor. You did not post code so there's nothing I can't fix, but to give you an idea:
mapper = vtk.vtkPolyDataMapper()
geometry = vtk.vtkPolyData()
spline.GetPolyData(geometry))
mapper.SetInputData(geometry)
mapper.Update()
actor = vtk.vtkActor()
actor.SetMapper(mapper)