-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🦄 refactor: The development of the new OCC module has been essentiall…
…y completed
- Loading branch information
1 parent
8406a2d
commit eebf9b9
Showing
37 changed files
with
3,840 additions
and
456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <TopoDS_Shape.hxx> | ||
#include <emscripten/bind.h> | ||
#include <emscripten/val.h> | ||
#include <BRepTools.hxx> | ||
#include <BRep_Builder.hxx> | ||
|
||
using namespace emscripten; | ||
|
||
class Converter { | ||
public: | ||
static std::string convertToBrep(const TopoDS_Shape& input) { | ||
std::ostringstream oss; | ||
BRepTools::Write(input, oss); | ||
return oss.str(); | ||
} | ||
|
||
static TopoDS_Shape convertFromBrep(const std::string& input) { | ||
std::istringstream iss(input); | ||
TopoDS_Shape output; | ||
BRep_Builder builder; | ||
BRepTools::Read(output, iss, builder); | ||
return output; | ||
} | ||
|
||
}; | ||
|
||
EMSCRIPTEN_BINDINGS(Converter) | ||
{ | ||
class_<Converter>("Converter") | ||
.class_function("convertToBrep", &Converter::convertToBrep) | ||
.class_function("convertFromBrep", &Converter::convertFromBrep) | ||
; | ||
} |
Oops, something went wrong.