diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc index 6ff1e359..8e08e196 100644 --- a/src/PolySetCGALEvaluator.cc +++ b/src/PolySetCGALEvaluator.cc @@ -176,10 +176,16 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) } catch (const CGAL::Failure_exception &e) { PRINTB("CGAL error in projection node during bigbox intersection: %s", e.what()); - sum.p3.reset( new CGAL_Nef_polyhedron3() ); + sum.p3->clear(); } } + if ( sum.p3->is_empty() ) { + CGAL::set_error_behaviour(old_behaviour); + PRINT("WARNING: projection() failed."); + return NULL; + } + // remove z coordinates to make CGAL_Nef_polyhedron2 log << OpenSCAD::svg_header( 480, 100000 ) << "\n"; try { @@ -206,11 +212,6 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) CGAL::set_error_behaviour(old_behaviour); - if ( sum.p3->is_empty() ) { - PRINT("WARNING: projection() failed."); - return NULL; - } - // Extract polygons in the XY plane, ignoring all other polygons // FIXME: If the polyhedron is really thin, there might be unwanted polygons // in the XY plane, causing the resulting 2D polygon to be self-intersection