mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-21 07:41:09 -06:00
Implemented Slic3r::ExtrusionLoop
This commit is contained in:
parent
c9749ca3b3
commit
d0701cdcd4
10 changed files with 145 additions and 88 deletions
65
xs/xsp/ExtrusionLoop.xsp
Normal file
65
xs/xsp/ExtrusionLoop.xsp
Normal file
|
@ -0,0 +1,65 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <myinit.h>
|
||||
#include "ExtrusionEntity.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::ExtrusionLoop} class ExtrusionLoop {
|
||||
~ExtrusionLoop();
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = polygon2perl(THIS->polygon); %};
|
||||
Polygon* as_polygon()
|
||||
%code{% const char* CLASS = "Slic3r::Polygon::XS"; RETVAL = new Polygon(THIS->polygon); %};
|
||||
void set_polygon(SV* polygon_sv)
|
||||
%code{% perl2polygon_check(polygon_sv, THIS->polygon); %};
|
||||
%{
|
||||
|
||||
ExtrusionLoop*
|
||||
_new(CLASS, polygon_sv, role, height, flow_spacing)
|
||||
char* CLASS;
|
||||
SV* polygon_sv;
|
||||
ExtrusionRole role;
|
||||
double height;
|
||||
double flow_spacing;
|
||||
CODE:
|
||||
RETVAL = new ExtrusionLoop ();
|
||||
perl2polygon_check(polygon_sv, RETVAL->polygon);
|
||||
RETVAL->role = role;
|
||||
RETVAL->height = height;
|
||||
RETVAL->flow_spacing = flow_spacing;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
ExtrusionRole
|
||||
ExtrusionLoop::role(...)
|
||||
CODE:
|
||||
if (items > 1) {
|
||||
THIS->role = (ExtrusionRole)SvUV(ST(1));
|
||||
}
|
||||
RETVAL = THIS->role;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
double
|
||||
ExtrusionLoop::height(...)
|
||||
CODE:
|
||||
if (items > 1) {
|
||||
THIS->height = (double)SvNV(ST(1));
|
||||
}
|
||||
RETVAL = THIS->height;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
double
|
||||
ExtrusionLoop::flow_spacing(...)
|
||||
CODE:
|
||||
if (items > 1) {
|
||||
THIS->flow_spacing = (double)SvNV(ST(1));
|
||||
}
|
||||
RETVAL = THIS->flow_spacing;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
|
@ -9,6 +9,10 @@
|
|||
~ExtrusionPath();
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = polyline2perl(THIS->polyline); %};
|
||||
Polyline* as_polyline()
|
||||
%code{% const char* CLASS = "Slic3r::Polyline::XS"; RETVAL = new Polyline(THIS->polyline); %};
|
||||
void set_polyline(SV* polyline_sv)
|
||||
%code{% perl2polyline_check(polyline_sv, THIS->polyline); %};
|
||||
void pop_back()
|
||||
%code{% THIS->polyline.points.pop_back(); %};
|
||||
void reverse();
|
||||
|
@ -23,36 +27,13 @@ _new(CLASS, polyline_sv, role, height, flow_spacing)
|
|||
double flow_spacing;
|
||||
CODE:
|
||||
RETVAL = new ExtrusionPath ();
|
||||
if (sv_isobject(polyline_sv) && (SvTYPE(SvRV(polyline_sv)) == SVt_PVMG)) {
|
||||
RETVAL->polyline = *(Polyline*)SvIV((SV*)SvRV( polyline_sv ));
|
||||
} else {
|
||||
perl2polyline(polyline_sv, RETVAL->polyline);
|
||||
}
|
||||
perl2polyline_check(polyline_sv, RETVAL->polyline);
|
||||
RETVAL->role = role;
|
||||
RETVAL->height = height;
|
||||
RETVAL->flow_spacing = flow_spacing;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Polyline*
|
||||
ExtrusionPath::as_polyline()
|
||||
PREINIT:
|
||||
const char* CLASS = "Slic3r::Polyline::XS";
|
||||
CODE:
|
||||
RETVAL = new Polyline(THIS->polyline);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
ExtrusionPath::set_polyline(polyline_sv)
|
||||
SV* polyline_sv;
|
||||
CODE:
|
||||
if (sv_isobject(polyline_sv) && (SvTYPE(SvRV(polyline_sv)) == SVt_PVMG)) {
|
||||
THIS->polyline = *(Polyline*)SvIV((SV*)SvRV( polyline_sv ));
|
||||
} else {
|
||||
perl2polyline(polyline_sv, THIS->polyline);
|
||||
}
|
||||
|
||||
ExtrusionRole
|
||||
ExtrusionPath::role(...)
|
||||
CODE:
|
||||
|
@ -88,11 +69,7 @@ ExtrusionPath::append(...)
|
|||
CODE:
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
Point p;
|
||||
if (sv_isobject(ST(i)) && (SvTYPE(SvRV(ST(i))) == SVt_PVMG)) {
|
||||
p = *(Point*)SvIV((SV*)SvRV( ST(i) ));
|
||||
} else {
|
||||
perl2point(ST(i), p);
|
||||
}
|
||||
perl2point_check(ST(i), p);
|
||||
THIS->polyline.points.push_back(p);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue