[vtkusers] Can not show points of STL file
Sebastien Jourdain
sebastien.jourdain at kitware.com
Tue Jul 6 10:57:51 EDT 2010
Try to figure out exactly where it crash.
Otherwise you can try building your IdList like that
vtkIdList cell = new vtkIdList();
for(int i=0;i<n:i++)
cell.InsertNextId(i);
polyData.InsertNextCell(2, cell);
On Tue, Jul 6, 2010 at 5:03 AM, Wahyudin Permana <gebe_top at yahoo.com> wrote:
> Hi Mr. Jourdain,
>
> I have try your suggestion:
> vtkIdList cell = new vtkIdList();
> cell.SetNumberOfIds(STLPointData.size());
> for(i=0;i<STLPointData.size();i++) {
>
> cell.SetId(i,i);
> }
> polyData.InsertNextCell(2, cell);
>
> but there are errors message and the program was terminated:
>
>
> #
> # A fatal error has been detected by the Java Runtime Environment:
> #
> # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x03874e6c, pid=3492,
> tid=3508
> #
> # JRE version: 6.0_20-b02
> # Java VM: Java HotSpot(TM) Client VM (16.3-b01 mixed mode, sharing
> windows-x86 )
> # Problematic frame:
> # C [vtkFiltering.dll+0x14e6c]
> #
> # An error report file with more information is saved as:
> # F:\Data2\RP Software Development\Software
> Development\Gebe\hs_err_pid3492.log
> #
> # If you would like to submit a bug report, please visit:
> # http://java.sun.com/webapps/bugreport/crash.jsp
> # The crash happened outside the Java Virtual Machine in native code.
> # See problematic frame for where to report the bug.
> #
> Java Result: 1
>
> do you have any suggestion?
>
> thank you
>
> ============================================================
> regards,
> Wahyudin Permana
> Phone:
> Indonesia (Jakarta): +628151871130
> Saudi Arabia (Riyadh): +966569143445
> ============================================================
>
> --- On *Tue, 7/6/10, Sebastien Jourdain <sebastien.jourdain at kitware.com>*wrote:
>
>
> From: Sebastien Jourdain <sebastien.jourdain at kitware.com>
> Subject: Re: [vtkusers] Can not show points of STL file
> To: "David E DeMarle" <dave.demarle at kitware.com>
> Cc: "Wahyudin Permana" <gebe_top at yahoo.com>, vtkusers at vtk.org
> Date: Tuesday, July 6, 2010, 12:44 AM
>
> 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.
>
> Something like that...
>
> vtkIdList cell = new vtkIdList();
> cell.SetNumberOfxx(STLPointData.size());
> for(int i=0;i<STLPointData.size();i++) cell.SetId(i,i);
> polyData.InsertNextCell(2,cell); // 2:VTK_POLY_VERTEX
>
> I do not remember exactly the methods names, but you should be able to
> figure that out.
>
> Seb
>
>
>
> On Mon, Jul 5, 2010 at 11:43 AM, David E DeMarle <dave.demarle at kitware.com<http://mc/compose?to=dave.demarle@kitware.com>
> > wrote:
>
>> VTK renders cells not points.
>>
>> Try using a glyph filter to create 1 VTK_VERTEX cell for every point.
>>
>> David E DeMarle
>> Kitware, Inc.
>> R&D Engineer
>> 28 Corporate Drive
>> Clifton Park, NY 12065-8662
>> Phone: 518-371-3971 x109
>>
>>
>> On Mon, Jul 5, 2010 at 11:12 AM, Wahyudin Permana <gebe_top at yahoo.com<http://mc/compose?to=gebe_top@yahoo.com>
>> > wrote:
>>
>>> Dear All,
>>>
>>> I want to show points of STL file, but it doesn.t work, no error, but the
>>> points were not appear.
>>> any suggestion?
>>>
>>> Code:
>>> STLPointData = new STLReading();
>>> STLPointData.readSTL(name); // IMPORTANT: ONLYREAD STL ASCII
>>> FILE
>>>
>>> vtkPoints points = new vtkPoints();
>>> vtkPolyData polyData = new vtkPolyData();
>>> vtkUnstructuredGrid unstructuredGrid = new vtkUnstructuredGrid();
>>>
>>> int i = 0, j = 0, k = 0;
>>> int n;
>>> n = STLPointData.size();
>>> points.SetNumberOfPoints(n);
>>> System.out.println("Number of points= "+n);
>>> for(i=0;i<n;i++){
>>> double x = 0,y = 0,z = 0;
>>> //for(j=0;j<3;j++){
>>> //}
>>> x=(Double)((Vector)STLPointData.get(i)).get(0);
>>> y=(Double)((Vector)STLPointData.get(i)).get(1);
>>> z=(Double)((Vector)STLPointData.get(i)).get(2);
>>> points.InsertPoint(i, x, y, x);
>>> System.out.println("X= "+x+", Y= "+y+", Z= "+z);
>>> }
>>>
>>> vtkConeSource cone = new vtkConeSource();
>>>
>>> polyData.SetPoints(points);
>>> polyData.Squeeze();
>>> vtkPolyDataMapper mapper = new vtkPolyDataMapper();
>>> mapper.SetInput(polyData);
>>> //mapper.SetInput(cone.GetOutput());
>>>
>>> //unstructuredGrid.SetPoints(points);
>>> //vtkDataSetMapper dataMapper = new vtkDataSetMapper();
>>> //dataMapper.SetInput(unstructuredGrid);
>>> //dataMapper.SetInput(polyData);
>>>
>>> vtkActor stlActor = new vtkActor();
>>> vtkProperty property = new vtkProperty();
>>> property.SetColor(0.3, 0.8, 0.3);
>>> stlActor.SetMapper(mapper);
>>> //stlActor.SetMapper(dataMapper);
>>> stlActor.SetProperty(property);
>>>
>>> vtkRenderer ren2; //= new vtkRenderer();
>>> ren2 = renWin2.GetRenderer();
>>> ren2.AddActor(stlActor);
>>> ren2.SetBackground(0.1, 0.1, 0.8);
>>>
>>> ren2.ResetCameraClippingRange();
>>> ren2.ResetCamera();
>>>
>>> ren2.Render();
>>>
>>>
>>> thank you
>>>
>>> ============================================================
>>> regards,
>>> Wahyudin Permana
>>> Phone:
>>> Indonesia (Jakarta): +628151871130
>>> Saudi Arabia (Riyadh): +966569143445
>>> ============================================================
>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the VTK FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100706/c8b21abc/attachment.htm>
More information about the vtkusers
mailing list