PrusaSlicer-NonPlainar/xs/xsp/Layer.xsp
bubnikv 79f5a16536 Reverted the perimeter generator to not save the perimeter areas.
These could be calculated from the fill areas if needed.
On the other side, the non-classified (non-split) fill areas are stored
now for use in the "ensure vertical wall thickness" feature,
also the non-split fill areas are re-used when recalculating the infills.
This is safer than trying to stitch the fill region together from the
classified fragments.

Modified the "ensure vertical wall thickness" feature to use the non-split
fill areas instead of perimeter areas for the calculation
of non-supported regions. This is cheaper as the fill areas contain
roughly half the edges.
2016-11-17 23:22:59 +01:00

157 lines
5.6 KiB
Plaintext

%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; %};
Ref<SurfaceCollection> perimeter_surfaces()
%code%{ RETVAL = &THIS->perimeter_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();
void export_region_slices_to_svg(const char *path);
void export_region_fill_surfaces_to_svg(const char *path);
void export_region_slices_to_svg_debug(const char *name);
void export_region_fill_surfaces_to_svg_debug(const char *name);
};
%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();
void make_fills();
void export_region_slices_to_svg(const char *path);
void export_region_fill_surfaces_to_svg(const char *path);
void export_region_slices_to_svg_debug(const char *name);
void export_region_fill_surfaces_to_svg_debug(const char *name);
};
%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; %};
void export_region_slices_to_svg(const char *path);
void export_region_fill_surfaces_to_svg(const char *path);
void export_region_slices_to_svg_debug(const char *name);
void export_region_fill_surfaces_to_svg_debug(const char *name);
};