diff options
author | kintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-06-27 01:34:46 (GMT) |
---|---|---|
committer | kintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-06-27 01:34:46 (GMT) |
commit | 2a793422cad6215100c2ab0aff515bb5e9a11d69 (patch) | |
tree | cc97ae8d98d9179c42a2ec0e61e56e46d155460a /src/projection.cc | |
parent | 7ecdd8e75eb5a994c620e242ee6a9a4cc5e04b57 (diff) |
Catch some more CGAL exceptions which were encountered
git-svn-id: http://svn.clifford.at/openscad/trunk@564 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'src/projection.cc')
-rw-r--r-- | src/projection.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/projection.cc b/src/projection.cc index 1fb036c..7a3f77a 100644 --- a/src/projection.cc +++ b/src/projection.cc @@ -34,6 +34,11 @@ #include "export.h" #include "progress.h" +#ifdef ENABLE_CGAL +# include <CGAL/assertions_behaviour.h> +# include <CGAL/exceptions.h> +#endif + #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> @@ -106,17 +111,26 @@ PolySet *ProjectionNode::render_polyset(render_mode_e) const print_messages_push(); + PolySet *ps = new PolySet(); + ps->convexity = this->convexity; + ps->is2d = true; + CGAL_Nef_polyhedron N; N.dim = 3; + CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION); + try { foreach(AbstractNode *v, this->children) { if (v->modinst->tag_background) continue; N.p3 += v->render_cgal_nef_polyhedron().p3; } - - PolySet *ps = new PolySet(); - ps->convexity = this->convexity; - ps->is2d = true; + } + catch (CGAL::Assertion_exception e) { + PRINTF("ERROR: Illegal polygonal object - make sure all polygons are defined with the same winding order. Skipping affected object."); + CGAL::set_error_behaviour(old_behaviour); + return ps; + } + CGAL::set_error_behaviour(old_behaviour); if (cut_mode) { |