Skip to content

Commit 1e4f8fb

Browse files
committed
Improvement in alignment parsing
1 parent f154577 commit 1e4f8fb

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

examples/viewer/web-ifc-viewer.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,16 @@ async function LoadModel(data: Uint8Array) {
178178
}
179179
}
180180

181-
if( ifcAPI.GetModelSchema(modelID) == 'IFC4X3_RC4')
181+
try
182182
{
183183
// This function should activate only if we are in IFC4X3
184184
let alignments = await ifcAPI.GetAllAlignments(modelID);
185-
//console.log("Alignments: ", alignments);
185+
console.log("Alignments: ", alignments);
186+
} catch (error) {
187+
// Code to handle the error
188+
console.error("An error occurred:", error);
186189
}
190+
187191
let lines = ifcAPI.GetLineIDsWithType(modelID, IFCUNITASSIGNMENT);
188192
//console.log(lines.size());
189193
for(let l = 0; l < lines.size(); l++)

src/cpp/geometry/IfcGeometryLoader.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ namespace webifc::geometry
300300
spdlog::debug("[GetAlignment({})]",expressID);
301301
auto lineType = _loader.GetLineType(expressID);
302302

303+
// TODO: Add support for IFCREFERENT
304+
303305
switch (lineType)
304306
{
305307
case schema::IFCALIGNMENT:
@@ -431,6 +433,25 @@ namespace webifc::geometry
431433
}
432434
}
433435

436+
auto &relNestVector = GetRelNests();
437+
if (relNestVector.count(expressID) == 1)
438+
{
439+
auto &relNest = relNestVector.at(expressID);
440+
for (auto expressID : relNest)
441+
{
442+
alignment.Vertical.curves.push_back(GetAlignmentCurve(expressID, sourceExpressID));
443+
}
444+
445+
for (size_t i = 0; i < alignment.Vertical.curves.size(); i++)
446+
{
447+
for (size_t j = 0; j < alignment.Vertical.curves[i].points.size(); j++)
448+
{
449+
alignment.Vertical.curves[i].points[j] =
450+
glm::dvec4(alignment.Vertical.curves[i].points[j].x, alignment.Vertical.curves[i].points[j].y, 0, 1) * transform * transform_t;
451+
}
452+
}
453+
}
454+
434455
break;
435456
}
436457
default:

src/cpp/web-ifc-test.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ int main()
286286

287287
// std::string content = ReadFile("C:/Users/qmoya/Desktop/rac_advanced_sample_project.ifc");
288288
// std::string content = ReadFile("C:/Users/qmoya/Desktop/Element3D 1_modif.ifc");
289-
std::string content = ReadFile("C:/Users/qmoya/Desktop/ISSUE_126_model.ifc");
289+
// std::string content = ReadFile("C:/Users/qmoya/Desktop/ISSUE_126_model.ifc");
290+
std::string content = ReadFile("C:/Users/qmoya/Desktop/cono.ifc");
290291

291292
struct LoaderSettings
292293
{
@@ -327,7 +328,7 @@ int main()
327328

328329
// SpecificLoadTest(loader, geometryLoader, 1179353);
329330
// SpecificLoadTest(loader, geometryLoader, 17);
330-
SpecificLoadTest(loader, geometryLoader, 1221);
331+
// SpecificLoadTest(loader, geometryLoader, 1221);
331332

332333
// auto meshes = LoadAllTest(loader, geometryLoader, 5557);
333334
auto alignments = GetAlignments(loader, geometryLoader);

0 commit comments

Comments
 (0)