From 540f79394061e35a50fed596ee34aec28ab2bf71 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 13 Jan 2021 15:46:00 +0100 Subject: [PATCH] Workaround: IfcLine as segment with IfcVector magnitude length in composite curve --- src/ifcgeom/IfcGeomWires.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/ifcgeom/IfcGeomWires.cpp b/src/ifcgeom/IfcGeomWires.cpp index 4274295526..8e5c9b3730 100644 --- a/src/ifcgeom/IfcGeomWires.cpp +++ b/src/ifcgeom/IfcGeomWires.cpp @@ -383,14 +383,24 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wire // ParentCurve: The *bounded curve* which defines the geometry of the segment. // At least let's exclude IfcLine as an infinite linear segment // definitely does not make any sense. - if (curve->as()) { - Logger::Warning("IfcLine not allowed as ParentCurve of segment", *it); - continue; - } - TopoDS_Wire segment; - if (!convert_wire(curve, segment)) { + if (curve->as()) { + Logger::Notice("Infinite IfcLine used as ParentCurve of segment, treating as a segment", *it); + Handle_Geom_Curve handle; + convert_curve(curve, handle); + double u0 = 0.0; + double u1 = curve->as()->Dir()->Magnitude() * getValue(GV_LENGTH_UNIT); + if (u1 < getValue(GV_PRECISION)) { + Logger::Warning("Segment length below tolerance", *it); + } + BRepBuilderAPI_MakeEdge me(handle, u0, u1); + if (me.IsDone()) { + BRep_Builder B; + B.MakeWire(segment); + B.Add(segment, me.Edge()); + } + } else if (!convert_wire(curve, segment)) { const bool failed_on_purpose = curve->as() && !segment.IsNull(); Logger::Message(failed_on_purpose ? Logger::LOG_WARNING : Logger::LOG_ERROR, "Failed to convert curve:", curve); continue;