diff --git a/src/cpp/web-ifc-wasm.cpp b/src/cpp/web-ifc-wasm.cpp index 7336f022..2a88172e 100644 --- a/src/cpp/web-ifc-wasm.cpp +++ b/src/cpp/web-ifc-wasm.cpp @@ -96,6 +96,23 @@ void StreamMeshes(uint32_t modelID, const std::vector & expressIds, em } } +void StreamMeshesWithExpressID(uint32_t modelID, emscripten::val expressIdsVal, emscripten::val callback) +{ + std::vector expressIds; + + uint32_t size = expressIdsVal["length"].as(); + for (size_t i=0; i < size; i++) + { + emscripten::val expressIdVal = expressIdsVal[std::to_string(i)]; + + uint32_t expressId = expressIdVal.as(); + + expressIds.push_back(expressId); + } + + StreamMeshes(modelID, expressIds, callback); +} + void StreamAllMeshesWithTypes(uint32_t modelID, const std::vector& types, emscripten::val callback) { if (!manager.IsModelOpen(modelID)) return; @@ -795,6 +812,7 @@ EMSCRIPTEN_BINDINGS(my_module) { emscripten::function("GetGeometry", &GetGeometry); emscripten::function("GetFlatMesh", &GetFlatMesh); emscripten::function("GetCoordinationMatrix", &GetCoordinationMatrix); + emscripten::function("StreamMeshes", &StreamMeshesWithExpressID); emscripten::function("StreamAllMeshes", &StreamAllMeshes); emscripten::function("StreamAllMeshesWithTypes", &StreamAllMeshesWithTypesVal); emscripten::function("GetLine", &GetLine);