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

Print.xsp « xsp « xs - github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 39a094e55bafb5475b42151ba5ea90694022e079 (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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
%module{Slic3r::XS};

%{
#include <myinit.h>
#include "Print.hpp"
#include "PlaceholderParser.hpp"
%}

%package{Slic3r::Print::State};
%{

IV
_constant()
  ALIAS:
    STEP_INIT_EXTRUDERS     = psInitExtruders
    STEP_SLICE              = posSlice
    STEP_PERIMETERS         = posPerimeters
    STEP_PREPARE_INFILL     = posPrepareInfill
    STEP_INFILL             = posInfill
    STEP_SUPPORTMATERIAL    = posSupportMaterial
    STEP_SKIRT              = psSkirt
    STEP_BRIM               = psBrim
  PROTOTYPE:
  CODE:
    RETVAL = ix;
  OUTPUT: RETVAL

%}


%name{Slic3r::Print::Region} class PrintRegion {
    // owned by Print, no constructor/destructor

    Ref<PrintRegionConfig> config()
        %code%{ RETVAL = &THIS->config; %};
    Ref<Print> print();
    
    Flow* flow(FlowRole role, double layer_height, bool bridge, bool first_layer, double width, PrintObject* object)
        %code%{ RETVAL = new Flow(THIS->flow(role, layer_height, bridge, first_layer, width, *object)); %};
};


%name{Slic3r::Print::Object} class PrintObject {
    // owned by Print, no constructor/destructor

    void add_region_volume(int region_id, int volume_id);
    std::vector<int> get_region_volumes(int region_id)
        %code%{
            if (0 <= region_id && region_id < THIS->region_volumes.size())
                RETVAL = THIS->region_volumes[region_id];
        %};
    int region_count()
        %code%{ RETVAL = THIS->print()->regions.size(); %};

    Ref<Print> print();
    Ref<ModelObject> model_object();
    Ref<PrintObjectConfig> config()
        %code%{ RETVAL = &THIS->config; %};
    Points copies()
        %code%{ RETVAL = THIS->copies; %};
    t_layer_height_ranges layer_height_ranges()
        %code%{ RETVAL = THIS->layer_height_ranges; %};
    Ref<Point3> size()
        %code%{ RETVAL = &THIS->size; %};
    Ref<Point> _copies_shift()
        %code%{ RETVAL = &THIS->_copies_shift; %};
    
    bool typed_slices()
        %code%{ RETVAL = THIS->typed_slices; %};
    void set_typed_slices(bool value)
        %code%{ THIS->typed_slices = value; %};
    
    Points _shifted_copies()
        %code%{ RETVAL = THIS->_shifted_copies; %};
    void set_shifted_copies(Points value)
        %code%{ THIS->_shifted_copies = value; %};

    void set_copies(Points copies)
        %code%{ THIS->copies = copies; %};
    void set_layer_height_ranges(t_layer_height_ranges layer_height_ranges)
        %code%{ THIS->layer_height_ranges = layer_height_ranges; %};

    size_t layer_count();
    void clear_layers();
    Ref<Layer> get_layer(int idx);
    Ref<Layer> add_layer(int id, coordf_t height, coordf_t print_z,
        coordf_t slice_z);
    void delete_layer(int idx);

    size_t support_layer_count();
    void clear_support_layers();
    Ref<SupportLayer> get_support_layer(int idx);
    Ref<SupportLayer> add_support_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z);
    void delete_support_layer(int idx);
    
    bool invalidate_state_by_config_options(std::vector<std::string> opt_keys);
    bool invalidate_step(PrintObjectStep step);
    bool invalidate_all_steps();
    bool step_done(PrintObjectStep step)
        %code%{ RETVAL = THIS->state.is_done(step); %};
    void set_step_done(PrintObjectStep step)
        %code%{ THIS->state.set_done(step); %};
    void set_step_started(PrintObjectStep step)
        %code%{ THIS->state.set_started(step); %};
    
    int ptr()
        %code%{ RETVAL = (int)(intptr_t)THIS; %};
};


%name{Slic3r::Print} class Print {
    %name{_new} Print();
    ~Print();

    Ref<PrintConfig> config()
        %code%{ RETVAL = &THIS->config; %};
    Ref<PrintObjectConfig> default_object_config()
        %code%{ RETVAL = &THIS->default_object_config; %};
    Ref<PrintRegionConfig> default_region_config()
        %code%{ RETVAL = &THIS->default_region_config; %};
    Ref<PlaceholderParser> placeholder_parser()
        %code%{ RETVAL = &THIS->placeholder_parser; %};
    // TODO: status_cb
    Ref<ExtrusionEntityCollection> skirt()
        %code%{ RETVAL = &THIS->skirt; %};
    Ref<ExtrusionEntityCollection> brim()
        %code%{ RETVAL = &THIS->brim; %};

    PrintObjectPtrs* objects()
        %code%{ RETVAL = &THIS->objects; %};
    void clear_objects();
    Ref<PrintObject> get_object(int idx);
    Ref<PrintObject> add_object(ModelObject* model_object,
        BoundingBoxf3 *modobj_bbox)
        %code%{ RETVAL = THIS->add_object(model_object, *modobj_bbox); %};
    Ref<PrintObject> set_new_object(size_t idx, ModelObject* model_object,
        BoundingBoxf3 *modobj_bbox)
        %code%{ RETVAL = THIS->set_new_object(idx, model_object, *modobj_bbox); %};
    void delete_object(int idx);
    size_t object_count()
        %code%{ RETVAL = THIS->objects.size(); %};

    PrintRegionPtrs* regions()
        %code%{ RETVAL = &THIS->regions; %};
    Ref<PrintRegion> get_region(int idx);
    Ref<PrintRegion> add_region();
    size_t region_count()
        %code%{ RETVAL = THIS->regions.size(); %};
    
    bool invalidate_state_by_config_options(std::vector<std::string> opt_keys);
    bool invalidate_step(PrintStep step);
    bool invalidate_all_steps();
    bool step_done(PrintStep step)
        %code%{ RETVAL = THIS->state.is_done(step); %};
    void set_step_done(PrintStep step)
        %code%{ THIS->state.set_done(step); %};
    void set_step_started(PrintStep step)
        %code%{ THIS->state.set_started(step); %};
    
    std::vector<int> extruders()
        %code%{
            std::set<size_t> extruders = THIS->extruders();
            RETVAL.reserve(extruders.size());
            for (std::set<size_t>::const_iterator e = extruders.begin(); e != extruders.end(); ++e) {
                RETVAL.push_back(*e);
            }
        %};
    void _simplify_slices(double distance);
    double max_allowed_layer_height() const;
    bool has_support_material() const;
    
    void init_extruders();
%{

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

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

%}
};