Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sgarnotel committed Jun 3, 2022
1 parent 1abb47b commit 89acdd9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
14 changes: 9 additions & 5 deletions converters/src/DXFToGLTF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "occ/MainDocument.hpp"
#include "occ/Triangulation.hpp"
#include "utils/utils.hpp"
#include <BRepTools.hxx>
#include <TopExp_Explorer.hxx>

#define TINYGLTF_IMPLEMENTATION
Expand All @@ -13,8 +14,6 @@

#include <tiny_gltf.h>

// TODO export BRep, Gmsh can not read DXF

/**
* DXFToGLTF
* @param argc
Expand All @@ -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<DXFConverter>();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -332,5 +333,8 @@ int main(int argc, char **argv) {
return EXIT_FAILURE;
}

// BRep
BRepTools::Write(compound, brepFile.c_str());

return EXIT_SUCCESS;
}
10 changes: 8 additions & 2 deletions converters/src/StepToGLTF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "occ/StepReader.hpp"
#include "occ/Triangulation.hpp"
#include "utils/utils.hpp"
#include <BRepTools.hxx>
#include <TopExp_Explorer.hxx>

#define TINYGLTF_IMPLEMENTATION
Expand All @@ -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);
Expand Down Expand Up @@ -247,5 +250,8 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}

// BRep
BRepTools::Write(compound, brepFile.c_str());

return EXIT_SUCCESS;
}

0 comments on commit 89acdd9

Please sign in to comment.