mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	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.
		
	
			
		
			
				
	
	
		
			111 lines
		
	
	
	
		
			2.1 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			111 lines
		
	
	
	
		
			2.1 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
%module{Slic3r::XS};
 | 
						|
 | 
						|
%{
 | 
						|
#include <xsinit.h>
 | 
						|
#include "libslic3r/Geometry.hpp"
 | 
						|
%}
 | 
						|
 | 
						|
 | 
						|
%package{Slic3r::Geometry};
 | 
						|
 | 
						|
Pointfs arrange(size_t total_parts, Pointf* part, coordf_t dist, BoundingBoxf* bb = NULL)
 | 
						|
    %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;
 | 
						|
    %};
 | 
						|
 | 
						|
%{
 | 
						|
 | 
						|
bool
 | 
						|
directions_parallel(angle1, angle2)
 | 
						|
    double      angle1
 | 
						|
    double      angle2
 | 
						|
    CODE:
 | 
						|
        RETVAL = Slic3r::Geometry::directions_parallel(angle1, angle2);
 | 
						|
    OUTPUT:
 | 
						|
        RETVAL
 | 
						|
 | 
						|
bool
 | 
						|
directions_parallel_within(angle1, angle2, max_diff)
 | 
						|
    double      angle1
 | 
						|
    double      angle2
 | 
						|
    double      max_diff
 | 
						|
    CODE:
 | 
						|
        RETVAL = Slic3r::Geometry::directions_parallel(angle1, angle2, max_diff);
 | 
						|
    OUTPUT:
 | 
						|
        RETVAL
 | 
						|
 | 
						|
Clone<Polygon>
 | 
						|
convex_hull(points)
 | 
						|
    Points      points
 | 
						|
    CODE:
 | 
						|
        RETVAL = Slic3r::Geometry::convex_hull(points);
 | 
						|
    OUTPUT:
 | 
						|
        RETVAL
 | 
						|
 | 
						|
std::vector<Points::size_type>
 | 
						|
chained_path(points)
 | 
						|
    Points      points
 | 
						|
    CODE:
 | 
						|
        Slic3r::Geometry::chained_path(points, RETVAL);
 | 
						|
    OUTPUT:
 | 
						|
        RETVAL
 | 
						|
 | 
						|
std::vector<Points::size_type>
 | 
						|
chained_path_from(points, start_from)
 | 
						|
    Points      points
 | 
						|
    Point*      start_from
 | 
						|
    CODE:
 | 
						|
        Slic3r::Geometry::chained_path(points, RETVAL, *start_from);
 | 
						|
    OUTPUT:
 | 
						|
        RETVAL
 | 
						|
 | 
						|
double
 | 
						|
rad2deg(angle)
 | 
						|
    double      angle
 | 
						|
    CODE:
 | 
						|
        RETVAL = Slic3r::Geometry::rad2deg(angle);
 | 
						|
    OUTPUT:
 | 
						|
        RETVAL
 | 
						|
 | 
						|
double
 | 
						|
rad2deg_dir(angle)
 | 
						|
    double      angle
 | 
						|
    CODE:
 | 
						|
        RETVAL = Slic3r::Geometry::rad2deg_dir(angle);
 | 
						|
    OUTPUT:
 | 
						|
        RETVAL
 | 
						|
 | 
						|
double
 | 
						|
deg2rad(angle)
 | 
						|
    double      angle
 | 
						|
    CODE:
 | 
						|
        RETVAL = Slic3r::Geometry::deg2rad(angle);
 | 
						|
    OUTPUT:
 | 
						|
        RETVAL
 | 
						|
 | 
						|
Polygons
 | 
						|
simplify_polygons(polygons, tolerance)
 | 
						|
    Polygons    polygons
 | 
						|
    double      tolerance
 | 
						|
    CODE:
 | 
						|
        Slic3r::Geometry::simplify_polygons(polygons, tolerance, &RETVAL);
 | 
						|
    OUTPUT:
 | 
						|
        RETVAL
 | 
						|
 | 
						|
 | 
						|
IV
 | 
						|
_constant()
 | 
						|
  ALIAS:
 | 
						|
    X           = X
 | 
						|
    Y           = Y
 | 
						|
    Z           = Z
 | 
						|
  PROTOTYPE:
 | 
						|
  CODE:
 | 
						|
    RETVAL = ix;
 | 
						|
  OUTPUT: RETVAL
 | 
						|
 | 
						|
%}
 | 
						|
 |