mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 16:21:24 -06:00
Merge branch 'master' into sender
This commit is contained in:
commit
9f9b5afedb
43 changed files with 267 additions and 242 deletions
|
@ -30,7 +30,7 @@ class BridgeDirectionComparator {
|
|||
BridgeDetector::BridgeDetector(const ExPolygon &_expolygon, const ExPolygonCollection &_lower_slices,
|
||||
coord_t _extrusion_width)
|
||||
: expolygon(_expolygon), lower_slices(_lower_slices), extrusion_width(_extrusion_width),
|
||||
angle(-1), resolution(PI/36.0)
|
||||
resolution(PI/36.0), angle(-1)
|
||||
{
|
||||
/* outset our bridge by an arbitrary amout; we'll use this outer margin
|
||||
for detecting anchors */
|
||||
|
@ -293,8 +293,8 @@ BridgeDetector::unsupported_edges(double angle, Polylines* unsupported) const
|
|||
TODO: angle tolerance should probably be based on segment length and flow width,
|
||||
so that we build supports whenever there's a chance that at least one or two bridge
|
||||
extrusions would be anchored within such length (i.e. a slightly non-parallel bridging
|
||||
direction might still benefit from anchors if long enough) */
|
||||
double angle_tolerance = PI / 180.0 * 5.0;
|
||||
direction might still benefit from anchors if long enough)
|
||||
double angle_tolerance = PI / 180.0 * 5.0; */
|
||||
for (Polylines::const_iterator polyline = _unsupported.begin(); polyline != _unsupported.end(); ++polyline) {
|
||||
Lines lines = polyline->lines();
|
||||
for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line) {
|
||||
|
|
|
@ -685,7 +685,7 @@ SV*
|
|||
polynode_children_2_perl(const ClipperLib::PolyNode& node)
|
||||
{
|
||||
AV* av = newAV();
|
||||
const unsigned int len = node.ChildCount();
|
||||
const int len = node.ChildCount();
|
||||
if (len > 0) av_extend(av, len-1);
|
||||
for (int i = 0; i < len; ++i) {
|
||||
av_store(av, i, polynode2perl(*node.Childs[i]));
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Slic3r {
|
||||
|
||||
bool
|
||||
ConfigBase::has(const t_config_option_key opt_key) {
|
||||
ConfigBase::has(const t_config_option_key &opt_key) {
|
||||
return (this->option(opt_key, false) != NULL);
|
||||
}
|
||||
|
||||
|
@ -52,14 +52,14 @@ ConfigBase::diff(ConfigBase &other) {
|
|||
}
|
||||
|
||||
std::string
|
||||
ConfigBase::serialize(const t_config_option_key opt_key) {
|
||||
ConfigBase::serialize(const t_config_option_key &opt_key) {
|
||||
ConfigOption* opt = this->option(opt_key);
|
||||
assert(opt != NULL);
|
||||
return opt->serialize();
|
||||
}
|
||||
|
||||
bool
|
||||
ConfigBase::set_deserialize(const t_config_option_key opt_key, std::string str) {
|
||||
ConfigBase::set_deserialize(const t_config_option_key &opt_key, std::string str) {
|
||||
if (this->def->count(opt_key) == 0) throw "Calling set_deserialize() on unknown option";
|
||||
ConfigOptionDef* optdef = &(*this->def)[opt_key];
|
||||
if (!optdef->shortcut.empty()) {
|
||||
|
@ -75,7 +75,7 @@ ConfigBase::set_deserialize(const t_config_option_key opt_key, std::string str)
|
|||
}
|
||||
|
||||
double
|
||||
ConfigBase::get_abs_value(const t_config_option_key opt_key) {
|
||||
ConfigBase::get_abs_value(const t_config_option_key &opt_key) {
|
||||
ConfigOption* opt = this->option(opt_key, false);
|
||||
if (ConfigOptionFloatOrPercent* optv = dynamic_cast<ConfigOptionFloatOrPercent*>(opt)) {
|
||||
// get option definition
|
||||
|
@ -92,7 +92,7 @@ ConfigBase::get_abs_value(const t_config_option_key opt_key) {
|
|||
}
|
||||
|
||||
double
|
||||
ConfigBase::get_abs_value(const t_config_option_key opt_key, double ratio_over) {
|
||||
ConfigBase::get_abs_value(const t_config_option_key &opt_key, double ratio_over) {
|
||||
// get stored option value
|
||||
ConfigOptionFloatOrPercent* opt = dynamic_cast<ConfigOptionFloatOrPercent*>(this->option(opt_key));
|
||||
assert(opt != NULL);
|
||||
|
@ -282,7 +282,7 @@ ConfigBase::set(t_config_option_key opt_key, SV* value) {
|
|||
/* This method is implemented as a workaround for this typemap bug:
|
||||
https://rt.cpan.org/Public/Bug/Display.html?id=94110 */
|
||||
bool
|
||||
ConfigBase::set_deserialize(const t_config_option_key opt_key, SV* str) {
|
||||
ConfigBase::set_deserialize(const t_config_option_key &opt_key, SV* str) {
|
||||
size_t len;
|
||||
const char * c = SvPV(str, len);
|
||||
std::string value(c, len);
|
||||
|
@ -328,7 +328,7 @@ DynamicConfig::DynamicConfig (const DynamicConfig& other) {
|
|||
}
|
||||
|
||||
ConfigOption*
|
||||
DynamicConfig::option(const t_config_option_key opt_key, bool create) {
|
||||
DynamicConfig::option(const t_config_option_key &opt_key, bool create) {
|
||||
if (this->options.count(opt_key) == 0) {
|
||||
if (create) {
|
||||
ConfigOptionDef* optdef = &(*this->def)[opt_key];
|
||||
|
@ -375,16 +375,16 @@ DynamicConfig::option(const t_config_option_key opt_key, bool create) {
|
|||
|
||||
template<class T>
|
||||
T*
|
||||
DynamicConfig::opt(const t_config_option_key opt_key, bool create) {
|
||||
DynamicConfig::opt(const t_config_option_key &opt_key, bool create) {
|
||||
return dynamic_cast<T*>(this->option(opt_key, create));
|
||||
}
|
||||
template ConfigOptionInt* DynamicConfig::opt<ConfigOptionInt>(const t_config_option_key opt_key, bool create);
|
||||
template ConfigOptionBool* DynamicConfig::opt<ConfigOptionBool>(const t_config_option_key opt_key, bool create);
|
||||
template ConfigOptionBools* DynamicConfig::opt<ConfigOptionBools>(const t_config_option_key opt_key, bool create);
|
||||
template ConfigOptionPercent* DynamicConfig::opt<ConfigOptionPercent>(const t_config_option_key opt_key, bool create);
|
||||
template ConfigOptionInt* DynamicConfig::opt<ConfigOptionInt>(const t_config_option_key &opt_key, bool create);
|
||||
template ConfigOptionBool* DynamicConfig::opt<ConfigOptionBool>(const t_config_option_key &opt_key, bool create);
|
||||
template ConfigOptionBools* DynamicConfig::opt<ConfigOptionBools>(const t_config_option_key &opt_key, bool create);
|
||||
template ConfigOptionPercent* DynamicConfig::opt<ConfigOptionPercent>(const t_config_option_key &opt_key, bool create);
|
||||
|
||||
const ConfigOption*
|
||||
DynamicConfig::option(const t_config_option_key opt_key) const {
|
||||
DynamicConfig::option(const t_config_option_key &opt_key) const {
|
||||
return const_cast<DynamicConfig*>(this)->option(opt_key, false);
|
||||
}
|
||||
|
||||
|
@ -397,7 +397,7 @@ DynamicConfig::keys() const {
|
|||
}
|
||||
|
||||
void
|
||||
DynamicConfig::erase(const t_config_option_key opt_key) {
|
||||
DynamicConfig::erase(const t_config_option_key &opt_key) {
|
||||
this->options.erase(opt_key);
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,7 @@ StaticConfig::keys() const {
|
|||
}
|
||||
|
||||
const ConfigOption*
|
||||
StaticConfig::option(const t_config_option_key opt_key) const
|
||||
StaticConfig::option(const t_config_option_key &opt_key) const
|
||||
{
|
||||
return const_cast<StaticConfig*>(this)->option(opt_key, false);
|
||||
}
|
||||
|
|
|
@ -459,6 +459,7 @@ class ConfigOptionEnumGeneric : public ConfigOption
|
|||
};
|
||||
|
||||
enum ConfigOptionType {
|
||||
coNone,
|
||||
coFloat,
|
||||
coFloats,
|
||||
coInt,
|
||||
|
@ -500,7 +501,8 @@ class ConfigOptionDef
|
|||
std::vector<std::string> enum_labels;
|
||||
t_config_enum_values enum_keys_map;
|
||||
|
||||
ConfigOptionDef() : multiline(false), full_width(false), readonly(false),
|
||||
ConfigOptionDef() : type(coNone),
|
||||
multiline(false), full_width(false), readonly(false),
|
||||
height(-1), width(-1), min(INT_MIN), max(INT_MAX) {};
|
||||
};
|
||||
|
||||
|
@ -512,18 +514,18 @@ class ConfigBase
|
|||
t_optiondef_map* def;
|
||||
|
||||
ConfigBase() : def(NULL) {};
|
||||
bool has(const t_config_option_key opt_key);
|
||||
virtual ConfigOption* option(const t_config_option_key opt_key, bool create = false) = 0;
|
||||
virtual const ConfigOption* option(const t_config_option_key opt_key) const = 0;
|
||||
bool has(const t_config_option_key &opt_key);
|
||||
virtual ConfigOption* option(const t_config_option_key &opt_key, bool create = false) = 0;
|
||||
virtual const ConfigOption* option(const t_config_option_key &opt_key) const = 0;
|
||||
virtual t_config_option_keys keys() const = 0;
|
||||
void apply(const ConfigBase &other, bool ignore_nonexistent = false);
|
||||
bool equals(ConfigBase &other);
|
||||
t_config_option_keys diff(ConfigBase &other);
|
||||
std::string serialize(const t_config_option_key opt_key);
|
||||
bool set_deserialize(const t_config_option_key opt_key, std::string str);
|
||||
std::string serialize(const t_config_option_key &opt_key);
|
||||
bool set_deserialize(const t_config_option_key &opt_key, std::string str);
|
||||
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false);
|
||||
double get_abs_value(const t_config_option_key opt_key);
|
||||
double get_abs_value(const t_config_option_key opt_key, double ratio_over);
|
||||
double get_abs_value(const t_config_option_key &opt_key);
|
||||
double get_abs_value(const t_config_option_key &opt_key, double ratio_over);
|
||||
void setenv_();
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
|
@ -531,7 +533,7 @@ class ConfigBase
|
|||
SV* get(t_config_option_key opt_key);
|
||||
SV* get_at(t_config_option_key opt_key, size_t i);
|
||||
bool set(t_config_option_key opt_key, SV* value);
|
||||
bool set_deserialize(const t_config_option_key opt_key, SV* str);
|
||||
bool set_deserialize(const t_config_option_key &opt_key, SV* str);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -543,11 +545,11 @@ class DynamicConfig : public ConfigBase
|
|||
DynamicConfig& operator= (DynamicConfig other);
|
||||
void swap(DynamicConfig &other);
|
||||
~DynamicConfig();
|
||||
template<class T> T* opt(const t_config_option_key opt_key, bool create = false);
|
||||
ConfigOption* option(const t_config_option_key opt_key, bool create = false);
|
||||
const ConfigOption* option(const t_config_option_key opt_key) const;
|
||||
template<class T> T* opt(const t_config_option_key &opt_key, bool create = false);
|
||||
ConfigOption* option(const t_config_option_key &opt_key, bool create = false);
|
||||
const ConfigOption* option(const t_config_option_key &opt_key) const;
|
||||
t_config_option_keys keys() const;
|
||||
void erase(const t_config_option_key opt_key);
|
||||
void erase(const t_config_option_key &opt_key);
|
||||
|
||||
private:
|
||||
typedef std::map<t_config_option_key,ConfigOption*> t_options_map;
|
||||
|
@ -558,8 +560,8 @@ class StaticConfig : public ConfigBase
|
|||
{
|
||||
public:
|
||||
t_config_option_keys keys() const;
|
||||
virtual ConfigOption* option(const t_config_option_key opt_key, bool create = false) = 0;
|
||||
const ConfigOption* option(const t_config_option_key opt_key) const;
|
||||
virtual ConfigOption* option(const t_config_option_key &opt_key, bool create = false) = 0;
|
||||
const ConfigOption* option(const t_config_option_key &opt_key) const;
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
bool set(t_config_option_key opt_key, SV* value);
|
||||
|
|
|
@ -375,31 +375,29 @@ ExPolygon::triangulate_p2t(Polygons* polygons) const
|
|||
simplify_polygons(*this, &expp, true);
|
||||
|
||||
for (ExPolygons::const_iterator ex = expp.begin(); ex != expp.end(); ++ex) {
|
||||
p2t::CDT* cdt;
|
||||
|
||||
// TODO: prevent duplicate points
|
||||
|
||||
|
||||
// contour
|
||||
{
|
||||
std::vector<p2t::Point*> points;
|
||||
for (Points::const_iterator point = ex->contour.points.begin(); point != ex->contour.points.end(); ++point) {
|
||||
points.push_back(new p2t::Point(point->x, point->y));
|
||||
}
|
||||
cdt = new p2t::CDT(points);
|
||||
std::vector<p2t::Point*> ContourPoints;
|
||||
for (Points::const_iterator point = ex->contour.points.begin(); point != ex->contour.points.end(); ++point) {
|
||||
// We should delete each p2t::Point object
|
||||
ContourPoints.push_back(new p2t::Point(point->x, point->y));
|
||||
}
|
||||
|
||||
p2t::CDT cdt(ContourPoints);
|
||||
|
||||
// holes
|
||||
for (Polygons::const_iterator hole = ex->holes.begin(); hole != ex->holes.end(); ++hole) {
|
||||
std::vector<p2t::Point*> points;
|
||||
for (Points::const_iterator point = hole->points.begin(); point != hole->points.end(); ++point) {
|
||||
// will be destructed in SweepContext::~SweepContext
|
||||
points.push_back(new p2t::Point(point->x, point->y));
|
||||
}
|
||||
cdt->AddHole(points);
|
||||
cdt.AddHole(points);
|
||||
}
|
||||
|
||||
// perform triangulation
|
||||
cdt->Triangulate();
|
||||
std::vector<p2t::Triangle*> triangles = cdt->GetTriangles();
|
||||
cdt.Triangulate();
|
||||
std::vector<p2t::Triangle*> triangles = cdt.GetTriangles();
|
||||
|
||||
for (std::vector<p2t::Triangle*>::const_iterator triangle = triangles.begin(); triangle != triangles.end(); ++triangle) {
|
||||
Polygon p;
|
||||
|
@ -409,6 +407,10 @@ ExPolygon::triangulate_p2t(Polygons* polygons) const
|
|||
}
|
||||
polygons->push_back(p);
|
||||
}
|
||||
|
||||
for(std::vector<p2t::Point*>::iterator it = ContourPoints.begin(); it != ContourPoints.end(); ++it) {
|
||||
delete *it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
Extruder::Extruder(int id, GCodeConfig *config)
|
||||
Extruder::Extruder(unsigned int id, GCodeConfig *config)
|
||||
: id(id),
|
||||
config(config)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Slic3r {
|
|||
class Extruder
|
||||
{
|
||||
public:
|
||||
int id;
|
||||
unsigned int id;
|
||||
double E;
|
||||
double absolute_E;
|
||||
double retracted;
|
||||
|
@ -18,7 +18,7 @@ class Extruder
|
|||
double e_per_mm3;
|
||||
double retract_speed_mm_min;
|
||||
|
||||
Extruder(int id, GCodeConfig *config);
|
||||
Extruder(unsigned int id, GCodeConfig *config);
|
||||
virtual ~Extruder() {}
|
||||
void reset();
|
||||
double extrude(double dE);
|
||||
|
|
|
@ -283,7 +283,7 @@ ExtrusionLoop::has_overhang_point(const Point &point) const
|
|||
if (pos != -1) {
|
||||
// point belongs to this path
|
||||
// we consider it overhang only if it's not an endpoint
|
||||
return (path->is_bridge() && pos > 0 && pos != path->polyline.points.size()-1);
|
||||
return (path->is_bridge() && pos > 0 && pos != (int)(path->polyline.points.size())-1);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace Slic3r {
|
||||
|
||||
ExtrusionEntityCollection::ExtrusionEntityCollection(const ExtrusionEntityCollection& collection)
|
||||
: no_sort(collection.no_sort), orig_indices(collection.orig_indices)
|
||||
: orig_indices(collection.orig_indices), no_sort(collection.no_sort)
|
||||
{
|
||||
this->append(collection.entities);
|
||||
}
|
||||
|
|
|
@ -209,9 +209,9 @@ REGISTER_CLASS(Wipe, "GCode::Wipe");
|
|||
#define EXTRUDER_CONFIG(OPT) this->config.OPT.get_at(this->writer.extruder()->id)
|
||||
|
||||
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), layer(NULL), placeholder_parser(NULL)
|
||||
: placeholder_parser(NULL), enable_loop_clipping(true), enable_cooling_markers(false), layer_count(0),
|
||||
layer_index(-1), layer(NULL), first_layer(false), elapsed_time(0), volumetric_speed(0),
|
||||
_last_pos_defined(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -435,7 +435,6 @@ GCode::extrude(ExtrusionLoop loop, std::string description, double speed)
|
|||
|
||||
// make a little move inwards before leaving loop
|
||||
if (paths.back().role == erExternalPerimeter && this->layer != NULL && this->config.perimeters > 1) {
|
||||
Polyline &last_path_polyline = paths.back().polyline;
|
||||
// detect angle between last and first segment
|
||||
// the side depends on the original winding order of the polygon (left for contours, right for holes)
|
||||
Point a = paths.front().polyline.points[1]; // second point
|
||||
|
@ -576,7 +575,7 @@ GCode::_extrude(ExtrusionPath path, std::string description, double speed)
|
|||
gcode += this->writer.set_speed(F);
|
||||
double path_length = 0;
|
||||
{
|
||||
std::string comment = this->config.gcode_comments ? (" ; " + description) : "";
|
||||
std::string comment = this->config.gcode_comments ? description : "";
|
||||
Lines lines = path.polyline.lines();
|
||||
for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line) {
|
||||
const double line_length = line->length() * SCALING_FACTOR;
|
||||
|
|
|
@ -67,7 +67,7 @@ GCodeWriter::preamble()
|
|||
}
|
||||
|
||||
std::string
|
||||
GCodeWriter::postamble()
|
||||
GCodeWriter::postamble() const
|
||||
{
|
||||
std::ostringstream gcode;
|
||||
if (FLAVOR_IS(gcfMachinekit))
|
||||
|
@ -76,7 +76,7 @@ GCodeWriter::postamble()
|
|||
}
|
||||
|
||||
std::string
|
||||
GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool)
|
||||
GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool) const
|
||||
{
|
||||
if (wait && (FLAVOR_IS(gcfMakerWare) || FLAVOR_IS(gcfSailfish)))
|
||||
return "";
|
||||
|
@ -84,7 +84,7 @@ GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool)
|
|||
std::string code, comment;
|
||||
if (wait && FLAVOR_IS_NOT(gcfTeacup)) {
|
||||
code = "M109";
|
||||
comment = "wait for temperature to be reached";
|
||||
comment = "set temperature and wait for it to be reached";
|
||||
} else {
|
||||
code = "M104";
|
||||
comment = "set temperature";
|
||||
|
@ -110,7 +110,7 @@ GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool)
|
|||
}
|
||||
|
||||
std::string
|
||||
GCodeWriter::set_bed_temperature(unsigned int temperature, bool wait)
|
||||
GCodeWriter::set_bed_temperature(unsigned int temperature, bool wait) const
|
||||
{
|
||||
std::string code, comment;
|
||||
if (wait && FLAVOR_IS_NOT(gcfTeacup)) {
|
||||
|
@ -119,10 +119,10 @@ GCodeWriter::set_bed_temperature(unsigned int temperature, bool wait)
|
|||
} else {
|
||||
code = "M190";
|
||||
}
|
||||
comment = "set bed temperature";
|
||||
comment = "set bed temperature and wait for it to be reached";
|
||||
} else {
|
||||
code = "M140";
|
||||
comment = "wait for bed temperature to be reached";
|
||||
comment = "set bed temperature";
|
||||
}
|
||||
|
||||
std::ostringstream gcode;
|
||||
|
@ -217,7 +217,7 @@ GCodeWriter::reset_e(bool force)
|
|||
}
|
||||
|
||||
std::string
|
||||
GCodeWriter::update_progress(unsigned int num, unsigned int tot, bool allow_100)
|
||||
GCodeWriter::update_progress(unsigned int num, unsigned int tot, bool allow_100) const
|
||||
{
|
||||
if (FLAVOR_IS_NOT(gcfMakerWare) && FLAVOR_IS_NOT(gcfSailfish))
|
||||
return "";
|
||||
|
@ -273,7 +273,7 @@ GCodeWriter::toolchange(unsigned int extruder_id)
|
|||
}
|
||||
|
||||
std::string
|
||||
GCodeWriter::set_speed(double F, const std::string &comment)
|
||||
GCodeWriter::set_speed(double F, const std::string &comment) const
|
||||
{
|
||||
std::ostringstream gcode;
|
||||
gcode << "G1 F" << F;
|
||||
|
|
|
@ -24,17 +24,17 @@ class GCodeWriter {
|
|||
void apply_print_config(const PrintConfig &print_config);
|
||||
void set_extruders(const std::vector<unsigned int> &extruder_ids);
|
||||
std::string preamble();
|
||||
std::string postamble();
|
||||
std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1);
|
||||
std::string set_bed_temperature(unsigned int temperature, bool wait = false);
|
||||
std::string postamble() const;
|
||||
std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1) const;
|
||||
std::string set_bed_temperature(unsigned int temperature, bool wait = false) const;
|
||||
std::string set_fan(unsigned int speed, bool dont_save = false);
|
||||
std::string set_acceleration(unsigned int acceleration);
|
||||
std::string reset_e(bool force = false);
|
||||
std::string update_progress(unsigned int num, unsigned int tot, bool allow_100 = false);
|
||||
std::string update_progress(unsigned int num, unsigned int tot, bool allow_100 = false) const;
|
||||
bool need_toolchange(unsigned int extruder_id) const;
|
||||
std::string set_extruder(unsigned int extruder_id);
|
||||
std::string toolchange(unsigned int extruder_id);
|
||||
std::string set_speed(double F, const std::string &comment = std::string());
|
||||
std::string set_speed(double F, const std::string &comment = std::string()) const;
|
||||
std::string travel_to_xy(const Pointf &point, const std::string &comment = std::string());
|
||||
std::string travel_to_xyz(const Pointf3 &point, const std::string &comment = std::string());
|
||||
std::string travel_to_z(double z, const std::string &comment = std::string());
|
||||
|
|
|
@ -8,16 +8,16 @@ namespace Slic3r {
|
|||
|
||||
Layer::Layer(size_t id, PrintObject *object, coordf_t height, coordf_t print_z,
|
||||
coordf_t slice_z)
|
||||
: _id(id),
|
||||
_object(object),
|
||||
upper_layer(NULL),
|
||||
: upper_layer(NULL),
|
||||
lower_layer(NULL),
|
||||
regions(),
|
||||
slicing_errors(false),
|
||||
slice_z(slice_z),
|
||||
print_z(print_z),
|
||||
height(height),
|
||||
slices()
|
||||
slices(),
|
||||
_id(id),
|
||||
_object(object)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ Layer::object() const
|
|||
|
||||
|
||||
size_t
|
||||
Layer::region_count()
|
||||
Layer::region_count() const
|
||||
{
|
||||
return this->regions.size();
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ class Layer {
|
|||
ExPolygonCollection slices;
|
||||
|
||||
|
||||
size_t region_count();
|
||||
size_t region_count() const;
|
||||
LayerRegion* get_region(int idx);
|
||||
LayerRegion* add_region(PrintRegion* print_region);
|
||||
|
||||
|
|
|
@ -162,12 +162,10 @@ Model::has_objects_with_no_instances() const
|
|||
bool
|
||||
Model::add_default_instances()
|
||||
{
|
||||
bool added = false;
|
||||
// apply a default position to all objects not having one
|
||||
for (ModelObjectPtrs::const_iterator o = this->objects.begin(); o != this->objects.end(); ++o) {
|
||||
if ((*o)->instances.empty()) {
|
||||
(*o)->add_instance();
|
||||
added = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -248,7 +246,7 @@ REGISTER_CLASS(Model, "Model");
|
|||
|
||||
ModelMaterial::ModelMaterial(Model *model) : model(model) {}
|
||||
ModelMaterial::ModelMaterial(Model *model, const ModelMaterial &other)
|
||||
: model(model), config(other.config), attributes(other.attributes)
|
||||
: attributes(other.attributes), config(other.config), model(model)
|
||||
{}
|
||||
|
||||
void
|
||||
|
@ -268,8 +266,7 @@ ModelObject::ModelObject(Model *model)
|
|||
{}
|
||||
|
||||
ModelObject::ModelObject(Model *model, const ModelObject &other, bool copy_volumes)
|
||||
: model(model),
|
||||
name(other.name),
|
||||
: name(other.name),
|
||||
input_file(other.input_file),
|
||||
instances(),
|
||||
volumes(),
|
||||
|
@ -277,7 +274,8 @@ ModelObject::ModelObject(Model *model, const ModelObject &other, bool copy_volum
|
|||
layer_height_ranges(other.layer_height_ranges),
|
||||
origin_translation(other.origin_translation),
|
||||
_bounding_box(other._bounding_box),
|
||||
_bounding_box_valid(other._bounding_box_valid)
|
||||
_bounding_box_valid(other._bounding_box_valid),
|
||||
model(model)
|
||||
{
|
||||
if (copy_volumes) {
|
||||
this->volumes.reserve(other.volumes.size());
|
||||
|
@ -531,10 +529,10 @@ ModelObject::rotate(float angle, const Axis &axis)
|
|||
}
|
||||
|
||||
void
|
||||
ModelObject::flip(const Axis &axis)
|
||||
ModelObject::mirror(const Axis &axis)
|
||||
{
|
||||
for (ModelVolumePtrs::const_iterator v = this->volumes.begin(); v != this->volumes.end(); ++v) {
|
||||
(*v)->mesh.flip(axis);
|
||||
(*v)->mesh.mirror(axis);
|
||||
}
|
||||
this->origin_translation = Pointf3(0,0,0);
|
||||
this->invalidate_bounding_box();
|
||||
|
@ -647,12 +645,12 @@ REGISTER_CLASS(ModelObject, "Model::Object");
|
|||
|
||||
|
||||
ModelVolume::ModelVolume(ModelObject* object, const TriangleMesh &mesh)
|
||||
: object(object), mesh(mesh), modifier(false)
|
||||
: mesh(mesh), modifier(false), object(object)
|
||||
{}
|
||||
|
||||
ModelVolume::ModelVolume(ModelObject* object, const ModelVolume &other)
|
||||
: object(object), name(other.name), mesh(other.mesh), config(other.config),
|
||||
modifier(other.modifier)
|
||||
: name(other.name), mesh(other.mesh), config(other.config),
|
||||
modifier(other.modifier), object(object)
|
||||
{
|
||||
this->material_id(other.material_id());
|
||||
}
|
||||
|
@ -701,11 +699,11 @@ REGISTER_CLASS(ModelVolume, "Model::Volume");
|
|||
|
||||
|
||||
ModelInstance::ModelInstance(ModelObject *object)
|
||||
: object(object), rotation(0), scaling_factor(1)
|
||||
: rotation(0), scaling_factor(1), object(object)
|
||||
{}
|
||||
|
||||
ModelInstance::ModelInstance(ModelObject *object, const ModelInstance &other)
|
||||
: object(object), rotation(other.rotation), scaling_factor(other.scaling_factor), offset(other.offset)
|
||||
: rotation(other.rotation), scaling_factor(other.scaling_factor), offset(other.offset), object(object)
|
||||
{}
|
||||
|
||||
void
|
||||
|
|
|
@ -130,7 +130,7 @@ class ModelObject
|
|||
void translate(coordf_t x, coordf_t y, coordf_t z);
|
||||
void scale(const Pointf3 &versor);
|
||||
void rotate(float angle, const Axis &axis);
|
||||
void flip(const Axis &axis);
|
||||
void mirror(const Axis &axis);
|
||||
size_t materials_count() const;
|
||||
size_t facets_count() const;
|
||||
bool needed_repair() const;
|
||||
|
|
|
@ -73,7 +73,7 @@ MotionPlanner::initialize()
|
|||
}
|
||||
|
||||
ExPolygonCollection
|
||||
MotionPlanner::get_env(size_t island_idx) const
|
||||
MotionPlanner::get_env(int island_idx) const
|
||||
{
|
||||
if (island_idx == -1) {
|
||||
return ExPolygonCollection(this->outer);
|
||||
|
@ -127,13 +127,12 @@ MotionPlanner::shortest_path(const Point &from, const Point &to)
|
|||
// Now check whether points are inside the environment.
|
||||
Point inner_from = from;
|
||||
Point inner_to = to;
|
||||
bool from_is_inside, to_is_inside;
|
||||
|
||||
if (!(from_is_inside = env.contains(from))) {
|
||||
|
||||
if (!env.contains(from)) {
|
||||
// Find the closest inner point to start from.
|
||||
inner_from = this->nearest_env_point(env, from, to);
|
||||
}
|
||||
if (!(to_is_inside = env.contains(to))) {
|
||||
if (!env.contains(to)) {
|
||||
// Find the closest inner point to start from.
|
||||
inner_to = this->nearest_env_point(env, to, inner_from);
|
||||
}
|
||||
|
@ -362,7 +361,7 @@ MotionPlannerGraph::shortest_path(size_t from, size_t to)
|
|||
const std::vector<neighbor> &neighbors = this->adjacency_list[u];
|
||||
for (std::vector<neighbor>::const_iterator neighbor_iter = neighbors.begin();
|
||||
neighbor_iter != neighbors.end();
|
||||
neighbor_iter++)
|
||||
++neighbor_iter)
|
||||
{
|
||||
// neighbor node is v
|
||||
node_t v = neighbor_iter->target;
|
||||
|
|
|
@ -33,7 +33,7 @@ class MotionPlanner
|
|||
|
||||
void initialize();
|
||||
MotionPlannerGraph* init_graph(int island_idx);
|
||||
ExPolygonCollection get_env(size_t island_idx) const;
|
||||
ExPolygonCollection get_env(int island_idx) const;
|
||||
Point nearest_env_point(const ExPolygonCollection &env, const Point &from, const Point &to) const;
|
||||
};
|
||||
|
||||
|
@ -42,7 +42,7 @@ class MotionPlannerGraph
|
|||
friend class MotionPlanner;
|
||||
|
||||
private:
|
||||
typedef size_t node_t;
|
||||
typedef int node_t;
|
||||
typedef double weight_t;
|
||||
struct neighbor {
|
||||
node_t target;
|
||||
|
|
|
@ -22,7 +22,7 @@ class PerimeterGeneratorLoop {
|
|||
std::vector<PerimeterGeneratorLoop> children;
|
||||
|
||||
PerimeterGeneratorLoop(Polygon polygon, unsigned short depth)
|
||||
: polygon(polygon), depth(depth), is_contour(false)
|
||||
: polygon(polygon), is_contour(false), depth(depth)
|
||||
{};
|
||||
bool is_external() const;
|
||||
bool is_internal_contour() const;
|
||||
|
@ -50,8 +50,8 @@ class PerimeterGenerator {
|
|||
PrintConfig* print_config, ExtrusionEntityCollection* loops,
|
||||
ExtrusionEntityCollection* gap_fill, SurfaceCollection* fill_surfaces)
|
||||
: slices(slices), lower_slices(NULL), layer_height(layer_height),
|
||||
perimeter_flow(flow), ext_perimeter_flow(flow), overhang_flow(flow),
|
||||
solid_infill_flow(flow), layer_id(-1),
|
||||
layer_id(-1), perimeter_flow(flow), ext_perimeter_flow(flow),
|
||||
overhang_flow(flow), solid_infill_flow(flow),
|
||||
config(config), object_config(object_config), print_config(print_config),
|
||||
loops(loops), gap_fill(gap_fill), fill_surfaces(fill_surfaces),
|
||||
_ext_mm3_per_mm(-1), _mm3_per_mm(-1), _mm3_per_mm_overhang(-1)
|
||||
|
|
|
@ -119,7 +119,7 @@ Polyline::equally_spaced_points(double distance) const
|
|||
double take = segment_length - (len - distance); // how much we take of this segment
|
||||
Line segment(*(it-1), *it);
|
||||
points.push_back(segment.point_at(take));
|
||||
it--;
|
||||
--it;
|
||||
len = -take;
|
||||
}
|
||||
return points;
|
||||
|
|
|
@ -335,6 +335,7 @@ PrintConfigDef::build_def() {
|
|||
|
||||
Options["first_layer_extrusion_width"].type = coFloatOrPercent;
|
||||
Options["first_layer_extrusion_width"].label = "First layer";
|
||||
Options["first_layer_extrusion_width"].category = "Extrusion Width";
|
||||
Options["first_layer_extrusion_width"].tooltip = "Set this to a non-zero value to set a manual extrusion width for first layer. You can use this to force fatter extrudates for better adhesion. If expressed as percentage (for example 120%) it will be computed over first layer height. If set to zero, it will use the Default Extrusion Width.";
|
||||
Options["first_layer_extrusion_width"].sidetext = "mm or % (leave 0 for default)";
|
||||
Options["first_layer_extrusion_width"].cli = "first-layer-extrusion-width=s";
|
||||
|
|
|
@ -150,7 +150,7 @@ class PrintObjectConfig : public virtual StaticPrintConfig
|
|||
this->xy_size_compensation.value = 0;
|
||||
};
|
||||
|
||||
ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
|
||||
ConfigOption* option(const t_config_option_key &opt_key, bool create = false) {
|
||||
OPT_PTR(dont_support_bridges);
|
||||
OPT_PTR(extrusion_width);
|
||||
OPT_PTR(first_layer_height);
|
||||
|
@ -260,7 +260,7 @@ class PrintRegionConfig : public virtual StaticPrintConfig
|
|||
this->top_solid_layers.value = 3;
|
||||
};
|
||||
|
||||
ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
|
||||
ConfigOption* option(const t_config_option_key &opt_key, bool create = false) {
|
||||
OPT_PTR(bottom_solid_layers);
|
||||
OPT_PTR(bridge_flow_ratio);
|
||||
OPT_PTR(bridge_speed);
|
||||
|
@ -359,7 +359,7 @@ class GCodeConfig : public virtual StaticPrintConfig
|
|||
this->use_volumetric_e.value = false;
|
||||
};
|
||||
|
||||
ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
|
||||
ConfigOption* option(const t_config_option_key &opt_key, bool create = false) {
|
||||
OPT_PTR(before_layer_gcode);
|
||||
OPT_PTR(end_gcode);
|
||||
OPT_PTR(extrusion_axis);
|
||||
|
@ -518,7 +518,7 @@ class PrintConfig : public GCodeConfig
|
|||
this->z_offset.value = 0;
|
||||
};
|
||||
|
||||
ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
|
||||
ConfigOption* option(const t_config_option_key &opt_key, bool create = false) {
|
||||
OPT_PTR(avoid_crossing_perimeters);
|
||||
OPT_PTR(bed_shape);
|
||||
OPT_PTR(bed_temperature);
|
||||
|
@ -593,7 +593,7 @@ class HostConfig : public virtual StaticPrintConfig
|
|||
this->serial_speed.value = 250000;
|
||||
};
|
||||
|
||||
ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
|
||||
ConfigOption* option(const t_config_option_key &opt_key, bool create = false) {
|
||||
OPT_PTR(octoprint_host);
|
||||
OPT_PTR(octoprint_apikey);
|
||||
OPT_PTR(serial_port);
|
||||
|
@ -607,7 +607,7 @@ class FullPrintConfig
|
|||
: public PrintObjectConfig, public PrintRegionConfig, public PrintConfig, public HostConfig
|
||||
{
|
||||
public:
|
||||
ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
|
||||
ConfigOption* option(const t_config_option_key &opt_key, bool create = false) {
|
||||
ConfigOption* opt;
|
||||
if ((opt = PrintObjectConfig::option(opt_key, create)) != NULL) return opt;
|
||||
if ((opt = PrintRegionConfig::option(opt_key, create)) != NULL) return opt;
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
namespace Slic3r {
|
||||
|
||||
PrintObject::PrintObject(Print* print, ModelObject* model_object, const BoundingBoxf3 &modobj_bbox)
|
||||
: _print(print),
|
||||
_model_object(model_object),
|
||||
typed_slices(false)
|
||||
: typed_slices(false),
|
||||
_print(print),
|
||||
_model_object(model_object)
|
||||
{
|
||||
// Compute the translation to be applied to our meshes so that we work with smaller coordinates
|
||||
{
|
||||
|
|
|
@ -50,7 +50,7 @@ PrintRegion::flow(FlowRole role, double layer_height, bool bridge, bool first_la
|
|||
|
||||
// get the configured nozzle_diameter for the extruder associated
|
||||
// to the flow role requested
|
||||
size_t extruder; // 1-based
|
||||
size_t extruder = 0; // 1-based
|
||||
if (role == frPerimeter || role == frExternalPerimeter) {
|
||||
extruder = this->config.perimeter_extruder;
|
||||
} else if (role == frInfill) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace Slic3r {
|
||||
|
||||
SVG::SVG(const char* filename)
|
||||
: arrows(true), filename(filename), fill("grey"), stroke("black")
|
||||
: arrows(true), fill("grey"), stroke("black"), filename(filename)
|
||||
{
|
||||
this->f = fopen(filename, "w");
|
||||
fprintf(this->f,
|
||||
|
|
|
@ -100,7 +100,7 @@ TriangleMesh::repair() {
|
|||
stl.stats.facets_w_3_bad_edge = (stl.stats.number_of_facets - stl.stats.connected_facets_1_edge);
|
||||
|
||||
// checking nearby
|
||||
int last_edges_fixed = 0;
|
||||
//int last_edges_fixed = 0;
|
||||
float tolerance = stl.stats.shortest_edge;
|
||||
float increment = stl.stats.bounding_diameter / 10000.0;
|
||||
int iterations = 2;
|
||||
|
@ -110,7 +110,7 @@ TriangleMesh::repair() {
|
|||
//printf("Checking nearby. Tolerance= %f Iteration=%d of %d...", tolerance, i + 1, iterations);
|
||||
stl_check_facets_nearby(&stl, tolerance);
|
||||
//printf(" Fixed %d edges.\n", stl.stats.edges_fixed - last_edges_fixed);
|
||||
last_edges_fixed = stl.stats.edges_fixed;
|
||||
//last_edges_fixed = stl.stats.edges_fixed;
|
||||
tolerance += increment;
|
||||
} else {
|
||||
break;
|
||||
|
@ -230,7 +230,7 @@ void TriangleMesh::rotate_z(float angle)
|
|||
this->rotate(angle, Z);
|
||||
}
|
||||
|
||||
void TriangleMesh::flip(const Axis &axis)
|
||||
void TriangleMesh::mirror(const Axis &axis)
|
||||
{
|
||||
if (axis == X) {
|
||||
stl_mirror_yz(&this->stl);
|
||||
|
@ -242,19 +242,19 @@ void TriangleMesh::flip(const Axis &axis)
|
|||
stl_invalidate_shared_vertices(&this->stl);
|
||||
}
|
||||
|
||||
void TriangleMesh::flip_x()
|
||||
void TriangleMesh::mirror_x()
|
||||
{
|
||||
this->flip(X);
|
||||
this->mirror(X);
|
||||
}
|
||||
|
||||
void TriangleMesh::flip_y()
|
||||
void TriangleMesh::mirror_y()
|
||||
{
|
||||
this->flip(Y);
|
||||
this->mirror(Y);
|
||||
}
|
||||
|
||||
void TriangleMesh::flip_z()
|
||||
void TriangleMesh::mirror_z()
|
||||
{
|
||||
this->flip(Z);
|
||||
this->mirror(Z);
|
||||
}
|
||||
|
||||
void TriangleMesh::align_to_origin()
|
||||
|
@ -316,7 +316,7 @@ TriangleMesh::split() const
|
|||
stl_allocate(&mesh->stl);
|
||||
|
||||
int first = 1;
|
||||
for (std::deque<int>::const_iterator facet = facets.begin(); facet != facets.end(); facet++) {
|
||||
for (std::deque<int>::const_iterator facet = facets.begin(); facet != facets.end(); ++facet) {
|
||||
mesh->stl.facet_start[facet - facets.begin()] = this->stl.facet_start[*facet];
|
||||
stl_facet_stats(&mesh->stl, this->stl.facet_start[*facet], first);
|
||||
first = 0;
|
||||
|
@ -429,7 +429,7 @@ void TriangleMesh::ReadFromPerl(SV* vertices, SV* facets)
|
|||
|
||||
// read geometry
|
||||
AV* vertices_av = (AV*)SvRV(vertices);
|
||||
for (unsigned int i = 0; i < stl.stats.number_of_facets; i++) {
|
||||
for (int i = 0; i < stl.stats.number_of_facets; i++) {
|
||||
AV* facet_av = (AV*)SvRV(*av_fetch(facets_av, i, 0));
|
||||
stl_facet facet;
|
||||
facet.normal.x = 0;
|
||||
|
|
|
@ -36,10 +36,10 @@ class TriangleMesh
|
|||
void rotate_x(float angle);
|
||||
void rotate_y(float angle);
|
||||
void rotate_z(float angle);
|
||||
void flip(const Axis &axis);
|
||||
void flip_x();
|
||||
void flip_y();
|
||||
void flip_z();
|
||||
void mirror(const Axis &axis);
|
||||
void mirror_x();
|
||||
void mirror_y();
|
||||
void mirror_z();
|
||||
void align_to_origin();
|
||||
void rotate(double angle, Point* center);
|
||||
TriangleMeshPtrs split() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue