#include "MeshWriter.h" #include #include #include #include // ------------------------------------------------------------------------- cpPlugins::IO::MeshWriter:: MeshWriter( ) : Superclass( ) { this->_AddInput( "Input", true ); this->m_Parameters->ConfigureAsSaveFileName( "FileName" ); this->m_Parameters->SetAcceptedFileExtensions( "FileName", "Mesh files (*.vtk *.stl *.obj)" ); } // ------------------------------------------------------------------------- cpPlugins::IO::MeshWriter:: ~MeshWriter( ) { } // ------------------------------------------------------------------------- std::string cpPlugins::IO::MeshWriter:: _GenerateData( ) { auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" ); if( mesh == NULL ) return( "MeshWriter: No input mesh." ); vtkPolyData* i = mesh->GetVTK< vtkPolyData >( ); if( i == NULL ) return( "MeshWriter: No suitable input." ); std::string fname = this->m_Parameters->GetSaveFileName( "FileName" ); vtkPolyDataWriter* pdw = this->_CreateVTK< vtkPolyDataWriter >( ); pdw->SetInputData( i ); pdw->SetFileName( fname.c_str( ) ); pdw->SetFileTypeToBinary( ); pdw->Update( ); if( pdw->GetErrorCode( ) != 0 ) return( "MeshWriter: someting wrong happened." ); return( "" ); } // eof - $RCSfile$