FEM: mesh export, fix init file and better output

This commit is contained in:
Bernd Hahnebach
2018-03-14 07:46:27 +01:00
parent 1d39db122e
commit 2540f2a3bb
2 changed files with 13 additions and 7 deletions

View File

@@ -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!");
}
}

View File

@@ -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")