diff --git a/converters/src/DXFToGLTF.cpp b/converters/src/DXFToGLTF.cpp index 5011847..dca6c04 100644 --- a/converters/src/DXFToGLTF.cpp +++ b/converters/src/DXFToGLTF.cpp @@ -5,6 +5,7 @@ #include "occ/MainDocument.hpp" #include "occ/Triangulation.hpp" #include "utils/utils.hpp" +#include #include #define TINYGLTF_IMPLEMENTATION @@ -13,8 +14,6 @@ #include -// TODO export BRep, Gmsh can not read DXF - /** * DXFToGLTF * @param argc @@ -25,15 +24,17 @@ int main(int argc, char **argv) { bool res; std::string dxfFile; std::string gltfFile; + std::string brepFile; // Input arguments - if (argc < 3) { + if (argc < 4) { Logger::ERROR("USAGE:"); - Logger::ERROR("DXFToGLTF dxfFile glftFile"); + Logger::ERROR("DXFToGLTF dxfFile glftFile brepFile"); return EXIT_FAILURE; } dxfFile = argv[1]; gltfFile = argv[2]; + brepFile = argv[3]; // Converter auto converter = std::make_unique(); @@ -281,7 +282,7 @@ int main(int argc, char **argv) { edgesExtras.push_back( tinygltf::Value({{"name", tinygltf::Value(mesh.name)}, {"uuid", tinygltf::Value(uuid)}, - {"label", tinygltf::Value((int)nFaces)}})); + {"label", tinygltf::Value((int)nEdges)}})); // Node node.mesh = model.meshes.size() - 1; @@ -332,5 +333,8 @@ int main(int argc, char **argv) { return EXIT_FAILURE; } + // BRep + BRepTools::Write(compound, brepFile.c_str()); + return EXIT_SUCCESS; } diff --git a/converters/src/StepToGLTF.cpp b/converters/src/StepToGLTF.cpp index edacc2c..96c4f33 100644 --- a/converters/src/StepToGLTF.cpp +++ b/converters/src/StepToGLTF.cpp @@ -4,6 +4,7 @@ #include "occ/StepReader.hpp" #include "occ/Triangulation.hpp" #include "utils/utils.hpp" +#include #include #define TINYGLTF_IMPLEMENTATION @@ -22,15 +23,17 @@ int main(int argc, char *argv[]) { bool res; std::string stepFile; std::string gltfFile; + std::string brepFile; // Arguments - if (argc < 3) { + if (argc < 4) { Logger::ERROR("USAGE:"); - Logger::ERROR("StepToGLTF stepFile gltfFile"); + Logger::ERROR("StepToGLTF stepFile gltfFile brepFile"); return EXIT_FAILURE; } stepFile = argv[1]; gltfFile = argv[2]; + brepFile = argv[3]; // Read step file auto reader = StepReader(stepFile); @@ -247,5 +250,8 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } + // BRep + BRepTools::Write(compound, brepFile.c_str()); + return EXIT_SUCCESS; }