35 lines
958 B
C++
35 lines
958 B
C++
#include <emscripten/bind.h>
|
|
|
|
#include <App/IndexedName.h>
|
|
#include <App/MappedName.h>
|
|
|
|
#include <stdexcept>
|
|
#include <string>
|
|
|
|
namespace
|
|
{
|
|
std::string freecadPrivateNamingSourceProbe()
|
|
{
|
|
const Data::IndexedName indexed("Edge12");
|
|
if (!indexed || indexed.getIndex() != 12 || std::string(indexed.getType()) != "Edge") {
|
|
throw std::runtime_error("FreeCAD IndexedName source probe failed");
|
|
}
|
|
|
|
Data::MappedName name(indexed);
|
|
name += ";:M;CUT;:H2a:7,E";
|
|
long tag = 0;
|
|
int length = 0;
|
|
char type = 0;
|
|
const int position = name.findTagInElementName(&tag, &length, nullptr, &type);
|
|
if (position < 0 || tag != 0x2a || type != 'E') {
|
|
throw std::runtime_error("FreeCAD MappedName source probe failed");
|
|
}
|
|
return name.toString();
|
|
}
|
|
} // namespace
|
|
|
|
EMSCRIPTEN_BINDINGS(freecad_private_naming_source_probe)
|
|
{
|
|
emscripten::function("freecadPrivateNamingSourceProbe", &freecadPrivateNamingSourceProbe);
|
|
}
|