From 9a99f850262d092ce50f64352c15049b4c60e2f5 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 17 Mar 2020 11:55:54 +0100 Subject: [PATCH] IfcCraneRailAShapeProfileDef for better or worse --- src/ifcgeom/IfcGeomFaces.cpp | 43 ++++++++++++++++++++++++++++++++++++ src/ifcgeom/IfcRegister.h | 4 ++++ 2 files changed, 47 insertions(+) diff --git a/src/ifcgeom/IfcGeomFaces.cpp b/src/ifcgeom/IfcGeomFaces.cpp index 5683dd9d7e..512a749ac5 100644 --- a/src/ifcgeom/IfcGeomFaces.cpp +++ b/src/ifcgeom/IfcGeomFaces.cpp @@ -968,6 +968,49 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcCircleProfileDef* l, TopoDS_Sh return success; } +#ifdef SCHEMA_HAS_IfcCraneRailAShapeProfileDef +bool IfcGeom::Kernel::convert(const IfcSchema::IfcCraneRailAShapeProfileDef* l, TopoDS_Shape& face) { + double oh = l->OverallHeight() * getValue(GV_LENGTH_UNIT); + double bw2 = l->BaseWidth2() * getValue(GV_LENGTH_UNIT); + double hw = l->HeadWidth() * getValue(GV_LENGTH_UNIT); + double hd2 = l->HeadDepth2() * getValue(GV_LENGTH_UNIT); + double hd3 = l->HeadDepth3() * getValue(GV_LENGTH_UNIT); + double wt = l->WebThickness() * getValue(GV_LENGTH_UNIT); + double bw4 = l->BaseWidth4() * getValue(GV_LENGTH_UNIT); + double bd1 = l->BaseDepth1() * getValue(GV_LENGTH_UNIT); + double bd2 = l->BaseDepth2() * getValue(GV_LENGTH_UNIT); + double bd3 = l->BaseDepth3() * getValue(GV_LENGTH_UNIT); + + gp_Trsf2d trsf2d; + bool has_position = true; +#ifdef SCHEMA_IfcParameterizedProfileDef_Position_IS_OPTIONAL + has_position = l->hasPosition(); +#endif + if (has_position) { + IfcGeom::Kernel::convert(l->Position(), trsf2d); + } + + double coords[28] = { + -hw / 2., +oh / 2., + -hw / 2., +oh / 2. - hd3, + -wt / 2., +oh / 2. - hd2, + -wt / 2., -oh / 2. + bd2, + -bw4 / 2., -oh / 2. + bd3, + -bw2 / 2., -oh / 2. + bd1, + -bw2 / 2., -oh / 2., + +bw2 / 2., -oh / 2., + +bw2 / 2., -oh / 2. + bd1, + +bw4 / 2., -oh / 2. + bd3, + +wt / 2., -oh / 2. + bd2, + +wt / 2., +oh / 2. - hd2, + +hw / 2., +oh / 2. - hd3, + +hw / 2., +oh / 2. + }; + + return profile_helper(14, coords, 0, 0, 0, trsf2d, face); +} +#endif + bool IfcGeom::Kernel::convert(const IfcSchema::IfcCircleHollowProfileDef* l, TopoDS_Shape& face) { const double r = l->Radius() * getValue(GV_LENGTH_UNIT); const double t = l->WallThickness() * getValue(GV_LENGTH_UNIT); diff --git a/src/ifcgeom/IfcRegister.h b/src/ifcgeom/IfcRegister.h index 63cf4aef26..13f4845881 100644 --- a/src/ifcgeom/IfcRegister.h +++ b/src/ifcgeom/IfcRegister.h @@ -121,6 +121,10 @@ FACE(IfcDerivedProfileDef); // IfcAdvancedFace included in case of IFC4 FACE(IfcFace); +#ifdef SCHEMA_HAS_IfcCraneRailAShapeProfileDef +FACE(IfcCraneRailAShapeProfileDef); +#endif + WIRE(IfcEdgeCurve); WIRE(IfcSubedge); WIRE(IfcOrientedEdge);