<br>Hi David,<br> Thanks for the reply. It is working fine for me. But this time I am facing a new problem. If I add any actor to the to the renderer then 1st widget is moving only at the first time after that I am not able to move it. 2nd widget is moving without any problem.<br>
Plz see the pipeline I have followed.<br><br> // Input is a polydata file like brainImageSmooth.vtk in VTKData/Data<br>
<meta name="qrichtext" content="1"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style="margin: 0px; text-indent: 0px;"> vtkPolyDataReader *reader = vtkPolyDataReader::New();</p>
<p style="margin: 0px; text-indent: 0px;"> reader->SetFileName(argv[1]);</p>
<p style="margin: 0px; text-indent: 0px;"> reader->Update();</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"> vtkPolyData *polyData = reader->GetOutput();</p>
<p style="margin: 0px; text-indent: 0px;"> vtkPolyDataMapper* surfaceMapper = vtkPolyDataMapper::New();</p>
<p style="margin: 0px; text-indent: 0px;"> surfaceMapper->SetInput(polyData);</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"> vtkActor* surfaceActor = vtkActor::New();</p>
<p style="margin: 0px; text-indent: 0px;"> surfaceActor->SetMapper(surfaceMapper);</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"> // a renderer and render window</p>
<p style="margin: 0px; text-indent: 0px;"> vtkRenderer *renderer =</p>
<p style="margin: 0px; text-indent: 0px;"> vtkRenderer::New();</p>
<p style="margin: 0px; text-indent: 0px;"> vtkRenderWindow *renderWindow =</p>
<p style="margin: 0px; text-indent: 0px;"> vtkRenderWindow::New();</p>
<p style="margin: 0px; text-indent: 0px;"> renderWindow->AddRenderer(renderer);</p>
<p style="margin: 0px; text-indent: 0px;"> renderer->AddActor(surfaceActor);</p>
<p style="margin: 0px; text-indent: 0px;"> // an interactor</p>
<p style="margin: 0px; text-indent: 0px;"> vtkRenderWindowInteractor *renderWindowInteractor =</p>
<p style="margin: 0px; text-indent: 0px;"> vtkRenderWindowInteractor::New();</p>
<p style="margin: 0px; text-indent: 0px;"> renderWindowInteractor->SetRenderWindow(renderWindow);</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"> vtkSphereWidget *sphereWidget1 =</p>
<p style="margin: 0px; text-indent: 0px;"> vtkSphereWidget::New();</p>
<p style="margin: 0px; text-indent: 0px;"> sphereWidget1->SetInteractor(renderWindowInteractor);</p>
<p style="margin: 0px; text-indent: 0px;"> sphereWidget1->SetRepresentationToSurface();</p>
<p style="margin: 0px; text-indent: 0px;"> sphereWidget1->SetCenter(-10.0, 0.0, 0.0);</p>
<p style="margin: 0px; text-indent: 0px;"> sphereWidget1->SetRadius(4);</p>
<p style="margin: 0px; text-indent: 0px;"> sphereWidget1->On();</p>
<p style="margin: 0px; text-indent: 0px;"> vtkSphereWidget *sphereWidget2 =</p>
<p style="margin: 0px; text-indent: 0px;"> vtkSphereWidget::New();</p>
<p style="margin: 0px; text-indent: 0px;"> sphereWidget2->SetInteractor(renderWindowInteractor);</p>
<p style="margin: 0px; text-indent: 0px;"> sphereWidget2->SetRepresentationToSurface();</p>
<p style="margin: 0px; text-indent: 0px;"> sphereWidget2->SetCenter(10.0, 0.0, 0.0);</p>
<p style="margin: 0px; text-indent: 0px;"> sphereWidget2->SetRadius(4);</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"> sphereWidget2->On();</p>
<p style="margin: 0px; text-indent: 0px;"> renderWindow->Render();</p>
<p style="margin: 0px; text-indent: 0px;"> renderWindowInteractor->Initialize();</p>
<p style="margin: 0px; text-indent: 0px;"> renderWindowInteractor->Start();</p><br><div class="gmail_quote"><br>Thanks and Regards,<br>Satya.<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="gmail_quote"><div>The following works fine for me - can you explain the problem in more detail?</div><div> </div><div>#include <vtkPolyDataMapper.h></div>
<div>#include <vtkActor.h></div><div>#include <vtkRenderWindow.h></div><div>#include <vtkRenderer.h></div><div>#include <vtkRenderWindowInteractor.h></div><div>#include <vtkPolyData.h></div>
<div>
#include <vtkSmartPointer.h></div><div>#include <vtkSphereSource.h></div><div>#include <vtkSphereWidget.h></div><div>#include <vtkSphereRepresentation.h></div><div>#include <vtkBoxWidget2.h></div>
<div>#include <vtkCommand.h></div><div><br></div><div>int main(int argc, char *argv[])</div><div>{</div><div> // a renderer and render window</div><div> vtkSmartPointer<vtkRenderer> renderer = </div><div> vtkSmartPointer<vtkRenderer>::New();</div>
<div> vtkSmartPointer<vtkRenderWindow> renderWindow = </div><div> vtkSmartPointer<vtkRenderWindow>::New();</div><div> renderWindow->AddRenderer(renderer);</div><div> </div><div> // an interactor</div>
<div> vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = </div><div> vtkSmartPointer<vtkRenderWindowInteractor>::New();</div><div> renderWindowInteractor->SetRenderWindow(renderWindow);</div>
<div><br></div><div> vtkSmartPointer<vtkSphereWidget> sphereWidget1 = </div><div> vtkSmartPointer<vtkSphereWidget>::New();</div><div> sphereWidget1->SetInteractor(renderWindowInteractor);</div><div>
sphereWidget1->SetRepresentationToSurface();</div>
<div> </div><div> vtkSmartPointer<vtkSphereWidget> sphereWidget2 = </div><div> vtkSmartPointer<vtkSphereWidget>::New();</div><div> sphereWidget2->SetInteractor(renderWindowInteractor);</div><div> sphereWidget2->SetRepresentationToSurface();</div>
<div> sphereWidget2->SetCenter(2.0, 0.0, 0.0);</div><div> </div><div> sphereWidget1->On();</div><div> sphereWidget2->On();</div><div> renderWindow->Render();</div><div> renderWindowInteractor->Start();</div>
<div> </div><div> return EXIT_SUCCESS;</div><div>}</div><div><br></div>Thanks,<br><font color="#888888"><br><div>David </div></font></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br>