diff --git a/examples/viewer/web-ifc-viewer.ts b/examples/viewer/web-ifc-viewer.ts index ed041178..47394a48 100644 --- a/examples/viewer/web-ifc-viewer.ts +++ b/examples/viewer/web-ifc-viewer.ts @@ -178,12 +178,16 @@ async function LoadModel(data: Uint8Array) { } } - if( ifcAPI.GetModelSchema(modelID) == 'IFC4X3_RC4') + try { // This function should activate only if we are in IFC4X3 let alignments = await ifcAPI.GetAllAlignments(modelID); - //console.log("Alignments: ", alignments); + console.log("Alignments: ", alignments); + } catch (error) { + // Code to handle the error + console.error("An error occurred:", error); } + let lines = ifcAPI.GetLineIDsWithType(modelID, IFCUNITASSIGNMENT); //console.log(lines.size()); for(let l = 0; l < lines.size(); l++) diff --git a/src/cpp/geometry/IfcGeometryLoader.cpp b/src/cpp/geometry/IfcGeometryLoader.cpp index 8ad9cba6..78733fcd 100644 --- a/src/cpp/geometry/IfcGeometryLoader.cpp +++ b/src/cpp/geometry/IfcGeometryLoader.cpp @@ -300,6 +300,8 @@ namespace webifc::geometry spdlog::debug("[GetAlignment({})]",expressID); auto lineType = _loader.GetLineType(expressID); + // TODO: Add support for IFCREFERENT + switch (lineType) { case schema::IFCALIGNMENT: @@ -431,6 +433,25 @@ namespace webifc::geometry } } + auto &relNestVector = GetRelNests(); + if (relNestVector.count(expressID) == 1) + { + auto &relNest = relNestVector.at(expressID); + for (auto expressID : relNest) + { + alignment.Vertical.curves.push_back(GetAlignmentCurve(expressID, sourceExpressID)); + } + + for (size_t i = 0; i < alignment.Vertical.curves.size(); i++) + { + for (size_t j = 0; j < alignment.Vertical.curves[i].points.size(); j++) + { + alignment.Vertical.curves[i].points[j] = + glm::dvec4(alignment.Vertical.curves[i].points[j].x, alignment.Vertical.curves[i].points[j].y, 0, 1) * transform * transform_t; + } + } + } + break; } default: diff --git a/src/cpp/web-ifc-test.cpp b/src/cpp/web-ifc-test.cpp index 735e9482..1a0a0d7a 100644 --- a/src/cpp/web-ifc-test.cpp +++ b/src/cpp/web-ifc-test.cpp @@ -286,7 +286,8 @@ int main() // std::string content = ReadFile("C:/Users/qmoya/Desktop/rac_advanced_sample_project.ifc"); // std::string content = ReadFile("C:/Users/qmoya/Desktop/Element3D 1_modif.ifc"); - std::string content = ReadFile("C:/Users/qmoya/Desktop/ISSUE_126_model.ifc"); + // std::string content = ReadFile("C:/Users/qmoya/Desktop/ISSUE_126_model.ifc"); + std::string content = ReadFile("C:/Users/qmoya/Desktop/cono.ifc"); struct LoaderSettings { @@ -327,7 +328,7 @@ int main() // SpecificLoadTest(loader, geometryLoader, 1179353); // SpecificLoadTest(loader, geometryLoader, 17); - SpecificLoadTest(loader, geometryLoader, 1221); + // SpecificLoadTest(loader, geometryLoader, 1221); // auto meshes = LoadAllTest(loader, geometryLoader, 5557); auto alignments = GetAlignments(loader, geometryLoader);