From 2540f2a3bb4fe7f06406bcb78c53d3d05917367f Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Wed, 14 Mar 2018 07:46:27 +0100 Subject: [PATCH] FEM: mesh export, fix init file and better output --- src/Mod/Fem/App/FemMesh.cpp | 18 ++++++++++++------ src/Mod/Fem/Init.py | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/Mod/Fem/App/FemMesh.cpp b/src/Mod/Fem/App/FemMesh.cpp index 6b3be94a9a..bbcfe1a741 100644 --- a/src/Mod/Fem/App/FemMesh.cpp +++ b/src/Mod/Fem/App/FemMesh.cpp @@ -1570,21 +1570,26 @@ void FemMesh::write(const char *FileName) const Base::FileInfo File(FileName); if (File.hasExtension("unv") ) { - // read UNV file - myMesh->ExportUNV(File.filePath().c_str()); + Base::Console().Message("The selected FEM mesh object will be exported to unv format.\n"); + // write UNV file + myMesh->ExportUNV(File.filePath().c_str()); } else if (File.hasExtension("med") ) { - myMesh->ExportMED(File.filePath().c_str(),File.fileNamePure().c_str(),false,2); // 2 means MED_V2_2 version ! + Base::Console().Message("The selected FEM mesh object will be exported to med format.\n"); + myMesh->ExportMED(File.filePath().c_str(),File.fileNamePure().c_str(),false,2); // 2 means MED_V2_2 version ! } else if (File.hasExtension("stl") ) { - // read brep-file + Base::Console().Message("The selected FEM mesh object will be exported to stl format.\n"); + // export to stl file myMesh->ExportSTL(File.filePath().c_str(),false); } else if (File.hasExtension("dat") ) { - // read brep-file + Base::Console().Message("The selected FEM mesh object will be exported to dat format.\n"); + // export to dat file myMesh->ExportDAT(File.filePath().c_str()); } else if (File.hasExtension("inp") ) { + Base::Console().Message("The selected FEM mesh object will be exported to inp format.\n"); // get Abaqus inp prefs ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem/Abaqus"); int elemParam = hGrp->GetInt("AbaqusElementChoice", 1); @@ -1594,12 +1599,13 @@ void FemMesh::write(const char *FileName) const } #ifdef FC_USE_VTK else if (File.hasExtension("vtk") || File.hasExtension("vtu") ) { + Base::Console().Message("The selected FEM mesh object will be exported to either vtk or vtu format.\n"); // write unstructure mesh to VTK format *.vtk and *.vtu FemVTKTools::writeVTKMesh(File.filePath().c_str(), this); } #endif else{ - throw Base::Exception("Unknown extension"); + throw Base::Exception("An unknown file extension was added!"); } } diff --git a/src/Mod/Fem/Init.py b/src/Mod/Fem/Init.py index e84bcf6609..53bac65a47 100644 --- a/src/Mod/Fem/Init.py +++ b/src/Mod/Fem/Init.py @@ -31,7 +31,7 @@ import FreeCAD FreeCAD.addExportType("FEM mesh TetGen (*.poly)", "feminout.convert2TetGen") FreeCAD.addImportType("FEM mesh formats (*.unv *.med *.dat *.bdf)", "Fem") -FreeCAD.addExportType("FEM mesh formats (*.unv *.med *.dat *.inp)", "Fem") +FreeCAD.addExportType("FEM mesh formats (*.unv *.med *.stl *.dat *.inp *.vtk *.vtu)", "Fem") FreeCAD.addImportType("FEM mesh CalculiX/Abaqus (*.inp)", "feminout.importInpMesh") FreeCAD.addImportType("FEM result CalculiX (*.frd)", "feminout.importCcxFrdResults")