feat: add offline Qt6 naming prerequisites and boundary gates
This commit is contained in:
34
native/freecad-naming-probe/probe.cpp
Normal file
34
native/freecad-naming-probe/probe.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#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);
|
||||
}
|
||||
Reference in New Issue
Block a user