mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 16:21:24 -06:00
Ported LayerRegion::make_slices() to XS
This commit is contained in:
parent
948793e570
commit
b69caff93c
11 changed files with 78 additions and 77 deletions
|
@ -52,6 +52,7 @@ class LayerRegion
|
|||
ExtrusionEntityCollection fills;
|
||||
|
||||
Flow flow(FlowRole role, bool bridge = false, double width = -1) const;
|
||||
void merge_slices();
|
||||
|
||||
private:
|
||||
Layer *_layer;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "Layer.hpp"
|
||||
#include "ClipperUtils.hpp"
|
||||
#include "Print.hpp"
|
||||
#include "Surface.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
@ -38,6 +40,18 @@ LayerRegion::flow(FlowRole role, bool bridge, double width) const
|
|||
);
|
||||
}
|
||||
|
||||
void
|
||||
LayerRegion::merge_slices()
|
||||
{
|
||||
ExPolygons expp;
|
||||
union_(this->slices, expp);
|
||||
this->slices.surfaces.clear();
|
||||
this->slices.surfaces.reserve(expp.size());
|
||||
|
||||
for (ExPolygons::const_iterator expoly = expp.begin(); expoly != expp.end(); ++expoly)
|
||||
this->slices.surfaces.push_back(Surface(stInternal, *expoly));
|
||||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
REGISTER_CLASS(LayerRegion, "Layer::Region");
|
||||
#endif
|
||||
|
|
|
@ -10,12 +10,17 @@ enum SurfaceType { stTop, stBottom, stBottomBridge, stInternal, stInternalSolid,
|
|||
class Surface
|
||||
{
|
||||
public:
|
||||
ExPolygon expolygon;
|
||||
SurfaceType surface_type;
|
||||
ExPolygon expolygon;
|
||||
double thickness; // in mm
|
||||
unsigned short thickness_layers; // in layers
|
||||
double bridge_angle; // in radians, ccw, 0 = East, only 0+ (negative means undefined)
|
||||
unsigned short extra_perimeters;
|
||||
|
||||
Surface(SurfaceType _surface_type, const ExPolygon &_expolygon)
|
||||
: surface_type(_surface_type), expolygon(_expolygon),
|
||||
thickness(-1), thickness_layers(1), bridge_angle(-1), extra_perimeters(0)
|
||||
{};
|
||||
double area() const;
|
||||
bool is_solid() const;
|
||||
bool is_external() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue