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->SetNumberOfInputs( 1 );
15 using namespace cpPlugins::Interface;
16 this->m_DefaultParameters.Configure( Parameters::String, "FileName" );
17 this->m_Parameters = this->m_DefaultParameters;
20 // -------------------------------------------------------------------------
21 cpPlugins::IO::MeshWriter::
26 // -------------------------------------------------------------------------
27 std::string cpPlugins::IO::MeshWriter::
30 cpPlugins::Interface::Mesh* mesh =
31 this->GetInput< cpPlugins::Interface::Mesh >( 0 );
33 return( "MeshWriter: No input mesh." );
34 vtkPolyData* i = mesh->GetVTK< vtkPolyData >( );
36 return( "MeshWriter: No suitable input." );
37 std::string fname = this->m_Parameters.GetValueAsString( "FileName" );
39 vtkPolyDataWriter* pdw = this->_CreateVTK< vtkPolyDataWriter >( );
40 pdw->SetInputData( i );
41 pdw->SetFileName( fname.c_str( ) );
43 if( pdw->GetErrorCode( ) != 0 )
44 return( "MeshWriter: someting wrong happened." );