1 #include "MeshWriter.h"
2 #include <cpPlugins/Interface/Mesh.h>
4 #include <vtkSmartPointer.h>
5 #include <vtkPolyData.h>
6 #include <vtkPolyDataWriter.h>
8 // -------------------------------------------------------------------------
9 cpPlugins::IO::MeshWriter::
13 this->_AddInput( "Input" );
15 this->m_Parameters->ConfigureAsString( "FileName", "" );
18 // -------------------------------------------------------------------------
19 cpPlugins::IO::MeshWriter::
24 // -------------------------------------------------------------------------
25 std::string cpPlugins::IO::MeshWriter::
28 cpPlugins::Interface::Mesh* mesh =
29 this->GetInput< cpPlugins::Interface::Mesh >( "Input" );
31 return( "MeshWriter: No input mesh." );
32 vtkPolyData* i = mesh->GetVTK< vtkPolyData >( );
34 return( "MeshWriter: No suitable input." );
35 std::string fname = this->m_Parameters->GetString( "FileName" );
37 vtkPolyDataWriter* pdw = this->_CreateVTK< vtkPolyDataWriter >( );
38 pdw->SetInputData( i );
39 pdw->SetFileName( fname.c_str( ) );
41 if( pdw->GetErrorCode( ) != 0 )
42 return( "MeshWriter: someting wrong happened." );