Or create a cell for each point (VTK_VERTEX (=1)) or 1 cell that refer to each point (VTK_POLY_VERTEX (=2)) on the polydata.<br><br>Something like that...<br><br>vtkIdList cell = new vtkIdList();<br>cell.SetNumberOfxx(STLPointData.size());<br>
for(int i=0;i<STLPointData.size();i++) cell.SetId(i,i);<br>polyData.InsertNextCell(2,cell); // 2:VTK_POLY_VERTEX<br><br>I do not remember exactly the methods names, but you should be able to figure that out.<br><br>Seb<br>
<br><br><br><div class="gmail_quote">On Mon, Jul 5, 2010 at 11:43 AM, David E DeMarle <span dir="ltr"><<a href="mailto:dave.demarle@kitware.com">dave.demarle@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
VTK renders cells not points.<br><br>Try using a glyph filter to create 1 VTK_VERTEX cell for every point.<br><br clear="all">David E DeMarle<br>Kitware, Inc.<br>R&D Engineer<br>28 Corporate Drive<br>Clifton Park, NY 12065-8662<br>
Phone: 518-371-3971 x109<br>
<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Mon, Jul 5, 2010 at 11:12 AM, Wahyudin Permana <span dir="ltr"><<a href="mailto:gebe_top@yahoo.com" target="_blank">gebe_top@yahoo.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
Dear All,<br><br>I want to show points of STL file, but it doesn.t work, no error, but the points were not appear. <br>
any suggestion?<br>
<br>Code:<br> STLPointData = new STLReading();<br> STLPointData.readSTL(name); // IMPORTANT: ONLYREAD STL ASCII FILE<br><br> vtkPoints points = new vtkPoints();<br> vtkPolyData polyData = new vtkPolyData();<br>
vtkUnstructuredGrid unstructuredGrid = new vtkUnstructuredGrid();<br><br> int i = 0, j = 0, k = 0;<br> int n;<br> n = STLPointData.size();<br>
points.SetNumberOfPoints(n);<br> System.out.println("Number of points= "+n);<br> for(i=0;i<n;i++){<br> double x = 0,y = 0,z = 0;<br> //for(j=0;j<3;j++){<br> //}<br>
x=(Double)((Vector)STLPointData.get(i)).get(0);<br> y=(Double)((Vector)STLPointData.get(i)).get(1);<br> z=(Double)((Vector)STLPointData.get(i)).get(2);<br> points.InsertPoint(i, x, y,
x);<br> System.out.println("X= "+x+", Y= "+y+", Z= "+z);<br> }<br><br> vtkConeSource cone = new vtkConeSource();<br><br> polyData.SetPoints(points);<br> polyData.Squeeze();<br>
vtkPolyDataMapper mapper = new vtkPolyDataMapper();<br> mapper.SetInput(polyData);<br> //mapper.SetInput(cone.GetOutput());<br><br> //unstructuredGrid.SetPoints(points);<br> //vtkDataSetMapper dataMapper = new vtkDataSetMapper();<br>
//dataMapper.SetInput(unstructuredGrid);<br> //dataMapper.SetInput(polyData);<br><br> vtkActor stlActor = new vtkActor();<br> vtkProperty property = new vtkProperty();<br> property.SetColor(0.3, 0.8, 0.3);<br>
stlActor.SetMapper(mapper);<br> //stlActor.SetMapper(dataMapper);<br> stlActor.SetProperty(property);<br><br> vtkRenderer ren2; //= new vtkRenderer();<br> ren2 = renWin2.GetRenderer();<br>
ren2.AddActor(stlActor);<br> ren2.SetBackground(0.1, 0.1,
0.8);<br> <br> ren2.ResetCameraClippingRange();<br> ren2.ResetCamera();<br><br> ren2.Render();<br><br><br>thank you<br><br>============================================================<br>
regards,<br>
Wahyudin Permana<br>
Phone:<br>
Indonesia (Jakarta): +628151871130<br>
Saudi Arabia (Riyadh): +966569143445<br>
============================================================</td></tr></tbody></table><br>
<br></div></div>_______________________________________________<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>_______________________________________________<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>