[vtkusers] Failure in reading stl

NIE JUNXIAO njx937 at gmail.com
Wed Apr 29 05:44:56 EDT 2015


Hello everybody,
     My name is Nie. And I am very sorry for such a newbie.
      I am now working with a project on iOS. I choose VTK as the 
rendering engine. But I have came up eith a problem on reading stl( or 
other 3D type file is OK, like vtp).
I first followed th tutorial on 
http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadSTL
But I get a file not found error (the .stl file is in the app bundle).
Then I changed the stl to vtp using 3Dslicer and tried to read vtp 
referring to readvtp tutorial. This time I get  a error opening file code.
Could anyone give me some hints to solve this?
Thank you.
I am now using VTK6.20 and the version of Xcode is 6.3.1.
Best regards,
NIE JUNXIAO


read stl code //vtkSTLreader is changed to vtkXMLPolyDataReader when 
reading vtp
----------------------------------------------
(void) loadSTL(string name){
     vtkNew<vtkSTLReader> reader;
     reader->SetFileName("tissue.stl"/*name.c_str()*/);//actually it is 
called in another function
     reader->Update();
     vtkNew<vtkPolyDataMapper> mapper;
     mapper->SetInputConnection(reader->GetOutputPort());
     mapper->Update();
     vtkNew<vtkActor> actor;
     actor->SetMapper(mapper.Get());
_myVTKRenderer->AddActor(actor.Get());//_myVTKrenderer is defined before 
this
}
---------------------------------
  error message while reading stl
ERROR: In 
/Users/atreapple/iOS_App/VTK-6.2.0/IO/Geometry/vtkSTLReader.cxx, line 106
vtkSTLReader (0x16d9ccd0): File tissue.stl not found
ERROR: In 
/Users/atreapple/iOS_App/VTK-6.2.0/Common/ExecutionModel/vtkExecutive.cxx, 
line 784
vtkCompositeDataPipeline (0x16d9d0e0): Algorithm 
vtkSTLReader(0x16d9ccd0) returned failure for request: vtkInformation 
(0x16da2fc0)
   Debug: Off
   Modified Time: 347
   Reference Count: 1
   Registered Events: (none)
   Request: REQUEST_DATA
   FORWARD_DIRECTION: 0
   FROM_OUTPUT_PORT: 0
   ALGORITHM_AFTER_FORWARD: 1
------------------------read vtp error code
ERROR: In /Users/atreapple/iOS_App/VTK-6.2.0/IO/XML/vtkXMLReader.cxx, 
line 233
vtkXMLPolyDataReader (0x17532490): Error opening file tissue.vtp

ERROR: In 
/Users/atreapple/iOS_App/VTK-6.2.0/Common/ExecutionModel/vtkExecutive.cxx, 
line 784
vtkCompositeDataPipeline (0x17532120): Algorithm 
vtkXMLPolyDataReader(0x17532490) returned failure for request: 
vtkInformation (0x17531230)
   Debug: Off
   Modified Time: 314
   Reference Count: 1
   Registered Events: (none)
   Request: REQUEST_INFORMATION
   ALGORITHM_AFTER_FORWARD: 1
   FORWARD_DIRECTION: 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150429/9c6a1ae6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tissue.stl
Type: application/octet-stream
Size: 79384 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150429/9c6a1ae6/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tissue.vtp
Type: text/xml
Size: 25029 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150429/9c6a1ae6/attachment-0001.xml>


More information about the vtkusers mailing list