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

Layer.xsp « xsp « xs - github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e5697ce897eb5232708e6ad9933ef51d12faafe2 (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
%module{Slic3r::XS};

%{
#include <xsinit.h>
#include "libslic3r/Layer.hpp"
%}

%name{Slic3r::Layer::Region} class LayerRegion {
    // owned by Layer, no constructor/destructor

    Ref<Layer> layer();
    Ref<PrintRegion> region();

    Ref<SurfaceCollection> slices()
        %code%{ RETVAL = &THIS->slices; %};
    Ref<ExtrusionEntityCollection> thin_fills()
        %code%{ RETVAL = &THIS->thin_fills; %};
    Ref<SurfaceCollection> fill_surfaces()
        %code%{ RETVAL = &THIS->fill_surfaces; %};
    Polygons bridged()
        %code%{ RETVAL = THIS->bridged; %};
    Ref<PolylineCollection> unsupported_bridge_edges()
        %code%{ RETVAL = &THIS->unsupported_bridge_edges; %};
    Ref<ExtrusionEntityCollection> perimeters()
        %code%{ RETVAL = &THIS->perimeters; %};
    Ref<ExtrusionEntityCollection> fills()
        %code%{ RETVAL = &THIS->fills; %};
    
    Clone<Flow> flow(FlowRole role, bool bridge = false, double width = -1)
        %code%{ RETVAL = THIS->flow(role, bridge, width); %};
    void merge_slices();
    void prepare_fill_surfaces();
    void make_perimeters(SurfaceCollection* slices, SurfaceCollection* fill_surfaces)
        %code%{ THIS->make_perimeters(*slices, fill_surfaces); %};
    double infill_area_threshold();
};

%name{Slic3r::Layer} class Layer {
    // owned by PrintObject, no constructor/destructor
    
    Ref<Layer> as_layer()
        %code%{ RETVAL = THIS; %};

    int id();
    void set_id(int id);
    Ref<PrintObject> object();
    Ref<Layer> upper_layer()
        %code%{ RETVAL = THIS->upper_layer; %};
    Ref<Layer> lower_layer()
        %code%{ RETVAL = THIS->lower_layer; %};
    bool slicing_errors()
        %code%{ RETVAL = THIS->slicing_errors; %};
    coordf_t slice_z()
        %code%{ RETVAL = THIS->slice_z; %};
    coordf_t print_z()
        %code%{ RETVAL = THIS->print_z; %};
    coordf_t height()
        %code%{ RETVAL = THIS->height; %};

    void set_upper_layer(Layer *layer)
        %code%{ THIS->upper_layer = layer; %};
    void set_lower_layer(Layer *layer)
        %code%{ THIS->lower_layer = layer; %};
    bool has_upper_layer()
        %code%{ RETVAL = (THIS->upper_layer != NULL); %};
    bool has_lower_layer()
        %code%{ RETVAL = (THIS->lower_layer != NULL); %};
    
    size_t region_count();
    Ref<LayerRegion> get_region(int idx);
    Ref<LayerRegion> add_region(PrintRegion* print_region);

    Ref<ExPolygonCollection> slices()
        %code%{ RETVAL = &THIS->slices; %};
    
    int ptr()
        %code%{ RETVAL = (int)(intptr_t)THIS; %};
    
    Ref<SupportLayer> as_support_layer()
        %code%{ RETVAL = dynamic_cast<SupportLayer*>(THIS); %};
    
    void make_slices();
    void merge_slices();
    bool any_internal_region_slice_contains_polyline(Polyline* polyline)
        %code%{ RETVAL = THIS->any_internal_region_slice_contains(*polyline); %};
    bool any_bottom_region_slice_contains_polyline(Polyline* polyline)
        %code%{ RETVAL = THIS->any_bottom_region_slice_contains(*polyline); %};
    void make_perimeters();
};

%name{Slic3r::Layer::Support} class SupportLayer {
    // owned by PrintObject, no constructor/destructor
    
    Ref<Layer> as_layer()
        %code%{ RETVAL = THIS; %};
    
    Ref<ExPolygonCollection> support_islands()
        %code%{ RETVAL = &THIS->support_islands; %};
    Ref<ExtrusionEntityCollection> support_fills()
        %code%{ RETVAL = &THIS->support_fills; %};
    Ref<ExtrusionEntityCollection> support_interface_fills()
        %code%{ RETVAL = &THIS->support_interface_fills; %};


    // copies of some Layer methods, because the parameter wrapper code
    // gets confused about getting a Layer::Support instead of a Layer
    int id();
    void set_id(int id);
    Ref<PrintObject> object();
    Ref<SupportLayer> upper_layer()
        %code%{ RETVAL = (SupportLayer*)THIS->upper_layer; %};
    Ref<SupportLayer> lower_layer()
        %code%{ RETVAL = (SupportLayer*)THIS->lower_layer; %};
    bool slicing_errors()
        %code%{ RETVAL = THIS->slicing_errors; %};
    coordf_t slice_z()
        %code%{ RETVAL = THIS->slice_z; %};
    coordf_t print_z()
        %code%{ RETVAL = THIS->print_z; %};
    coordf_t height()
        %code%{ RETVAL = THIS->height; %};

    void set_upper_layer(SupportLayer *layer)
        %code%{ THIS->upper_layer = layer; %};
    void set_lower_layer(SupportLayer *layer)
        %code%{ THIS->lower_layer = layer; %};
    bool has_upper_layer()
        %code%{ RETVAL = (THIS->upper_layer != NULL); %};
    bool has_lower_layer()
        %code%{ RETVAL = (THIS->lower_layer != NULL); %};

    size_t region_count();
    Ref<LayerRegion> get_region(int idx);
    Ref<LayerRegion> add_region(PrintRegion* print_region);

    Ref<ExPolygonCollection> slices()
        %code%{ RETVAL = &THIS->slices; %};
    
    bool any_internal_region_slice_contains_polyline(Polyline* polyline)
        %code%{ RETVAL = THIS->any_internal_region_slice_contains(*polyline); %};
    bool any_bottom_region_slice_contains_polyline(Polyline* polyline)
        %code%{ RETVAL = THIS->any_bottom_region_slice_contains(*polyline); %};
};