Skip to content

Commit

Permalink
Improvement in alignment parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
QuimMoya committed Jul 12, 2024
1 parent f154577 commit 1e4f8fb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
8 changes: 6 additions & 2 deletions examples/viewer/web-ifc-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down
21 changes: 21 additions & 0 deletions src/cpp/geometry/IfcGeometryLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions src/cpp/web-ifc-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1e4f8fb

Please sign in to comment.