[vtkusers] Read .vtk file and save as binary STL file

Swetha Sharma swetha.bsharma at gmail.com
Mon Jul 31 04:55:20 EDT 2017


Hi kenichiro,

   Thanks for the reply. I have a problem reading the .vtk file .Below is
the code which I had used to read .vtk


vtkSmartPointer<vtkGenericDataObjectReader> reader =
      vtkSmartPointer<vtkGenericDataObjectReader>::New();
  std::cout<<"filename:"<<argv[1]<<"\n";
  reader->SetFileName(argv[1]);


  reader->Update();


 I am getting an error: error reading ascii file.possible mismatch of
datasize with declaration. How do I fix this?
-swetha

On Sat, 29 Jul 2017, 11:33 kenichiro yoshimi, <rccm.kyoshimi at gmail.com>
wrote:

> Hi Swetha,
>
> Assuming that your data is a triangle polydata set, all vtkSTLWriter
> have to do is set the file type to binary, so as to output as binary
> STL file. You don't need to call WriteBinarySTL(). Ex:
>
> vtkSmartPointer<vtkSTLWriter> stlWriter =
>   vtkSmartPointer<vtkSTLWriter>::New();
> stlWriter->SetFileName(filename.c_str());
> stlWriter->SetInputData(polyData);
> stlWriter->SetFileTypeToBinary();
> stlWriter->Write();
>
> Thanks
>
> 2017-07-27 23:40 GMT+09:00 Swetha Sharma <swetha.bsharma at gmail.com>:
> > Hi,
> >
> > I have .vtk file which i want to read and convert to binary stl file. The
> > documentation has a function
> > WriteBinarySTL (vtkPoints *pts, vtkCellArray *polys, vtkCellArray
> *strips) .
> > How do I get the information about the vtkpoints and the cellarray?
> >
> >
> >
> > -swetha
> > _______________________________________________
> > 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
> >
> > Search the list archives at: http://markmail.org/search/?q=vtkusers
> >
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170731/f96e71e6/attachment.html>


More information about the vtkusers mailing list