Replaced eval { die } construct with a bool return value indicating
success or failure of an automatic arrangement of parts on the print bed.

Don't know exactly what is happening here, but throwing a "die" inside
a XS function and then catching it inside an eval {} block is suspcious.
This commit is contained in:
bubnikv 2016-11-04 15:03:51 +01:00
parent 3fc57ba8d8
commit 6217622865
7 changed files with 35 additions and 20 deletions

View file

@ -9,7 +9,12 @@
%package{Slic3r::Geometry};
Pointfs arrange(size_t total_parts, Pointf* part, coordf_t dist, BoundingBoxf* bb = NULL)
%code{% RETVAL = Slic3r::Geometry::arrange(total_parts, *part, dist, bb); %};
%code{%
Pointfs points;
if (! Slic3r::Geometry::arrange(total_parts, *part, dist, bb, points))
CONFESS(PRINTF_ZU " parts won't fit in your print area!\n", total_parts);
RETVAL = points;
%};
%{

View file

@ -66,8 +66,7 @@
ModelObjectPtrs* objects()
%code%{ RETVAL = &THIS->objects; %};
Pointfs _arrange(Pointfs sizes, double dist, BoundingBoxf* bb = NULL);
void arrange_objects(double dist, BoundingBoxf* bb = NULL);
bool arrange_objects(double dist, BoundingBoxf* bb = NULL);
void duplicate(unsigned int copies_num, double dist, BoundingBoxf* bb = NULL);
void duplicate_objects(unsigned int copies_num, double dist, BoundingBoxf* bb = NULL);
void duplicate_objects_grid(unsigned int x, unsigned int y, double dist);