[Everywhere] FileInfo::hasExtension for multiple values (#9774)

* [Base] Add hasExtension for multiple values

* [Gui] Use hasExtension for multiple values

* [Drawing] Use hasExtension for multiple values

* [Fem] Use hasExtension for multiple values

* [Import] Use hasExtension for multiple values

* [Mesh] Use hasExtension for multiple values

* [Part] Use hasExtension for multiple values

* [TechDraw] Use hasExtension for multiple values
This commit is contained in:
Benjamin Bræstrup Sayoc
2023-08-07 17:55:19 +02:00
committed by GitHub
parent 9587393ca3
commit 33384cff9c
16 changed files with 56 additions and 68 deletions

View File

@@ -1911,7 +1911,7 @@ void FemMesh::read(const char *FileName)
readNastran(File.filePath());
}
#ifdef FC_USE_VTK
else if (File.hasExtension("vtk") || File.hasExtension("vtu") || File.hasExtension("pvtu")) {
else if (File.hasExtension({"vtk", "vtu", "pvtu"})) {
// read *.vtk legacy format or *.vtu XML unstructure Mesh
FemVTKTools::readVTKMesh(File.filePath().c_str(), this);
}
@@ -2406,7 +2406,7 @@ void FemMesh::write(const char *FileName) const
writeABAQUS(File.filePath(), elemParam, groupParam);
}
#ifdef FC_USE_VTK
else if (File.hasExtension("vtk") || File.hasExtension("vtu") ) {
else if (File.hasExtension({"vtk", "vtu"})) {
Base::Console().Log("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);

View File

@@ -121,17 +121,8 @@ DocumentObjectExecReturn* FemPostPipeline::execute() {
bool FemPostPipeline::canRead(Base::FileInfo File) {
if (File.hasExtension("vtk") ||
// from FemResult only unstructural mesh is supported in femvtktoools.cpp
File.hasExtension("vtp") ||
File.hasExtension("vts") ||
File.hasExtension("vtr") ||
File.hasExtension("vti") ||
File.hasExtension("vtu") ||
File.hasExtension("pvtu"))
return true;
return false;
// from FemResult only unstructural mesh is supported in femvtktoools.cpp
return File.hasExtension({"vtk", "vtp", "vts", "vtr", "vti", "vtu", "pvtu"});
}
void FemPostPipeline::read(Base::FileInfo File) {