mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 00:01:09 -06:00
Ported Slic3r::GCode storage to XS
This commit is contained in:
parent
ab858f320d
commit
801f629fdc
13 changed files with 199 additions and 64 deletions
|
@ -215,10 +215,12 @@ for my $class (qw(
|
|||
Slic3r::ExtrusionPath
|
||||
Slic3r::ExtrusionPath::Collection
|
||||
Slic3r::Flow
|
||||
Slic3r::GCode
|
||||
Slic3r::GCode::AvoidCrossingPerimeters
|
||||
Slic3r::GCode::OozePrevention
|
||||
Slic3r::GCode::PlaceholderParser
|
||||
Slic3r::GCode::Wipe
|
||||
Slic3r::GCode::Writer
|
||||
Slic3r::Geometry::BoundingBox
|
||||
Slic3r::Geometry::BoundingBoxf
|
||||
Slic3r::Geometry::BoundingBoxf3
|
||||
|
|
|
@ -97,4 +97,15 @@ Wipe::reset_path()
|
|||
REGISTER_CLASS(Wipe, "GCode::Wipe");
|
||||
#endif
|
||||
|
||||
GCode::GCode()
|
||||
: enable_loop_clipping(true), enable_cooling_markers(false), layer_count(0),
|
||||
layer_index(-1), first_layer(false), elapsed_time(0), volumetric_speed(0),
|
||||
last_pos_defined(false)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
REGISTER_CLASS(GCode, "GCode");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,13 @@
|
|||
|
||||
#include <myinit.h>
|
||||
#include "ExPolygon.hpp"
|
||||
#include "GCodeWriter.hpp"
|
||||
#include "Layer.hpp"
|
||||
#include "MotionPlanner.hpp"
|
||||
#include "Point.hpp"
|
||||
#include "PlaceholderParser.hpp"
|
||||
#include "Print.hpp"
|
||||
#include "PrintConfig.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace Slic3r {
|
||||
|
@ -54,6 +60,34 @@ class Wipe {
|
|||
//std::string wipe(GCode &gcodegen, bool toolchange = false);
|
||||
};
|
||||
|
||||
class GCode {
|
||||
public:
|
||||
|
||||
/* Origin of print coordinates expressed in unscaled G-code coordinates.
|
||||
This affects the input arguments supplied to the extrude*() and travel_to()
|
||||
methods. */
|
||||
Pointf origin;
|
||||
FullPrintConfig config;
|
||||
GCodeWriter writer;
|
||||
PlaceholderParser* placeholder_parser;
|
||||
OozePrevention ooze_prevention;
|
||||
Wipe wipe;
|
||||
AvoidCrossingPerimeters avoid_crossing_perimeters;
|
||||
bool enable_loop_clipping;
|
||||
bool enable_cooling_markers;
|
||||
size_t layer_count;
|
||||
int layer_index; // just a counter
|
||||
Layer* layer;
|
||||
std::map<PrintObject*,Point> _seam_position;
|
||||
bool first_layer; // this flag triggers first layer speeds
|
||||
unsigned int elapsed_time; // seconds
|
||||
Point last_pos;
|
||||
bool last_pos_defined;
|
||||
double volumetric_speed;
|
||||
|
||||
GCode();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -62,3 +62,89 @@
|
|||
void set_path(Polyline* value)
|
||||
%code{% THIS->path = *value; %};
|
||||
};
|
||||
|
||||
%name{Slic3r::GCode} class GCode {
|
||||
GCode();
|
||||
~GCode();
|
||||
|
||||
Ref<Pointf> origin()
|
||||
%code{% RETVAL = &(THIS->origin); %};
|
||||
void _set_origin(Pointf* value)
|
||||
%code{% THIS->origin = *value; %};
|
||||
|
||||
Ref<FullPrintConfig> config()
|
||||
%code{% RETVAL = &(THIS->config); %};
|
||||
|
||||
Ref<GCodeWriter> writer()
|
||||
%code{% RETVAL = &(THIS->writer); %};
|
||||
|
||||
Ref<PlaceholderParser> placeholder_parser()
|
||||
%code{% RETVAL = THIS->placeholder_parser; %};
|
||||
void set_placeholder_parser(PlaceholderParser* ptr)
|
||||
%code{% THIS->placeholder_parser = ptr; %};
|
||||
|
||||
Ref<OozePrevention> ooze_prevention()
|
||||
%code{% RETVAL = &(THIS->ooze_prevention); %};
|
||||
|
||||
Ref<Wipe> wipe()
|
||||
%code{% RETVAL = &(THIS->wipe); %};
|
||||
|
||||
Ref<AvoidCrossingPerimeters> avoid_crossing_perimeters()
|
||||
%code{% RETVAL = &(THIS->avoid_crossing_perimeters); %};
|
||||
|
||||
bool enable_loop_clipping()
|
||||
%code{% RETVAL = THIS->enable_loop_clipping; %};
|
||||
void set_enable_loop_clipping(bool value)
|
||||
%code{% THIS->enable_loop_clipping = value; %};
|
||||
|
||||
bool enable_cooling_markers()
|
||||
%code{% RETVAL = THIS->enable_cooling_markers; %};
|
||||
void set_enable_cooling_markers(bool value)
|
||||
%code{% THIS->enable_cooling_markers = value; %};
|
||||
|
||||
int layer_count()
|
||||
%code{% RETVAL = THIS->layer_count; %};
|
||||
void set_layer_count(int value)
|
||||
%code{% THIS->layer_count = value; %};
|
||||
|
||||
int layer_index()
|
||||
%code{% RETVAL = THIS->layer_index; %};
|
||||
void set_layer_index(int value)
|
||||
%code{% THIS->layer_index = value; %};
|
||||
|
||||
bool has_layer()
|
||||
%code{% RETVAL = THIS->layer != NULL; %};
|
||||
Ref<Layer> layer()
|
||||
%code{% RETVAL = THIS->layer; %};
|
||||
void set_layer(Layer* ptr)
|
||||
%code{% THIS->layer = ptr; %};
|
||||
|
||||
bool _has_seam_position(PrintObject* ptr)
|
||||
%code{% RETVAL = THIS->_seam_position.count(ptr) > 0; %};
|
||||
Clone<Point> _seam_position(PrintObject* ptr)
|
||||
%code{% RETVAL = THIS->_seam_position[ptr]; %};
|
||||
void _set_seam_position(PrintObject* ptr, Point* pos)
|
||||
%code{% THIS->_seam_position[ptr] = *pos; %};
|
||||
|
||||
bool first_layer()
|
||||
%code{% RETVAL = THIS->first_layer; %};
|
||||
void set_first_layer(bool value)
|
||||
%code{% THIS->first_layer = value; %};
|
||||
|
||||
unsigned int elapsed_time()
|
||||
%code{% RETVAL = THIS->elapsed_time; %};
|
||||
void set_elapsed_time(unsigned int value)
|
||||
%code{% THIS->elapsed_time = value; %};
|
||||
|
||||
bool last_pos_defined()
|
||||
%code{% RETVAL = THIS->last_pos_defined; %};
|
||||
Ref<Point> last_pos()
|
||||
%code{% RETVAL = &(THIS->last_pos); %};
|
||||
void set_last_pos(Point* value)
|
||||
%code{% THIS->last_pos = *value; THIS->last_pos_defined = true; %};
|
||||
|
||||
double volumetric_speed()
|
||||
%code{% RETVAL = THIS->volumetric_speed; %};
|
||||
void set_volumetric_speed(double value)
|
||||
%code{% THIS->volumetric_speed = value; %};
|
||||
};
|
||||
|
|
|
@ -70,6 +70,9 @@
|
|||
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)
|
||||
|
@ -80,7 +83,10 @@
|
|||
|
||||
%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()
|
||||
|
|
|
@ -182,6 +182,10 @@ OozePrevention* O_OBJECT_SLIC3R
|
|||
Ref<OozePrevention> O_OBJECT_SLIC3R_T
|
||||
Clone<OozePrevention> O_OBJECT_SLIC3R_T
|
||||
|
||||
GCode* O_OBJECT_SLIC3R
|
||||
Ref<GCode> O_OBJECT_SLIC3R_T
|
||||
Clone<GCode> O_OBJECT_SLIC3R_T
|
||||
|
||||
MotionPlanner* O_OBJECT_SLIC3R
|
||||
Ref<MotionPlanner> O_OBJECT_SLIC3R_T
|
||||
Clone<MotionPlanner> O_OBJECT_SLIC3R_T
|
||||
|
|
|
@ -133,6 +133,14 @@
|
|||
%typemap{Ref<Wipe>}{simple};
|
||||
%typemap{Clone<Wipe>}{simple};
|
||||
|
||||
%typemap{OozePrevention*};
|
||||
%typemap{Ref<OozePrevention>}{simple};
|
||||
%typemap{Clone<OozePrevention>}{simple};
|
||||
|
||||
%typemap{GCode*};
|
||||
%typemap{Ref<GCode>}{simple};
|
||||
%typemap{Clone<GCode>}{simple};
|
||||
|
||||
|
||||
%typemap{Points};
|
||||
%typemap{Pointfs};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue