@@ -125,7 +125,7 @@ bool IfcGeom::convert(const Ifc2x3::IfcPolygonalBoundedHalfSpace::ptr l, TopoDS_
125125 TopoDS_Shape halfspace;
126126 if ( ! IfcGeom::convert (reinterpret_pointer_cast<Ifc2x3::IfcPolygonalBoundedHalfSpace,Ifc2x3::IfcHalfSpaceSolid>(l),halfspace) ) return false ;
127127 TopoDS_Wire wire;
128- if ( ! IfcGeom::convert_wire (l->PolygonalBoundary (),wire) ) return false ;
128+ if ( ! IfcGeom::convert_wire (l->PolygonalBoundary (),wire) || ! wire. Closed () ) return false ;
129129 gp_Trsf trsf;
130130 convert (l->Position (),trsf);
131131 TopoDS_Shape extrusion = BRepPrimAPI_MakePrism (BRepBuilderAPI_MakeFace (wire),gp_Vec (0 ,0 ,20000.0 ));
@@ -150,20 +150,30 @@ bool IfcGeom::convert(const Ifc2x3::IfcShellBasedSurfaceModel::ptr l, TopoDS_Sha
150150}
151151bool IfcGeom::convert (const Ifc2x3::IfcBooleanClippingResult::ptr l, TopoDS_Shape& shape) {
152152 TopoDS_Shape s1, s2;
153+
153154 if ( ! IfcGeom::convert_shape (l->FirstOperand (),s1) )
154155 return false ;
155- if ( ! IfcGeom::convert_shape (l->SecondOperand (),s2) )
156- return false ;
156+
157+ const float first_operand_volume = shape_volume (s1);
158+ if ( first_operand_volume <= ALMOST_ZERO )
159+ Ifc::LogMessage (" warning" ," Empty solid for:" ,l->FirstOperand ()->entity );
160+
161+ if ( ! IfcGeom::convert_shape (l->SecondOperand (),s2) ) {
162+ shape = s1;
163+ Ifc::LogMessage (" Error" ," Failed to convert SecondOperand of:" ,l->SecondOperand ()->entity );
164+ return true ;
165+ }
166+
167+ const float second_operand_volume = shape_volume (s2);
168+ if ( second_operand_volume <= ALMOST_ZERO )
169+ Ifc::LogMessage (" warning" ," Empty solid for:" ,l->SecondOperand ()->entity );
170+
157171 shape = BRepAlgoAPI_Cut (s1,s2);
158- return true ;
159- }
160- bool IfcGeom::convert (const Ifc2x3::IfcClosedShell::ptr l, TopoDS_Shape& shape) {
161- if ( ! IfcGeom::convert ((Ifc2x3::IfcConnectedFaceSet::ptr)l,shape) ) return false ;
162- try {
163- ShapeFix_Solid solid;
164- solid.LimitTolerance (0.01 );
165- shape = solid.SolidFromShell (TopoDS::Shell (shape));
166- } catch (...) {}
172+
173+ const float volume_after_subtraction = shape_volume (shape);
174+ if ( ALMOST_THE_SAME (first_operand_volume,volume_after_subtraction) )
175+ Ifc::LogMessage (" warning" ," Warning subtraction yields unchanged volume:" ,l->entity );
176+
167177 return true ;
168178}
169179bool IfcGeom::convert (const Ifc2x3::IfcConnectedFaceSet::ptr l, TopoDS_Shape& shape) {
@@ -183,6 +193,11 @@ bool IfcGeom::convert(const Ifc2x3::IfcConnectedFaceSet::ptr l, TopoDS_Shape& sh
183193 if ( ! facesAdded ) return false ;
184194 builder.Perform ();
185195 shape = builder.SewedShape ();
196+ try {
197+ ShapeFix_Solid solid;
198+ solid.LimitTolerance (0.01 );
199+ shape = solid.SolidFromShell (TopoDS::Shell (shape));
200+ } catch (...) {}
186201 return true ;
187202}
188203bool IfcGeom::convert (const Ifc2x3::IfcMappedItem::ptr l, TopoDS_Shape& shape) {
0 commit comments