Skip to content

Commit

Permalink
Created method to convert step or iges files into TopoDS_Shape
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth Gaikwad authored and Siddharth Gaikwad committed Feb 12, 2024
1 parent b047c34 commit c6cbb7c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions backend/src/determine_file_type.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

#include <iostream>
#include <string>
#include <TopoDS_Shape.hxx>
#include <filesystem>
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.");
}
}

0 comments on commit c6cbb7c

Please sign in to comment.