~ubuntu-branches/ubuntu/utopic/slic3r/utopic

« back to all changes in this revision

Viewing changes to xs/xsp/ExtrusionPath.xsp

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2014-06-17 01:27:26 UTC
  • Revision ID: package-import@ubuntu.com-20140617012726-2wrs4zdo251nr4vg
Tags: upstream-1.1.4+dfsg
ImportĀ upstreamĀ versionĀ 1.1.4+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%module{Slic3r::XS};
 
2
 
 
3
%{
 
4
#include <myinit.h>
 
5
#include "ExtrusionEntity.hpp"
 
6
#include "ExtrusionEntityCollection.hpp"
 
7
%}
 
8
 
 
9
%name{Slic3r::ExtrusionPath} class ExtrusionPath {
 
10
    ~ExtrusionPath();
 
11
    SV* arrayref()
 
12
        %code{% RETVAL = THIS->polyline.to_AV(); %};
 
13
    SV* pp()
 
14
        %code{% RETVAL = THIS->polyline.to_SV_pureperl(); %};
 
15
    void pop_back()
 
16
        %code{% THIS->polyline.points.pop_back(); %};
 
17
    void reverse();
 
18
    Lines lines()
 
19
        %code{% RETVAL = THIS->polyline.lines(); %};
 
20
    Clone<Point> first_point();
 
21
    Clone<Point> last_point();
 
22
    void clip_end(double distance);
 
23
    void simplify(double tolerance);
 
24
    double length();
 
25
    bool is_perimeter();
 
26
    bool is_fill();
 
27
    bool is_bridge();
 
28
    std::string gcode(Extruder* extruder, double e, double F,
 
29
        double xofs, double yofs, std::string extrusion_axis,
 
30
        std::string gcode_line_suffix);
 
31
%{
 
32
 
 
33
ExtrusionPath*
 
34
_new(CLASS, polyline_sv, role, mm3_per_mm, width, height)
 
35
    char*           CLASS;
 
36
    SV*             polyline_sv;
 
37
    ExtrusionRole   role;
 
38
    double          mm3_per_mm;
 
39
    float           width;
 
40
    float           height;
 
41
    CODE:
 
42
        RETVAL = new ExtrusionPath (role);
 
43
        RETVAL->polyline.from_SV_check(polyline_sv);
 
44
        RETVAL->mm3_per_mm      = mm3_per_mm;
 
45
        RETVAL->width           = width;
 
46
        RETVAL->height          = height;
 
47
    OUTPUT:
 
48
        RETVAL
 
49
 
 
50
Ref<Polyline>
 
51
ExtrusionPath::polyline(...)
 
52
    CODE:
 
53
        if (items > 1) {
 
54
            THIS->polyline.from_SV_check( ST(1) );
 
55
        }
 
56
        RETVAL = &(THIS->polyline);
 
57
    OUTPUT:
 
58
        RETVAL
 
59
 
 
60
ExtrusionRole
 
61
ExtrusionPath::role(...)
 
62
    CODE:
 
63
        if (items > 1) {
 
64
            THIS->role = (ExtrusionRole)SvUV(ST(1));
 
65
        }
 
66
        RETVAL = THIS->role;
 
67
    OUTPUT:
 
68
        RETVAL
 
69
 
 
70
double
 
71
ExtrusionPath::mm3_per_mm(...)
 
72
    CODE:
 
73
        if (items > 1) {
 
74
            THIS->mm3_per_mm = (double)SvNV(ST(1));
 
75
        }
 
76
        RETVAL = THIS->mm3_per_mm;
 
77
    OUTPUT:
 
78
        RETVAL
 
79
 
 
80
float
 
81
ExtrusionPath::width(...)
 
82
    CODE:
 
83
        if (items > 1) {
 
84
            THIS->width = (float)SvNV(ST(1));
 
85
        }
 
86
        RETVAL = THIS->width;
 
87
    OUTPUT:
 
88
        RETVAL
 
89
 
 
90
float
 
91
ExtrusionPath::height(...)
 
92
    CODE:
 
93
        if (items > 1) {
 
94
            THIS->height = (float)SvNV(ST(1));
 
95
        }
 
96
        RETVAL = THIS->height;
 
97
    OUTPUT:
 
98
        RETVAL
 
99
 
 
100
void
 
101
ExtrusionPath::append(...)
 
102
    CODE:
 
103
        for (unsigned int i = 1; i < items; i++) {
 
104
            Point p;
 
105
            p.from_SV_check(ST(i));
 
106
            THIS->polyline.points.push_back(p);
 
107
        }
 
108
 
 
109
ExtrusionEntityCollection*
 
110
ExtrusionPath::intersect_expolygons(ExPolygonCollection* collection)
 
111
    CODE:
 
112
        RETVAL = new ExtrusionEntityCollection ();
 
113
        THIS->intersect_expolygons(*collection, RETVAL);
 
114
    OUTPUT:
 
115
        RETVAL
 
116
 
 
117
ExtrusionEntityCollection*
 
118
ExtrusionPath::subtract_expolygons(ExPolygonCollection* collection)
 
119
    CODE:
 
120
        RETVAL = new ExtrusionEntityCollection ();
 
121
        THIS->subtract_expolygons(*collection, RETVAL);
 
122
    OUTPUT:
 
123
        RETVAL
 
124
 
 
125
%}
 
126
};
 
127
 
 
128
%package{Slic3r::ExtrusionPath};
 
129
%{
 
130
 
 
131
IV
 
132
_constant()
 
133
  ALIAS:
 
134
    EXTR_ROLE_PERIMETER                    = erPerimeter
 
135
    EXTR_ROLE_EXTERNAL_PERIMETER           = erExternalPerimeter
 
136
    EXTR_ROLE_OVERHANG_PERIMETER           = erOverhangPerimeter
 
137
    EXTR_ROLE_FILL                         = erInternalInfill
 
138
    EXTR_ROLE_SOLIDFILL                    = erSolidInfill
 
139
    EXTR_ROLE_TOPSOLIDFILL                 = erTopSolidInfill
 
140
    EXTR_ROLE_BRIDGE                       = erBridgeInfill
 
141
    EXTR_ROLE_GAPFILL                      = erGapFill
 
142
    EXTR_ROLE_SKIRT                        = erSkirt
 
143
    EXTR_ROLE_SUPPORTMATERIAL              = erSupportMaterial
 
144
    EXTR_ROLE_SUPPORTMATERIAL_INTERFACE    = erSupportMaterialInterface
 
145
  PROTOTYPE:
 
146
  CODE:
 
147
    RETVAL = ix;
 
148
  OUTPUT: RETVAL
 
149
 
 
150
%}
 
151