From 0e6962c311541695a62795ee2ffa6cab62c13881 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sat, 7 Aug 2021 11:23:41 +0200 Subject: [PATCH] further optional type changes --- src/ifcgeom/IfcGeomShapes.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ifcgeom/IfcGeomShapes.cpp b/src/ifcgeom/IfcGeomShapes.cpp index f7c0a05693..b44f830ffa 100644 --- a/src/ifcgeom/IfcGeomShapes.cpp +++ b/src/ifcgeom/IfcGeomShapes.cpp @@ -1531,8 +1531,18 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcSweptDiskSolid* l, TopoDS_Shap if (!convert_wire(l->Directrix(), wire)) { return false; } + + // Start- EndParam became optional in IFC4 +#ifdef SCHEMA_IfcSweptDiskSolid_StartParam_IS_OPTIONAL + auto sp = l->StartParam(); + auto ep = l->EndParam(); +#else + boost::optional sp, ep; + sp = l->StartParam(); + ep = l->EndParam(); +#endif - if (count(wire, TopAbs_EDGE) == 1) { + if (count(wire, TopAbs_EDGE) == 1 && sp && ep) { TopoDS_Vertex v0, v1; TopExp::Vertices(wire, v0, v1); if (v0.IsSame(v1)) { @@ -1543,7 +1553,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcSweptDiskSolid* l, TopoDS_Shap if ((crv->DynamicType() == STANDARD_TYPE(Geom_Circle)) || (crv->DynamicType() == STANDARD_TYPE(Geom_Ellipse))) { - BRepBuilderAPI_MakeEdge me(crv, l->StartParam(), l->EndParam()); + BRepBuilderAPI_MakeEdge me(crv, *sp, *ep); if (me.IsDone()) { auto e2 = me.Edge(); BRep_Builder B;