Catch some more CGAL exceptions which were encountered

git-svn-id: http://svn.clifford.at/openscad/trunk@564 b57f626f-c46c-0410-a088-ec61d464b74c
stl_dim
kintel 2010-06-27 01:34:46 +00:00
parent 7ecdd8e75e
commit 2a793422ca
3 changed files with 29 additions and 5 deletions

View File

@ -30,6 +30,8 @@
#include "printutils.h"
#ifdef ENABLE_CGAL
# include "cgal.h"
# include <CGAL/assertions_behaviour.h>
# include <CGAL/exceptions.h>
#endif
enum csg_type_e {
@ -82,8 +84,10 @@ CGAL_Nef_polyhedron CsgNode::render_cgal_nef_polyhedron() const
print_messages_push();
CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
bool first = true;
CGAL_Nef_polyhedron N;
try {
foreach (AbstractNode *v, children) {
if (v->modinst->tag_background)
continue;
@ -110,8 +114,13 @@ CGAL_Nef_polyhedron CsgNode::render_cgal_nef_polyhedron() const
}
v->progress_report();
}
cgal_nef_cache.insert(cache_id, new cgal_nef_cache_entry(N), N.weight());
}
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);
print_messages_pop();
progress_report();

View File

@ -667,6 +667,7 @@ CGAL_Nef_polyhedron PolySet::render_cgal_nef_polyhedron() const
CGAL::set_error_behaviour(old_behaviour);
return CGAL_Nef_polyhedron();
}
CGAL::set_error_behaviour(old_behaviour);
}
return CGAL_Nef_polyhedron();
}

View File

@ -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)
{