Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble trying to output file using vtkOBJWriter
    text
    copied!<p>I am trying to use vtkOBJWriter from David Doria to convert a .vtk file to a .obj file. I git cloned from <a href="https://github.com/daviddoria/vtkOBJWriter" rel="nofollow">https://github.com/daviddoria/vtkOBJWriter</a>, added a build directory for the CMake and make, and altered the file vtkOBJWriterExample.cxx to:</p> <pre><code>#include &lt;vtkSmartPointer.h&gt; #include &lt;vtkPolyData.h&gt; #include &lt;vtkSphereSource.h&gt; #include &lt;vtkPolyDataReader.h&gt; #include "vtkOBJWriter.h" int main (int argc, char *argv[]) { vtkSmartPointer&lt;vtkPolyData&gt; input; std::string outputFilename; // Verify command line arguments if(argc &gt; 1) // Use the command line arguments { if(argc != 3) { std::cout &lt;&lt; "Required arguments: InputFilename.vtp OutputFilename.obj" &lt;&lt; std::endl; return EXIT_FAILURE; } vtkSmartPointer&lt;vtkPolyDataReader&gt; reader = vtkSmartPointer&lt;vtkPolyDataReader&gt;::New(); reader-&gt;SetFileName(argv[1]); reader-&gt;Update(); input = reader-&gt;GetOutput(); outputFilename = argv[2]; } else { outputFilename = "output.obj"; vtkSmartPointer&lt;vtkSphereSource&gt; sphereSource = vtkSmartPointer&lt;vtkSphereSource&gt;::New(); sphereSource-&gt;Update(); input-&gt;ShallowCopy(sphereSource-&gt;GetOutput()); } vtkSmartPointer&lt;vtkOBJWriter&gt; writer = vtkSmartPointer&lt;vtkOBJWriter&gt;::New(); writer-&gt;SetInput(input); writer-&gt;SetFileName(outputFilename.c_str()); writer-&gt;Update(); return EXIT_SUCCESS; } </code></pre> <p>to reflect that I am using VTK 5.8.0 . When I try to do sudo ./vtkOBJWriterExample trytry1.vtk Documents/comeOn.obj , no output file is made (I don't see it in the appropriate directory). I also tried it with trytry1.vtp, and it didn't seem to work. My vtk file format is :</p> <pre><code># vtk DataFile Version 3.0 vtk output ASCII DATASET POLYDATA FIELD FieldData 3 group_id 1 1 int 0 base_index 1 3 int 0 0 0 avtOriginalBounds 1 6 double -10 10 -10 10 -10 10 POINTS 14387 float -5.10204 -2.65306 -9.69246 -5.10204 -2.75294 -9.59184 -5.37199 -2.65306 -9.59184 ... POLYGONS 28256 113024 3 0 1 2 ... POINT_DATA 14387 SCALARS hardyglobal float LOOKUP_TABLE default 3.4926 3.4926 3.4926 3.4926 3.4926 3.4926 3.4926 3.4926 3.4926 ... </code></pre> <p>which doesn't seem to match the formatting of car.vtp in the data directory, but I thought I made the appropriate changes (using the formatting of vtkPolyDataReader.h instead of vtkXMLPolyDataReader.h ). I am not sure why there is no file being outputted.</p> <p>I do not receive any error messages.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload