Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ExtrusionPath.xsp « xsp « xs - github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: df3813d51f4abefa92cd95c0aecd3567b7c5c025 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
%module{Slic3r::XS};

%{
#include <myinit.h>
#include "ExtrusionEntity.hpp"
#include "ExtrusionEntityCollection.hpp"
%}

%name{Slic3r::ExtrusionPath} class ExtrusionPath {
    ~ExtrusionPath();
    SV* arrayref()
        %code{% RETVAL = THIS->polyline.to_AV(); %};
    SV* pp()
        %code{% RETVAL = THIS->polyline.to_SV_pureperl(); %};
    void pop_back()
        %code{% THIS->polyline.points.pop_back(); %};
    void reverse();
    Lines lines()
        %code{% RETVAL = THIS->polyline.lines(); %};
    Clone<Point> first_point();
    Clone<Point> last_point();
    void clip_end(double distance);
    void simplify(double tolerance);
    double length();
    bool is_perimeter();
    bool is_fill();
    bool is_bridge();
    std::string gcode(Extruder* extruder, double e, double F,
        double xofs, double yofs, std::string extrusion_axis,
        std::string gcode_line_suffix);
%{

ExtrusionPath*
_new(CLASS, polyline_sv, role, mm3_per_mm, width, height)
    char*           CLASS;
    SV*             polyline_sv;
    ExtrusionRole   role;
    double          mm3_per_mm;
    float           width;
    float           height;
    CODE:
        RETVAL = new ExtrusionPath (role);
        RETVAL->polyline.from_SV_check(polyline_sv);
        RETVAL->mm3_per_mm      = mm3_per_mm;
        RETVAL->width           = width;
        RETVAL->height          = height;
    OUTPUT:
        RETVAL

Ref<Polyline>
ExtrusionPath::polyline(...)
    CODE:
        if (items > 1) {
            THIS->polyline.from_SV_check( ST(1) );
        }
        RETVAL = &(THIS->polyline);
    OUTPUT:
        RETVAL

ExtrusionRole
ExtrusionPath::role(...)
    CODE:
        if (items > 1) {
            THIS->role = (ExtrusionRole)SvUV(ST(1));
        }
        RETVAL = THIS->role;
    OUTPUT:
        RETVAL

double
ExtrusionPath::mm3_per_mm(...)
    CODE:
        if (items > 1) {
            THIS->mm3_per_mm = (double)SvNV(ST(1));
        }
        RETVAL = THIS->mm3_per_mm;
    OUTPUT:
        RETVAL

float
ExtrusionPath::width(...)
    CODE:
        if (items > 1) {
            THIS->width = (float)SvNV(ST(1));
        }
        RETVAL = THIS->width;
    OUTPUT:
        RETVAL

float
ExtrusionPath::height(...)
    CODE:
        if (items > 1) {
            THIS->height = (float)SvNV(ST(1));
        }
        RETVAL = THIS->height;
    OUTPUT:
        RETVAL

void
ExtrusionPath::append(...)
    CODE:
        for (unsigned int i = 1; i < items; i++) {
            Point p;
            p.from_SV_check(ST(i));
            THIS->polyline.points.push_back(p);
        }

ExtrusionEntityCollection*
ExtrusionPath::intersect_expolygons(ExPolygonCollection* collection)
    CODE:
        RETVAL = new ExtrusionEntityCollection ();
        THIS->intersect_expolygons(*collection, RETVAL);
    OUTPUT:
        RETVAL

ExtrusionEntityCollection*
ExtrusionPath::subtract_expolygons(ExPolygonCollection* collection)
    CODE:
        RETVAL = new ExtrusionEntityCollection ();
        THIS->subtract_expolygons(*collection, RETVAL);
    OUTPUT:
        RETVAL

%}
};

%package{Slic3r::ExtrusionPath};
%{

IV
_constant()
  ALIAS:
    EXTR_ROLE_PERIMETER                    = erPerimeter
    EXTR_ROLE_EXTERNAL_PERIMETER           = erExternalPerimeter
    EXTR_ROLE_OVERHANG_PERIMETER           = erOverhangPerimeter
    EXTR_ROLE_FILL                         = erInternalInfill
    EXTR_ROLE_SOLIDFILL                    = erSolidInfill
    EXTR_ROLE_TOPSOLIDFILL                 = erTopSolidInfill
    EXTR_ROLE_BRIDGE                       = erBridgeInfill
    EXTR_ROLE_GAPFILL                      = erGapFill
    EXTR_ROLE_SKIRT                        = erSkirt
    EXTR_ROLE_SUPPORTMATERIAL              = erSupportMaterial
    EXTR_ROLE_SUPPORTMATERIAL_INTERFACE    = erSupportMaterialInterface
  PROTOTYPE:
  CODE:
    RETVAL = ix;
  OUTPUT: RETVAL

%}