diff --git a/backend/src/determine_file_type.cpp b/backend/src/determine_file_type.cpp new file mode 100644 index 0000000..cc582b1 --- /dev/null +++ b/backend/src/determine_file_type.cpp @@ -0,0 +1,20 @@ + +#include +#include +#include +#include +using namespace std; + +TopoDS_Shape convert_file(const string filepath) { + filesystem::path p(filepath); + string extension = p.extension().string().tolower(); + if (extension == ".iges" || extension == ".igs") { + TopoDS_Shape shape = read_iges(filepath.c_str()); + return shape; + } else if (extension == ".step" || extension == ".stp") { + TopoDS_Shape shape = read_step(filepath.c_str()); + return shape; + } else { + throw std::runtime_error("Error: File type not supported."); + } +} \ No newline at end of file