<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 9.00.8112.16447"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=503222302-14082012>Fantastic - one line code change and it all works -
below is full working example for future reference - thanks!</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2
face=Arial></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>#include
<vtkPolyData.h><BR>#include <vtkSTLReader.h><BR>#include
<vtkSmartPointer.h><BR>#include <vtkPolyDataMapper.h><BR>#include
<vtkIdTypeArray.h><BR>#include <vtkSelectionNode.h><BR>#include
<vtkActor.h><BR>#include <vtkRenderWindow.h><BR>#include
<vtkRenderer.h><BR>#include
<vtkRenderWindowInteractor.h><BR>#include
<vtkSelection.h><BR>#include <vtkExtractSelection.h><BR>#include
<vtkDataSetMapper.h><BR>#include <vtkProperty.h><BR>#include
<vtkObjectFactory.h><BR>#include <vtkCellArray.h><BR>#include
<vtkCell.h><BR>#include <vtkInformation.h><BR>#include
<vtkExtractSelectedPolyDataIds.h></FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>// C++<BR>#include
<iostream></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>using namespace
std;</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>int main(int argc,
char *argv[])<BR>{<BR><SPAN class=503222302-14082012>
</SPAN>// check and get the stl input file provided<BR> if (
argc != 2 )<BR>
{<BR> cout << "Required
parameters: Filename" <<
endl;<BR> return
EXIT_FAILURE;<BR> }<BR> std::string
inputfile = argv[1];</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
// read STL and print out some info<BR> std::cout <<
"Reading: " << inputfile << std::endl;<BR>
vtkSmartPointer<vtkSTLReader> stlReader =
vtkSmartPointer<vtkSTLReader>::New();<BR>
stlReader->SetFileName(inputfile.c_str());<BR>
vtkSmartPointer<vtkPolyData> polydata =
vtkSmartPointer<vtkPolyData>::New(); <BR> polydata =
stlReader->GetOutput();<BR>
polydata->Update();<BR> cout << "Cells: " <<
polydata->GetNumberOfCells() << endl;<BR> cout
<< "Points: " << polydata->GetNumberOfPoints() <<
endl;<BR> cout << "Polys: " <<
polydata->GetNumberOfPolys() << endl;<BR> cout
<< "Verts: " << polydata->GetNumberOfVerts() <<
endl;<BR> polydata->Print(cout);</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
// select cells of interest<BR> // ref: <A
href="http://www.kitware.com/media/html/SelectionsInVTK.html">http://www.kitware.com/media/html/SelectionsInVTK.html</A><BR>
vtkSmartPointer<vtkSelectionNode> cellSelectionNode =
vtkSmartPointer<vtkSelectionNode>::New();<BR>
cellSelectionNode->SetFieldType(vtkSelectionNode::CELL);<BR>
cellSelectionNode->SetContentType(vtkSelectionNode::INDICES);</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
//cellSelectionNode->SetFieldType(vtkSelectionNode::POINT);<BR>
vtkSmartPointer<vtkIdTypeArray> ids =
vtkSmartPointer<vtkIdTypeArray>::New();<BR>
ids->SetNumberOfComponents(1);</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
int nCellsNum = polydata->GetNumberOfCells();<BR> for (int
nCellID = 0; nCellID < nCellsNum/2; nCellID++) <BR> {
<BR> vtkCell* cell;
<BR> cell =
polydata->GetCell(nCellID);<BR>
ids->InsertNextValue(nCellID);<BR> }<BR>
cellSelectionNode->SetSelectionList(ids);<BR>
vtkSmartPointer<vtkSelection> cellSelection =
vtkSmartPointer<vtkSelection>::New();<BR>
cellSelection->AddNode(cellSelectionNode);<BR> cout
<< "Selected Cells: " <<
cellSelection->GetNode(0)->GetSelectionList()->GetNumberOfTuples()
<< endl;<BR> cellSelection->Print(cout);</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
// Extract Selection<BR> // doesn't work
vtkSmartPointer<vtkExtractSelection> extractSelection =
vtkSmartPointer<vtkExtractSelection>::New();<BR>
vtkSmartPointer<vtkExtractSelectedPolyDataIds> extractSelection =
vtkSmartPointer<vtkExtractSelectedPolyDataIds>::New();<BR>
extractSelection->SetInput(0, polydata); // The dataset is given
on its first input port<BR> extractSelection->SetInput(1,
cellSelection); // The subset is described by the contents of the
vtkSelection on its second input port<BR>
extractSelection->Update();<BR>
extractSelection->Print(cout);</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
vtkSmartPointer<vtkPolyData> selectedPolydata =
vtkSmartPointer<vtkPolyData>::New();<BR>
selectedPolydata->ShallowCopy(extractSelection->GetOutput());<BR>
selectedPolydata->Print(cout);</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
// Visualise<BR> vtkSmartPointer<vtkPolyDataMapper>
selectedPolydataMapper =
vtkSmartPointer<vtkPolyDataMapper>::New();<BR>
selectedPolydataMapper->SetInput(selectedPolydata);<BR>
vtkSmartPointer<vtkActor> actor =
vtkSmartPointer<vtkActor>::New();<BR>
actor->SetMapper(selectedPolydataMapper);</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();<BR>
vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();<BR>
renderWindow->AddRenderer(renderer);<BR>
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();<BR>
renderWindowInteractor->SetRenderWindow(renderWindow);</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
renderer->AddActor(actor);<BR>
renderer->SetBackground(.3, .6, .3); // Background color green</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
renderWindow->Render();<BR>
renderWindowInteractor->Start();</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
return EXIT_SUCCESS;<BR>}</FONT></DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> Gonzalo Amadio
[mailto:gonzaloamadio@gmail.com] <BR><B>Sent:</B> Monday, 13 August 2012 10:31
PM<BR><B>To:</B> Paul McIntosh<BR><B>Cc:</B> David Doria;
vtkusers@vtk.org<BR><B>Subject:</B> Re: [vtkusers] vtkPolyData and extracted
selections<BR></FONT><BR></DIV>
<DIV></DIV>Hello Paul, instead of using vtkExtractSelection, you can use
vtkExtractSelectedPolydataIds. Here is a code example you can use.
<DIV>And you will have a polydata as a result instead of an UG .<BR>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>vtkSmartPointer<vtkIdTypeArray> ids =
vtkSmartPointer<vtkIdTypeArray>::New();<BR><SPAN
style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>ids->SetNumberOfComponents(1);<BR></BLOCKQUOTE>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote> </BLOCKQUOTE>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN> // Set values<BR></BLOCKQUOTE>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>
std::vector<int> idsForNewPolydata ;</BLOCKQUOTE>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote> //Put ids you want into
idsForNewPolydata</BLOCKQUOTE>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><FONT color=#0000ff size=2 face=Arial></FONT><BR></BLOCKQUOTE>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>std::vector<int>::iterator it;<BR><SPAN
style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>for (it =
idsForNewPolydata.begin(); it != idsForNewPolydata.end(); it++)
// idsForNewPolydata in your case should be id's from 0
to <SPAN
style="BACKGROUND-COLOR: rgb(255,255,255); FONT-FAMILY: arial,sans-serif; COLOR: rgb(34,34,34); FONT-SIZE: 13px">nCellsNum</SPAN>/2</BLOCKQUOTE>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>{<BR><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>int currentIndice = *it;<BR><SPAN
style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>ids->InsertNextValue(currentIndice);<BR><SPAN
style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>}<BR><SPAN
style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN></BLOCKQUOTE>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote> </BLOCKQUOTE>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>vtkSmartPointer<vtkSelectionNode>
selectionNode = vtkSmartPointer<vtkSelectionNode>::New();<BR><SPAN
style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>selectionNode->SetFieldType(vtkSelectionNode::CELL);<BR><SPAN
style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>selectionNode->SetContentType(vtkSelectionNode::INDICES);<BR><SPAN
style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>selectionNode->SetSelectionList(ids);<BR></BLOCKQUOTE>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote> </BLOCKQUOTE>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>vtkSmartPointer<vtkSelection> selection =
vtkSmartPointer<vtkSelection>::New();<BR><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>selection->AddNode(selectionNode);<BR><SPAN
style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN></BLOCKQUOTE>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote> </BLOCKQUOTE>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>vtkSmartPointer<vtkExtractSelectedPolyDataIds>
extractSelectedIds =<SPAN style="WHITE-SPACE: pre" class=Apple-tab-span>
</SPAN>vtkSmartPointer<vtkExtractSelectedPolyDataIds>::New();<BR><SPAN
style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>extractSelectedIds->SetInput(0,
polydata);<BR><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>extractSelectedIds->SetInput(1,
selection);<BR><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>extractSelectedIds->Update();<BR></BLOCKQUOTE>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote> </BLOCKQUOTE>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>vtkPolyData* finalPolyData =
extractSelectedIds->GetOutput();</BLOCKQUOTE></DIV>
<DIV><BR></DIV>
<DIV><BR>Cheers, </DIV>
<DIV>Gonzalo..</DIV>
<DIV><BR></DIV>
<DIV><BR>
<DIV class=gmail_quote>2012/8/13 Paul McIntosh <SPAN dir=ltr><<A
href="mailto:paul.mcintosh@internetscooter.com"
target=_blank>paul.mcintosh@internetscooter.com</A>></SPAN><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>Hi David,<BR><BR>Thanks for your response - attached is a
stl generated from a sphere source<BR>and program the output from using this
example.<BR><BR>The input polydata has "Number Of Cells: 96" (so is read ok) -
I select half<BR>of those cells and it appears to be correct as following
reports "48" :<BR>
<DIV class=im>"cout << "Selected Cells: "
<<<BR>cellSelection->GetNode(0)->GetSelectionList()->GetNumberOfTuples()<BR><BR></DIV>However
the output polydata is missing the cells.<BR><BR> Number Of Points:
35<BR> Number Of Cells: 0<BR><BR>I am probably just missing an setting
that brings the cells but I have been<BR>banging my head against this for a
while and not making much headway.<BR><BR>Any help much appreciated and I am
also happy to add this to the vtk<BR>examples once it is
working.<BR><BR>Cheers,<BR><BR>Paul<BR>
<DIV>
<DIV class=h5><BR>-----Original Message-----<BR>From: David Doria [mailto:<A
href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</A>]<BR>Sent: Sunday,
12 August 2012 11:07 PM<BR>To: Paul McIntosh<BR>Cc: <A
href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</A><BR>Subject: Re: [vtkusers]
vtkPolyData and extracted selections<BR><BR>On Sun, Aug 12, 2012 at 7:44 AM,
Paul McIntosh<BR><<A
href="mailto:paul.mcintosh@internetscooter.com">paul.mcintosh@internetscooter.com</A>>
wrote:<BR>> Hi,<BR>><BR>> I am creating a utility that will calculate
the frontal area of a<BR>> mesh. The first thing I am trying is extracting
cells from a mesh by<BR>> their id's (later I will change this to select
cells that are visible<BR>> from a particular direction). I am getting
stuck though creating a new<BR>> polydata object which is a subset of the
original, using the<BR>> selection. The VTK examples use an
unstructuredgrid, but the same code<BR>> doesn't work with polydata - can
anyone see what I am doing wrong?<BR>><BR>> Paul<BR>><BR>><BR>>
#include <vtkPolyData.h><BR>> #include <vtkSTLWriter.h><BR>>
#include <vtkSTLReader.h><BR>> #include
<vtkTransform.h><BR>> #include <vtkTransformFilter.h><BR>>
#include <vtkTriangle.h><BR>> #include
<vtkSphereSource.h><BR>> #include <vtkSmartPointer.h><BR>>
#include <vtkPolyDataMapper.h><BR>> #include
<vtkIdTypeArray.h><BR>> #include <vtkSelectionNode.h><BR>>
#include <vtkActor.h><BR>> #include <vtkRenderWindow.h><BR>>
#include <vtkRenderer.h><BR>> #include
<vtkRenderWindowInteractor.h> #include<BR>>
<vtkHardwareSelector.h> #include
<vtkInteractorStyleTrackballCamera.h><BR>> #include
<vtkRendererCollection.h><BR>> #include
<vtkSelection.h><BR>> #include <vtkExtractSelection.h><BR>>
#include <vtkDataSetMapper.h><BR>> #include
<vtkProperty.h><BR>> #include <vtkObjectFactory.h><BR>>
#include <vtkCellArray.h><BR>> #include <vtkCell.h><BR>>
#include <vtkInformation.h><BR>> #include
<vtkUnstructuredGrid.h><BR>><BR>> // C++<BR>> #include
<list><BR>> #include <iostream><BR>> #include
<fstream><BR>><BR>> using namespace std;<BR>><BR>> int
main(int argc, char *argv[])<BR>> {<BR>> //
check and get the stl input file provided<BR>> if ( argc != 2
)<BR>> {<BR>> cout <<
"Required parameters: Filename" << endl;<BR>>
return EXIT_FAILURE;<BR>> }<BR>>
std::string inputfile = argv[1];<BR>><BR>> // read STL and
print out some info<BR>> std::cout << "Reading: "
<< inputfile << std::endl;<BR>>
vtkSmartPointer<vtkSTLReader> stlReader =<BR>>
vtkSmartPointer<vtkSTLReader>::New();<BR>>
stlReader->SetFileName(inputfile.c_str());<BR>>
vtkSmartPointer<vtkPolyData> polydata =<BR>>
vtkSmartPointer<vtkPolyData>::New();<BR>> polydata =
stlReader->GetOutput();<BR>>
polydata->Update();<BR>> cout << "Cells: " <<
polydata->GetNumberOfCells() << endl;<BR>> cout
<< "Points: " << polydata->GetNumberOfPoints() <<
endl;<BR>> cout << "Polys: " <<
polydata->GetNumberOfPolys() << endl;<BR>> cout
<< "Verts: " << polydata->GetNumberOfVerts() <<
endl;<BR>>
polydata->Print(cout);<BR>><BR>> //
select cells of interest<BR>> // ref: <A
href="http://www.kitware.com/media/html/SelectionsInVTK.html"
target=_blank>http://www.kitware.com/media/html/SelectionsInVTK.html</A><BR>>
vtkSmartPointer<vtkSelectionNode> cellSelectionNode
=<BR>> vtkSmartPointer<vtkSelectionNode>::New();<BR>>
cellSelectionNode->SetFieldType(vtkSelectionNode::CELL);<BR>>
cellSelectionNode->SetContentType(vtkSelectionNode::INDICES);<BR>><BR>>
vtkSmartPointer<vtkIdTypeArray> ids =<BR>>
vtkSmartPointer<vtkIdTypeArray>::New();<BR>>
ids->SetNumberOfComponents(1);<BR>><BR>>
int nCellsNum = polydata->GetNumberOfCells();<BR>>
for (int nCellID = 0; nCellID < nCellsNum/2; nCellID++)<BR>>
{<BR>>
vtkCell* cell;<BR>>
cell = polydata->GetCell(nCellID);<BR>>
ids->InsertNextValue(nCellID);<BR>>
}<BR>>
cellSelectionNode->SetSelectionList(ids);<BR>>
vtkSmartPointer<vtkSelection> cellSelection =<BR>>
vtkSmartPointer<vtkSelection>::New();<BR>>
cellSelection->AddNode(cellSelectionNode);<BR>>
cout << "Selected Cells: " <<<BR>>
cellSelection->GetNode(0)->GetSelectionList()->GetNumberOfTuples()
<<<BR></DIV></DIV>> cellSelection->endl;<BR>
<DIV class=HOEnZb>
<DIV class=h5>>
//cellSelection->Print(cout);<BR>><BR>>
// Extract Selection<BR>>
vtkSmartPointer<vtkExtractSelection> extractSelection =<BR>>
vtkSmartPointer<vtkExtractSelection>::New();<BR>>
extractSelection->SetInput(0, polydata);
// The<BR>> dataset is given on its first
input port<BR>>
extractSelection->SetInput(1, cellSelection); // The subset
is<BR>> described by the contents of the vtkSelection on its second input
port<BR>>
extractSelection->Update();<BR>>
extractSelection->Print(cout);<BR>><BR>>
vtkSmartPointer<vtkPolyData> selectedPolydata =<BR>>
vtkSmartPointer<vtkPolyData>::New();<BR>>
selectedPolydata->ShallowCopy(extractSelection->GetOutput());<BR>>
selectedPolydata->Print(cout);<BR>><BR>>
// Visualise<BR>>
vtkSmartPointer<vtkPolyDataMapper> selectedPolydataMapper =<BR>>
vtkSmartPointer<vtkPolyDataMapper>::New();<BR>>
selectedPolydataMapper->SetInput(selectedPolydata);<BR>>
vtkSmartPointer<vtkActor> actor =
vtkSmartPointer<vtkActor>::New();<BR>>
//actor->SetMapper(mapper);<BR>>
actor->SetMapper(selectedPolydataMapper);<BR>><BR>>
vtkSmartPointer<vtkRenderer> renderer =<BR>>
vtkSmartPointer<vtkRenderer>::New();<BR>>
vtkSmartPointer<vtkRenderWindow> renderWindow =<BR>>
vtkSmartPointer<vtkRenderWindow>::New();<BR>>
renderWindow->AddRenderer(renderer);<BR>>
vtkSmartPointer<vtkRenderWindowInteractor>
renderWindowInteractor<BR>> =
vtkSmartPointer<vtkRenderWindowInteractor>::New();<BR>>
renderWindowInteractor->SetRenderWindow(renderWindow);<BR>><BR>>
renderer->AddActor(actor);<BR>>
renderer->SetBackground(.3, .6, .3); // Background color
green<BR>><BR>> renderWindow->Render();<BR>>
renderWindowInteractor->Start();<BR>><BR>>
return EXIT_SUCCESS;<BR>> }<BR>><BR>> Cheers,<BR>><BR>>
Paul<BR><BR>What do you mean "doesn't work"? What is the error? Please make
your example<BR>self-contained (i.e. generate data (perhaps vtkSphereSource)
instead of<BR>reading it from a file, etc) so it is easier for us to take a
look.<BR><BR>David<BR></DIV></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><BR
clear=all>
<DIV><BR></DIV>-- <BR>--------<BR>Gonzalo
Amadio<BR><BR></DIV></DIV></BODY></HTML>