mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 00:01:09 -06:00
Merge branch 'master' into boost-medialaxis
Conflicts: lib/Slic3r/Layer/Region.pm xs/src/ExPolygon.cpp xs/src/Point.cpp xs/src/Point.hpp xs/src/TriangleMesh.cpp xs/t/01_trianglemesh.t
This commit is contained in:
commit
eadffe4a9e
72 changed files with 1928 additions and 949 deletions
|
@ -111,12 +111,12 @@ ConfigBase::get(t_config_option_key opt_key) {
|
|||
return newRV_noinc((SV*)av);
|
||||
} else if (ConfigOptionString* optv = dynamic_cast<ConfigOptionString*>(opt)) {
|
||||
// we don't serialize() because that would escape newlines
|
||||
return newSVpvn(optv->value.c_str(), optv->value.length());
|
||||
return newSVpvn_utf8(optv->value.c_str(), optv->value.length(), true);
|
||||
} else if (ConfigOptionStrings* optv = dynamic_cast<ConfigOptionStrings*>(opt)) {
|
||||
AV* av = newAV();
|
||||
av_fill(av, optv->values.size()-1);
|
||||
for (std::vector<std::string>::iterator it = optv->values.begin(); it != optv->values.end(); ++it)
|
||||
av_store(av, it - optv->values.begin(), newSVpvn(it->c_str(), it->length()));
|
||||
av_store(av, it - optv->values.begin(), newSVpvn_utf8(it->c_str(), it->length(), true));
|
||||
return newRV_noinc((SV*)av);
|
||||
} else if (ConfigOptionPoint* optv = dynamic_cast<ConfigOptionPoint*>(opt)) {
|
||||
return optv->point.to_SV_pureperl();
|
||||
|
@ -136,7 +136,7 @@ ConfigBase::get(t_config_option_key opt_key) {
|
|||
return newRV_noinc((SV*)av);
|
||||
} else {
|
||||
std::string serialized = opt->serialize();
|
||||
return newSVpvn(serialized.c_str(), serialized.length());
|
||||
return newSVpvn_utf8(serialized.c_str(), serialized.length(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ ConfigBase::get_at(t_config_option_key opt_key, size_t i) {
|
|||
} else if (ConfigOptionStrings* optv = dynamic_cast<ConfigOptionStrings*>(opt)) {
|
||||
// we don't serialize() because that would escape newlines
|
||||
std::string val = optv->get_at(i);
|
||||
return newSVpvn(val.c_str(), val.length());
|
||||
return newSVpvn_utf8(val.c_str(), val.length(), true);
|
||||
} else if (ConfigOptionPoints* optv = dynamic_cast<ConfigOptionPoints*>(opt)) {
|
||||
return optv->get_at(i).to_SV_pureperl();
|
||||
} else if (ConfigOptionBools* optv = dynamic_cast<ConfigOptionBools*>(opt)) {
|
||||
|
@ -289,6 +289,11 @@ DynamicConfig::keys(t_config_option_keys *keys) {
|
|||
keys->push_back(it->first);
|
||||
}
|
||||
|
||||
void
|
||||
DynamicConfig::erase(const t_config_option_key opt_key) {
|
||||
this->options.erase(opt_key);
|
||||
}
|
||||
|
||||
void
|
||||
StaticConfig::keys(t_config_option_keys *keys) {
|
||||
for (t_optiondef_map::const_iterator it = this->def->begin(); it != this->def->end(); ++it) {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
#ifndef slic3r_Config_hpp_
|
||||
#define slic3r_Config_hpp_
|
||||
|
||||
#include <myinit.h>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <climits>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
@ -11,6 +9,7 @@
|
|||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <myinit.h>
|
||||
#include "Point.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
@ -379,7 +378,6 @@ class ConfigOptionDef
|
|||
std::string tooltip;
|
||||
std::string sidetext;
|
||||
std::string cli;
|
||||
std::string scope;
|
||||
t_config_option_key ratio_over;
|
||||
bool multiline;
|
||||
bool full_width;
|
||||
|
@ -430,6 +428,7 @@ class DynamicConfig : public ConfigBase
|
|||
~DynamicConfig();
|
||||
ConfigOption* option(const t_config_option_key opt_key, bool create = false);
|
||||
void keys(t_config_option_keys *keys);
|
||||
void erase(const t_config_option_key opt_key);
|
||||
|
||||
private:
|
||||
DynamicConfig(const DynamicConfig& other); // we disable this by making it private and unimplemented
|
||||
|
|
|
@ -20,6 +20,7 @@ ExPolygon::operator Points() const
|
|||
ExPolygon::operator Polygons() const
|
||||
{
|
||||
Polygons polygons;
|
||||
polygons.reserve(this->holes.size() + 1);
|
||||
polygons.push_back(this->contour);
|
||||
for (Polygons::const_iterator it = this->holes.begin(); it != this->holes.end(); ++it) {
|
||||
polygons.push_back(*it);
|
||||
|
@ -77,7 +78,7 @@ ExPolygon::is_valid() const
|
|||
bool
|
||||
ExPolygon::contains_line(const Line* line) const
|
||||
{
|
||||
Polylines pl(1);
|
||||
Polylines pl;
|
||||
pl.push_back(*line);
|
||||
|
||||
Polylines pl_out;
|
||||
|
@ -98,7 +99,8 @@ ExPolygon::contains_point(const Point* point) const
|
|||
Polygons
|
||||
ExPolygon::simplify_p(double tolerance) const
|
||||
{
|
||||
Polygons pp(this->holes.size() + 1);
|
||||
Polygons pp;
|
||||
pp.reserve(this->holes.size() + 1);
|
||||
|
||||
// contour
|
||||
Polygon p = this->contour;
|
||||
|
@ -211,6 +213,8 @@ void
|
|||
ExPolygon::from_SV_check(SV* expoly_sv)
|
||||
{
|
||||
if (sv_isobject(expoly_sv) && (SvTYPE(SvRV(expoly_sv)) == SVt_PVMG)) {
|
||||
if (!sv_isa(expoly_sv, "Slic3r::ExPolygon") && !sv_isa(expoly_sv, "Slic3r::ExPolygon::Ref"))
|
||||
CONFESS("Not a valid Slic3r::ExPolygon object");
|
||||
// a XS ExPolygon was supplied
|
||||
*this = *(ExPolygon *)SvIV((SV*)SvRV( expoly_sv ));
|
||||
} else {
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
#include "Line.hpp"
|
||||
#include "Polyline.hpp"
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
std::string
|
||||
Line::wkt() const
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << "LINESTRING(" << this->a.x << " " << this->a.y << ","
|
||||
<< this->b.x << " " << this->b.y << ")";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
Line::operator Polyline() const
|
||||
{
|
||||
Polyline pl;
|
||||
|
@ -88,6 +98,8 @@ void
|
|||
Line::from_SV_check(SV* line_sv)
|
||||
{
|
||||
if (sv_isobject(line_sv) && (SvTYPE(SvRV(line_sv)) == SVt_PVMG)) {
|
||||
if (!sv_isa(line_sv, "Slic3r::Line") && !sv_isa(line_sv, "Slic3r::Line::Ref"))
|
||||
CONFESS("Not a valid Slic3r::Line object");
|
||||
*this = *(Line*)SvIV((SV*)SvRV( line_sv ));
|
||||
} else {
|
||||
this->from_SV(line_sv);
|
||||
|
|
|
@ -17,6 +17,7 @@ class Line
|
|||
Point b;
|
||||
Line() {};
|
||||
explicit Line(Point _a, Point _b): a(_a), b(_b) {};
|
||||
std::string wkt() const;
|
||||
operator Polyline() const;
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
|
|
|
@ -1,14 +1,24 @@
|
|||
#include <cmath>
|
||||
#include <sstream>
|
||||
#include "Point.hpp"
|
||||
#include "Line.hpp"
|
||||
#include <cmath>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
bool
|
||||
Point::operator==(const Point& rhs) const {
|
||||
Point::operator==(const Point& rhs) const
|
||||
{
|
||||
return this->coincides_with(rhs);
|
||||
}
|
||||
|
||||
std::string
|
||||
Point::wkt() const
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << "POINT(" << this->x << " " << this->y << ")";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
void
|
||||
Point::scale(double factor)
|
||||
{
|
||||
|
@ -105,8 +115,8 @@ Point::distance_to(const Line &line) const
|
|||
{
|
||||
if (line.a.coincides_with(&line.b)) return this->distance_to(&line.a);
|
||||
|
||||
double n = (line.b.x - line.a.x) * (line.a.y - this->y)
|
||||
- (line.a.x - this->x) * (line.b.y - line.a.y);
|
||||
double n = (double)(line.b.x - line.a.x) * (double)(line.a.y - this->y)
|
||||
- (double)(line.a.x - this->x) * (double)(line.b.y - line.a.y);
|
||||
|
||||
return std::abs(n) / line.length();
|
||||
}
|
||||
|
@ -121,7 +131,7 @@ Point::distance_to(const Line &line) const
|
|||
double
|
||||
Point::ccw(const Point &p1, const Point &p2) const
|
||||
{
|
||||
return (p2.x - p1.x)*(this->y - p1.y) - (p2.y - p1.y)*(this->x - p1.x);
|
||||
return (double)(p2.x - p1.x)*(double)(this->y - p1.y) - (double)(p2.y - p1.y)*(double)(this->x - p1.x);
|
||||
}
|
||||
|
||||
double
|
||||
|
@ -174,6 +184,8 @@ void
|
|||
Point::from_SV_check(SV* point_sv)
|
||||
{
|
||||
if (sv_isobject(point_sv) && (SvTYPE(SvRV(point_sv)) == SVt_PVMG)) {
|
||||
if (!sv_isa(point_sv, "Slic3r::Point") && !sv_isa(point_sv, "Slic3r::Point::Ref"))
|
||||
CONFESS("Not a valid Slic3r::Point object");
|
||||
*this = *(Point*)SvIV((SV*)SvRV( point_sv ));
|
||||
} else {
|
||||
this->from_SV(point_sv);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <vector>
|
||||
#include <math.h>
|
||||
#include <boost/polygon/polygon.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
@ -22,6 +23,7 @@ class Point
|
|||
coord_t y;
|
||||
explicit Point(coord_t _x = 0, coord_t _y = 0): x(_x), y(_y) {};
|
||||
bool operator==(const Point& rhs) const;
|
||||
std::string wkt() const;
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
void rotate(double angle, Point* center);
|
||||
|
|
|
@ -172,6 +172,15 @@ Polygon::to_SV_clone_ref() const {
|
|||
sv_setref_pv( sv, "Slic3r::Polygon", new Polygon(*this) );
|
||||
return sv;
|
||||
}
|
||||
|
||||
void
|
||||
Polygon::from_SV_check(SV* poly_sv)
|
||||
{
|
||||
if (sv_isobject(poly_sv) && !sv_isa(poly_sv, "Slic3r::Polygon") && !sv_isa(poly_sv, "Slic3r::Polygon::Ref"))
|
||||
CONFESS("Not a valid Slic3r::Polygon object");
|
||||
|
||||
MultiPoint::from_SV_check(poly_sv);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ class Polygon : public MultiPoint {
|
|||
void simplify(double tolerance, Polygons &polygons) const;
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
void from_SV_check(SV* poly_sv);
|
||||
SV* to_SV_ref();
|
||||
SV* to_SV_clone_ref() const;
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace Slic3r {
|
|||
|
||||
Polyline::operator Polylines() const
|
||||
{
|
||||
Polylines polylines(1);
|
||||
Polylines polylines;
|
||||
polylines.push_back(*this);
|
||||
return polylines;
|
||||
}
|
||||
|
@ -110,6 +110,15 @@ Polyline::to_SV_clone_ref() const
|
|||
sv_setref_pv( sv, "Slic3r::Polyline", new Polyline(*this) );
|
||||
return sv;
|
||||
}
|
||||
|
||||
void
|
||||
Polyline::from_SV_check(SV* poly_sv)
|
||||
{
|
||||
if (!sv_isa(poly_sv, "Slic3r::Polyline") && !sv_isa(poly_sv, "Slic3r::Polyline::Ref"))
|
||||
CONFESS("Not a valid Slic3r::Polyline object");
|
||||
|
||||
MultiPoint::from_SV_check(poly_sv);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ class Polyline : public MultiPoint {
|
|||
void simplify(double tolerance);
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
void from_SV_check(SV* poly_sv);
|
||||
SV* to_SV_ref();
|
||||
SV* to_SV_clone_ref() const;
|
||||
#endif
|
||||
|
|
|
@ -82,7 +82,6 @@ class PrintConfigDef
|
|||
Options["bottom_solid_layers"].category = "Layers and Perimeters";
|
||||
Options["bottom_solid_layers"].tooltip = "Number of solid layers to generate on bottom surfaces.";
|
||||
Options["bottom_solid_layers"].cli = "bottom-solid-layers=i";
|
||||
Options["bottom_solid_layers"].scope = "object";
|
||||
Options["bottom_solid_layers"].full_label = "Bottom solid layers";
|
||||
|
||||
Options["bridge_acceleration"].type = coFloat;
|
||||
|
@ -171,7 +170,6 @@ class PrintConfigDef
|
|||
Options["extra_perimeters"].category = "Layers and Perimeters";
|
||||
Options["extra_perimeters"].tooltip = "Add more perimeters when needed for avoiding gaps in sloping walls.";
|
||||
Options["extra_perimeters"].cli = "extra-perimeters!";
|
||||
Options["extra_perimeters"].scope = "object";
|
||||
|
||||
Options["extruder"].type = coInt;
|
||||
Options["extruder"].label = "Extruder";
|
||||
|
@ -211,6 +209,7 @@ class PrintConfigDef
|
|||
|
||||
Options["extrusion_width"].type = coFloatOrPercent;
|
||||
Options["extrusion_width"].label = "Default extrusion width";
|
||||
Options["extrusion_width"].category = "Extrusion Width";
|
||||
Options["extrusion_width"].tooltip = "Set this to a non-zero value to set a manual extrusion width. If left to zero, Slic3r calculates a width automatically. If expressed as percentage (for example: 230%) it will be computed over layer height.";
|
||||
Options["extrusion_width"].sidetext = "mm or % (leave 0 for auto)";
|
||||
Options["extrusion_width"].cli = "extrusion-width=s";
|
||||
|
@ -236,6 +235,7 @@ class PrintConfigDef
|
|||
|
||||
Options["fill_angle"].type = coInt;
|
||||
Options["fill_angle"].label = "Fill angle";
|
||||
Options["fill_angle"].category = "Infill";
|
||||
Options["fill_angle"].tooltip = "Default base angle for infill orientation. Cross-hatching will be applied to this. Bridges will be infilled using the best direction Slic3r can detect, so this setting does not affect them.";
|
||||
Options["fill_angle"].sidetext = "°";
|
||||
Options["fill_angle"].cli = "fill-angle=i";
|
||||
|
@ -246,14 +246,12 @@ class PrintConfigDef
|
|||
Options["fill_density"].category = "Infill";
|
||||
Options["fill_density"].tooltip = "Density of internal infill, expressed in the range 0 - 1.";
|
||||
Options["fill_density"].cli = "fill-density=f";
|
||||
Options["fill_density"].scope = "object";
|
||||
|
||||
Options["fill_pattern"].type = coEnum;
|
||||
Options["fill_pattern"].label = "Fill pattern";
|
||||
Options["fill_pattern"].category = "Infill";
|
||||
Options["fill_pattern"].tooltip = "Fill pattern for general low-density infill.";
|
||||
Options["fill_pattern"].cli = "fill-pattern=s";
|
||||
Options["fill_pattern"].scope = "object";
|
||||
Options["fill_pattern"].enum_keys_map = ConfigOptionEnum<InfillPattern>::get_enum_values();
|
||||
Options["fill_pattern"].enum_values.push_back("rectilinear");
|
||||
Options["fill_pattern"].enum_values.push_back("line");
|
||||
|
@ -285,12 +283,14 @@ class PrintConfigDef
|
|||
|
||||
Options["first_layer_extrusion_width"].type = coFloatOrPercent;
|
||||
Options["first_layer_extrusion_width"].label = "First layer";
|
||||
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%) if will be computed over layer height.";
|
||||
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%) if will be computed over first layer height.";
|
||||
Options["first_layer_extrusion_width"].sidetext = "mm or % (leave 0 for default)";
|
||||
Options["first_layer_extrusion_width"].cli = "first-layer-extrusion-width=s";
|
||||
Options["first_layer_extrusion_width"].ratio_over = "first_layer_height";
|
||||
|
||||
Options["first_layer_height"].type = coFloatOrPercent;
|
||||
Options["first_layer_height"].label = "First layer height";
|
||||
Options["first_layer_height"].category = "Layers and Perimeters";
|
||||
Options["first_layer_height"].tooltip = "When printing with very low layer heights, you might still want to print a thicker bottom layer to improve adhesion and tolerance for non perfect build plates. This can be expressed as an absolute value or as a percentage (for example: 150%) over the default layer height.";
|
||||
Options["first_layer_height"].sidetext = "mm or %";
|
||||
Options["first_layer_height"].cli = "first-layer-height=s";
|
||||
|
@ -360,17 +360,18 @@ class PrintConfigDef
|
|||
Options["infill_every_layers"].tooltip = "This feature allows to combine infill and speed up your print by extruding thicker infill layers while preserving thin perimeters, thus accuracy.";
|
||||
Options["infill_every_layers"].sidetext = "layers";
|
||||
Options["infill_every_layers"].cli = "infill-every-layers=i";
|
||||
Options["infill_every_layers"].scope = "object";
|
||||
Options["infill_every_layers"].full_label = "Combine infill every n layers";
|
||||
Options["infill_every_layers"].min = 1;
|
||||
|
||||
Options["infill_extruder"].type = coInt;
|
||||
Options["infill_extruder"].label = "Infill extruder";
|
||||
Options["infill_extruder"].category = "Extruders";
|
||||
Options["infill_extruder"].tooltip = "The extruder to use when printing infill.";
|
||||
Options["infill_extruder"].cli = "infill-extruder=i";
|
||||
|
||||
Options["infill_extrusion_width"].type = coFloatOrPercent;
|
||||
Options["infill_extrusion_width"].label = "Infill";
|
||||
Options["infill_extrusion_width"].category = "Extrusion Width";
|
||||
Options["infill_extrusion_width"].tooltip = "Set this to a non-zero value to set a manual extrusion width for infill. You may want to use fatter extrudates to speed up the infill and make your parts stronger. If expressed as percentage (for example 90%) if will be computed over layer height.";
|
||||
Options["infill_extrusion_width"].sidetext = "mm or % (leave 0 for default)";
|
||||
Options["infill_extrusion_width"].cli = "infill-extrusion-width=s";
|
||||
|
@ -385,7 +386,6 @@ class PrintConfigDef
|
|||
Options["infill_only_where_needed"].category = "Infill";
|
||||
Options["infill_only_where_needed"].tooltip = "This option will limit infill to the areas actually needed for supporting ceilings (it will act as internal support material).";
|
||||
Options["infill_only_where_needed"].cli = "infill-only-where-needed!";
|
||||
Options["infill_only_where_needed"].scope = "object";
|
||||
|
||||
Options["infill_speed"].type = coFloat;
|
||||
Options["infill_speed"].label = "Infill";
|
||||
|
@ -405,6 +405,7 @@ class PrintConfigDef
|
|||
|
||||
Options["layer_height"].type = coFloat;
|
||||
Options["layer_height"].label = "Layer height";
|
||||
Options["layer_height"].category = "Layers and Perimeters";
|
||||
Options["layer_height"].tooltip = "This setting controls the height (and thus the total number) of the slices/layers. Thinner layers give better accuracy but take more time to print.";
|
||||
Options["layer_height"].sidetext = "mm";
|
||||
Options["layer_height"].cli = "layer-height=f";
|
||||
|
@ -472,7 +473,6 @@ class PrintConfigDef
|
|||
Options["overhangs"].category = "Layers and Perimeters";
|
||||
Options["overhangs"].tooltip = "Experimental option to adjust flow for overhangs (bridge flow will be used), to apply bridge speed to them and enable fan.";
|
||||
Options["overhangs"].cli = "overhangs!";
|
||||
Options["overhangs"].scope = "object";
|
||||
|
||||
Options["perimeter_acceleration"].type = coFloat;
|
||||
Options["perimeter_acceleration"].label = "Perimeters";
|
||||
|
@ -482,12 +482,14 @@ class PrintConfigDef
|
|||
|
||||
Options["perimeter_extruder"].type = coInt;
|
||||
Options["perimeter_extruder"].label = "Perimeter extruder";
|
||||
Options["perimeter_extruder"].category = "Extruders";
|
||||
Options["perimeter_extruder"].tooltip = "The extruder to use when printing perimeters.";
|
||||
Options["perimeter_extruder"].cli = "perimeter-extruder=i";
|
||||
Options["perimeter_extruder"].aliases.push_back("perimeters_extruder");
|
||||
|
||||
Options["perimeter_extrusion_width"].type = coFloatOrPercent;
|
||||
Options["perimeter_extrusion_width"].label = "Perimeters";
|
||||
Options["perimeter_extrusion_width"].category = "Extrusion Width";
|
||||
Options["perimeter_extrusion_width"].tooltip = "Set this to a non-zero value to set a manual extrusion width for perimeters. You may want to use thinner extrudates to get more accurate surfaces. If expressed as percentage (for example 90%) if will be computed over layer height.";
|
||||
Options["perimeter_extrusion_width"].sidetext = "mm or % (leave 0 for default)";
|
||||
Options["perimeter_extrusion_width"].cli = "perimeter-extrusion-width=s";
|
||||
|
@ -505,7 +507,6 @@ class PrintConfigDef
|
|||
Options["perimeters"].category = "Layers and Perimeters";
|
||||
Options["perimeters"].tooltip = "This option sets the number of perimeters to generate for each layer. Note that Slic3r may increase this number automatically when it detects sloping surfaces which benefit from a higher number of perimeters if the Extra Perimeters option is enabled.";
|
||||
Options["perimeters"].cli = "perimeters=i";
|
||||
Options["perimeters"].scope = "object";
|
||||
Options["perimeters"].aliases.push_back("perimeter_offsets");
|
||||
|
||||
Options["post_process"].type = coStrings;
|
||||
|
@ -528,7 +529,6 @@ class PrintConfigDef
|
|||
Options["raft_layers"].tooltip = "The object will be raised by this number of layers, and support material will be generated under it.";
|
||||
Options["raft_layers"].sidetext = "layers";
|
||||
Options["raft_layers"].cli = "raft-layers=i";
|
||||
Options["raft_layers"].scope = "object";
|
||||
|
||||
Options["randomize_start"].type = coBool;
|
||||
Options["randomize_start"].label = "Randomize starting points";
|
||||
|
@ -627,7 +627,6 @@ class PrintConfigDef
|
|||
Options["solid_fill_pattern"].category = "Infill";
|
||||
Options["solid_fill_pattern"].tooltip = "Fill pattern for top/bottom infill.";
|
||||
Options["solid_fill_pattern"].cli = "solid-fill-pattern=s";
|
||||
Options["solid_fill_pattern"].scope = "object";
|
||||
Options["solid_fill_pattern"].enum_keys_map = ConfigOptionEnum<InfillPattern>::get_enum_values();
|
||||
Options["solid_fill_pattern"].enum_values.push_back("rectilinear");
|
||||
Options["solid_fill_pattern"].enum_values.push_back("concentric");
|
||||
|
@ -646,7 +645,6 @@ class PrintConfigDef
|
|||
Options["solid_infill_below_area"].tooltip = "Force solid infill for regions having a smaller area than the specified threshold.";
|
||||
Options["solid_infill_below_area"].sidetext = "mm²";
|
||||
Options["solid_infill_below_area"].cli = "solid-infill-below-area=f";
|
||||
Options["solid_infill_below_area"].scope = "object";
|
||||
|
||||
Options["solid_infill_every_layers"].type = coInt;
|
||||
Options["solid_infill_every_layers"].label = "Solid infill every";
|
||||
|
@ -654,11 +652,11 @@ class PrintConfigDef
|
|||
Options["solid_infill_every_layers"].tooltip = "This feature allows to force a solid layer every given number of layers. Zero to disable.";
|
||||
Options["solid_infill_every_layers"].sidetext = "layers";
|
||||
Options["solid_infill_every_layers"].cli = "solid-infill-every-layers=i";
|
||||
Options["solid_infill_every_layers"].scope = "object";
|
||||
Options["solid_infill_every_layers"].min = 0;
|
||||
|
||||
Options["solid_infill_extrusion_width"].type = coFloatOrPercent;
|
||||
Options["solid_infill_extrusion_width"].label = "Solid infill";
|
||||
Options["solid_infill_extrusion_width"].category = "Extrusion Width";
|
||||
Options["solid_infill_extrusion_width"].tooltip = "Set this to a non-zero value to set a manual extrusion width for infill for solid surfaces. If expressed as percentage (for example 90%) if will be computed over layer height.";
|
||||
Options["solid_infill_extrusion_width"].sidetext = "mm or % (leave 0 for default)";
|
||||
Options["solid_infill_extrusion_width"].cli = "solid-infill-extrusion-width=s";
|
||||
|
@ -714,7 +712,6 @@ class PrintConfigDef
|
|||
Options["support_material"].category = "Support material";
|
||||
Options["support_material"].tooltip = "Enable support material generation.";
|
||||
Options["support_material"].cli = "support-material!";
|
||||
Options["support_material"].scope = "object";
|
||||
|
||||
Options["support_material_angle"].type = coInt;
|
||||
Options["support_material_angle"].label = "Pattern angle";
|
||||
|
@ -722,7 +719,6 @@ class PrintConfigDef
|
|||
Options["support_material_angle"].tooltip = "Use this setting to rotate the support material pattern on the horizontal plane.";
|
||||
Options["support_material_angle"].sidetext = "°";
|
||||
Options["support_material_angle"].cli = "support-material-angle=i";
|
||||
Options["support_material_angle"].scope = "object";
|
||||
|
||||
Options["support_material_enforce_layers"].type = coInt;
|
||||
Options["support_material_enforce_layers"].label = "Enforce support for the first";
|
||||
|
@ -730,22 +726,24 @@ class PrintConfigDef
|
|||
Options["support_material_enforce_layers"].tooltip = "Generate support material for the specified number of layers counting from bottom, regardless of whether normal support material is enabled or not and regardless of any angle threshold. This is useful for getting more adhesion of objects having a very thin or poor footprint on the build plate.";
|
||||
Options["support_material_enforce_layers"].sidetext = "layers";
|
||||
Options["support_material_enforce_layers"].cli = "support-material-enforce-layers=f";
|
||||
Options["support_material_enforce_layers"].scope = "object";
|
||||
Options["support_material_enforce_layers"].full_label = "Enforce support for the first n layers";
|
||||
|
||||
Options["support_material_extruder"].type = coInt;
|
||||
Options["support_material_extruder"].label = "Support material extruder";
|
||||
Options["support_material_extruder"].category = "Extruders";
|
||||
Options["support_material_extruder"].tooltip = "The extruder to use when printing support material. This affects brim and raft too.";
|
||||
Options["support_material_extruder"].cli = "support-material-extruder=i";
|
||||
|
||||
Options["support_material_extrusion_width"].type = coFloatOrPercent;
|
||||
Options["support_material_extrusion_width"].label = "Support material";
|
||||
Options["support_material_extrusion_width"].category = "Extrusion Width";
|
||||
Options["support_material_extrusion_width"].tooltip = "Set this to a non-zero value to set a manual extrusion width for support material. If expressed as percentage (for example 90%) if will be computed over layer height.";
|
||||
Options["support_material_extrusion_width"].sidetext = "mm or % (leave 0 for default)";
|
||||
Options["support_material_extrusion_width"].cli = "support-material-extrusion-width=s";
|
||||
|
||||
Options["support_material_interface_extruder"].type = coInt;
|
||||
Options["support_material_interface_extruder"].label = "Support material interface extruder";
|
||||
Options["support_material_interface_extruder"].category = "Extruders";
|
||||
Options["support_material_interface_extruder"].tooltip = "The extruder to use when printing support material interface. This affects raft too.";
|
||||
Options["support_material_interface_extruder"].cli = "support-material-interface-extruder=i";
|
||||
|
||||
|
@ -755,7 +753,6 @@ class PrintConfigDef
|
|||
Options["support_material_interface_layers"].tooltip = "Number of interface layers to insert between the object(s) and support material.";
|
||||
Options["support_material_interface_layers"].sidetext = "layers";
|
||||
Options["support_material_interface_layers"].cli = "support-material-interface-layers=i";
|
||||
Options["support_material_interface_layers"].scope = "object";
|
||||
|
||||
Options["support_material_interface_spacing"].type = coFloat;
|
||||
Options["support_material_interface_spacing"].label = "Interface pattern spacing";
|
||||
|
@ -763,14 +760,12 @@ class PrintConfigDef
|
|||
Options["support_material_interface_spacing"].tooltip = "Spacing between interface lines. Set zero to get a solid interface.";
|
||||
Options["support_material_interface_spacing"].sidetext = "mm";
|
||||
Options["support_material_interface_spacing"].cli = "support-material-interface-spacing=f";
|
||||
Options["support_material_interface_spacing"].scope = "object";
|
||||
|
||||
Options["support_material_pattern"].type = coEnum;
|
||||
Options["support_material_pattern"].label = "Pattern";
|
||||
Options["support_material_pattern"].category = "Support material";
|
||||
Options["support_material_pattern"].tooltip = "Pattern used to generate support material.";
|
||||
Options["support_material_pattern"].cli = "support-material-pattern=s";
|
||||
Options["support_material_pattern"].scope = "object";
|
||||
Options["support_material_pattern"].enum_keys_map = ConfigOptionEnum<SupportMaterialPattern>::get_enum_values();
|
||||
Options["support_material_pattern"].enum_values.push_back("rectilinear");
|
||||
Options["support_material_pattern"].enum_values.push_back("rectilinear-grid");
|
||||
|
@ -787,10 +782,10 @@ class PrintConfigDef
|
|||
Options["support_material_spacing"].tooltip = "Spacing between support material lines.";
|
||||
Options["support_material_spacing"].sidetext = "mm";
|
||||
Options["support_material_spacing"].cli = "support-material-spacing=f";
|
||||
Options["support_material_spacing"].scope = "object";
|
||||
|
||||
Options["support_material_speed"].type = coFloat;
|
||||
Options["support_material_speed"].label = "Support material";
|
||||
Options["support_material_speed"].category = "Support material";
|
||||
Options["support_material_speed"].tooltip = "Speed for printing support material.";
|
||||
Options["support_material_speed"].sidetext = "mm/s";
|
||||
Options["support_material_speed"].cli = "support-material-speed=f";
|
||||
|
@ -801,7 +796,6 @@ class PrintConfigDef
|
|||
Options["support_material_threshold"].tooltip = "Support material will not be generated for overhangs whose slope angle (90° = vertical) is above the given threshold. In other words, this value represent the most horizontal slope (measured from the horizontal plane) that you can print without support material. Set to zero for automatic detection (recommended).";
|
||||
Options["support_material_threshold"].sidetext = "°";
|
||||
Options["support_material_threshold"].cli = "support-material-threshold=i";
|
||||
Options["support_material_threshold"].scope = "object";
|
||||
|
||||
Options["temperature"].type = coInts;
|
||||
Options["temperature"].label = "Other layers";
|
||||
|
@ -816,7 +810,6 @@ class PrintConfigDef
|
|||
Options["thin_walls"].category = "Layers and Perimeters";
|
||||
Options["thin_walls"].tooltip = "Detect single-width walls (parts where two extrusions don't fit and we need to collapse them into a single trace).";
|
||||
Options["thin_walls"].cli = "thin-walls!";
|
||||
Options["thin_walls"].scope = "object";
|
||||
|
||||
Options["threads"].type = coInt;
|
||||
Options["threads"].label = "Threads";
|
||||
|
@ -837,6 +830,7 @@ class PrintConfigDef
|
|||
|
||||
Options["top_infill_extrusion_width"].type = coFloatOrPercent;
|
||||
Options["top_infill_extrusion_width"].label = "Top solid infill";
|
||||
Options["top_infill_extrusion_width"].category = "Extrusion Width";
|
||||
Options["top_infill_extrusion_width"].tooltip = "Set this to a non-zero value to set a manual extrusion width for infill for top surfaces. You may want to use thinner extrudates to fill all narrow regions and get a smoother finish. If expressed as percentage (for example 90%) if will be computed over layer height.";
|
||||
Options["top_infill_extrusion_width"].sidetext = "mm or % (leave 0 for default)";
|
||||
Options["top_infill_extrusion_width"].cli = "top-infill-extrusion-width=s";
|
||||
|
@ -853,7 +847,6 @@ class PrintConfigDef
|
|||
Options["top_solid_layers"].category = "Layers and Perimeters";
|
||||
Options["top_solid_layers"].tooltip = "Number of solid layers to generate on top surfaces.";
|
||||
Options["top_solid_layers"].cli = "top-solid-layers=i";
|
||||
Options["top_solid_layers"].scope = "object";
|
||||
Options["top_solid_layers"].full_label = "Top solid layers";
|
||||
|
||||
Options["travel_speed"].type = coFloat;
|
||||
|
@ -981,7 +974,6 @@ class PrintRegionConfig : public virtual StaticConfig
|
|||
ConfigOptionFloat solid_infill_below_area;
|
||||
ConfigOptionFloatOrPercent solid_infill_extrusion_width;
|
||||
ConfigOptionInt solid_infill_every_layers;
|
||||
ConfigOptionInt solid_layers;
|
||||
ConfigOptionBool thin_walls;
|
||||
ConfigOptionFloatOrPercent top_infill_extrusion_width;
|
||||
ConfigOptionInt top_solid_layers;
|
||||
|
@ -1029,7 +1021,6 @@ class PrintRegionConfig : public virtual StaticConfig
|
|||
if (opt_key == "solid_infill_below_area") return &this->solid_infill_below_area;
|
||||
if (opt_key == "solid_infill_extrusion_width") return &this->solid_infill_extrusion_width;
|
||||
if (opt_key == "solid_infill_every_layers") return &this->solid_infill_every_layers;
|
||||
if (opt_key == "solid_layers") return &this->solid_layers;
|
||||
if (opt_key == "thin_walls") return &this->thin_walls;
|
||||
if (opt_key == "top_infill_extrusion_width") return &this->top_infill_extrusion_width;
|
||||
if (opt_key == "top_solid_layers") return &this->top_solid_layers;
|
||||
|
|
|
@ -16,6 +16,13 @@ Surface::is_solid() const
|
|||
|| this->surface_type == stInternalSolid;
|
||||
}
|
||||
|
||||
bool
|
||||
Surface::is_external() const
|
||||
{
|
||||
return this->surface_type == stTop
|
||||
|| this->surface_type == stBottom;
|
||||
}
|
||||
|
||||
bool
|
||||
Surface::is_bridge() const
|
||||
{
|
||||
|
@ -24,6 +31,15 @@ Surface::is_bridge() const
|
|||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
void
|
||||
Surface::from_SV_check(SV* surface_sv)
|
||||
{
|
||||
if (!sv_isa(surface_sv, "Slic3r::Surface") && !sv_isa(surface_sv, "Slic3r::Surface::Ref"))
|
||||
CONFESS("Not a valid Slic3r::Surface object");
|
||||
// a XS Surface was supplied
|
||||
*this = *(Surface *)SvIV((SV*)SvRV( surface_sv ));
|
||||
}
|
||||
|
||||
SV*
|
||||
Surface::to_SV_ref() {
|
||||
SV* sv = newSV(0);
|
||||
|
|
|
@ -18,9 +18,11 @@ class Surface
|
|||
unsigned short extra_perimeters;
|
||||
double area() const;
|
||||
bool is_solid() const;
|
||||
bool is_external() const;
|
||||
bool is_bridge() const;
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
void from_SV_check(SV* surface_sv);
|
||||
SV* to_SV_ref();
|
||||
SV* to_SV_clone_ref() const;
|
||||
#endif
|
||||
|
|
|
@ -21,14 +21,14 @@ SurfaceCollection::simplify(double tolerance)
|
|||
|
||||
/* group surfaces by common properties */
|
||||
void
|
||||
SurfaceCollection::group(std::vector<SurfacesPtr> *retval, bool merge_solid)
|
||||
SurfaceCollection::group(std::vector<SurfacesPtr> *retval)
|
||||
{
|
||||
for (Surfaces::iterator it = this->surfaces.begin(); it != this->surfaces.end(); ++it) {
|
||||
// find a group with the same properties
|
||||
SurfacesPtr* group = NULL;
|
||||
for (std::vector<SurfacesPtr>::iterator git = retval->begin(); git != retval->end(); ++git) {
|
||||
Surface* gkey = git->front();
|
||||
if ((gkey->surface_type == it->surface_type || (merge_solid && gkey->is_solid() && it->is_solid()))
|
||||
if ( gkey->surface_type == it->surface_type
|
||||
&& gkey->thickness == it->thickness
|
||||
&& gkey->thickness_layers == it->thickness_layers
|
||||
&& gkey->bridge_angle == it->bridge_angle) {
|
||||
|
|
|
@ -11,7 +11,7 @@ class SurfaceCollection
|
|||
public:
|
||||
Surfaces surfaces;
|
||||
void simplify(double tolerance);
|
||||
void group(std::vector<SurfacesPtr> *retval, bool merge_solid = false);
|
||||
void group(std::vector<SurfacesPtr> *retval);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -12,6 +12,7 @@
|
|||
namespace Slic3r {
|
||||
|
||||
class TriangleMesh;
|
||||
class TriangleMeshSlicer;
|
||||
typedef std::vector<TriangleMesh*> TriangleMeshPtrs;
|
||||
|
||||
class TriangleMesh
|
||||
|
@ -30,8 +31,6 @@ class TriangleMesh
|
|||
void translate(float x, float y, float z);
|
||||
void align_to_origin();
|
||||
void rotate(double angle, Point* center);
|
||||
void slice(const std::vector<double> &z, std::vector<Polygons>* layers);
|
||||
void slice(const std::vector<double> &z, std::vector<ExPolygons>* layers);
|
||||
TriangleMeshPtrs split() const;
|
||||
void merge(const TriangleMesh* mesh);
|
||||
void horizontal_projection(ExPolygons &retval) const;
|
||||
|
@ -47,9 +46,10 @@ class TriangleMesh
|
|||
|
||||
private:
|
||||
void require_shared_vertices();
|
||||
friend class TriangleMeshSlicer;
|
||||
};
|
||||
|
||||
enum FacetEdgeType { feNone, feTop, feBottom };
|
||||
enum FacetEdgeType { feNone, feTop, feBottom, feHorizontal };
|
||||
|
||||
class IntersectionPoint : public Point
|
||||
{
|
||||
|
@ -75,6 +75,26 @@ class IntersectionLine
|
|||
typedef std::vector<IntersectionLine> IntersectionLines;
|
||||
typedef std::vector<IntersectionLine*> IntersectionLinePtrs;
|
||||
|
||||
class TriangleMeshSlicer
|
||||
{
|
||||
public:
|
||||
TriangleMesh* mesh;
|
||||
TriangleMeshSlicer(TriangleMesh* _mesh);
|
||||
~TriangleMeshSlicer();
|
||||
void slice(const std::vector<float> &z, std::vector<Polygons>* layers);
|
||||
void slice(const std::vector<float> &z, std::vector<ExPolygons>* layers);
|
||||
void slice_facet(float slice_z, const stl_facet &facet, const int &facet_idx, const float &min_z, const float &max_z, std::vector<IntersectionLine>* lines) const;
|
||||
void cut(float z, TriangleMesh* upper, TriangleMesh* lower);
|
||||
|
||||
private:
|
||||
typedef std::vector< std::vector<int> > t_facets_edges;
|
||||
t_facets_edges facets_edges;
|
||||
stl_vertex* v_scaled_shared;
|
||||
void make_loops(std::vector<IntersectionLine> &lines, Polygons* loops);
|
||||
void make_expolygons(const Polygons &loops, ExPolygons* slices);
|
||||
void make_expolygons(std::vector<IntersectionLine> &lines, ExPolygons* slices);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -52,7 +52,6 @@ static void stl_which_vertices_to_change(stl_file *stl, stl_hash_edge *edge_a,
|
|||
int *facet2, int *vertex2,
|
||||
stl_vertex *new_vertex1, stl_vertex *new_vertex2);
|
||||
static void stl_remove_degenerate(stl_file *stl, int facet);
|
||||
static void stl_add_facet(stl_file *stl, stl_facet *new_facet);
|
||||
extern int stl_check_normal_vector(stl_file *stl,
|
||||
int facet_num, int normal_fix_flag);
|
||||
static void stl_update_connects_remove_1(stl_file *stl, int facet_num);
|
||||
|
@ -1100,7 +1099,7 @@ Try using a smaller tolerance or don't do a nearby check\n"); */
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
stl_add_facet(stl_file *stl, stl_facet *new_facet)
|
||||
{
|
||||
stl->stats.facets_added += 1;
|
||||
|
|
|
@ -180,4 +180,5 @@ extern void stl_allocate(stl_file *stl);
|
|||
static void stl_read(stl_file *stl, int first_facet, int first);
|
||||
extern void stl_facet_stats(stl_file *stl, stl_facet facet, int first);
|
||||
extern void stl_reallocate(stl_file *stl);
|
||||
extern void stl_add_facet(stl_file *stl, stl_facet *new_facet);
|
||||
extern void stl_get_size(stl_file *stl);
|
||||
|
|
|
@ -54,6 +54,7 @@ stl_initialize(stl_file *stl)
|
|||
stl->stats.number_of_parts = 0;
|
||||
stl->stats.original_num_facets = 0;
|
||||
stl->stats.number_of_facets = 0;
|
||||
stl->stats.facets_malloced = 0;
|
||||
stl->stats.volume = -1.0;
|
||||
|
||||
stl->neighbors_start = NULL;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#undef seekdir
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
extern "C" {
|
||||
|
@ -23,6 +24,7 @@ extern "C" {
|
|||
#define PI 3.141592653589793238
|
||||
#define scale_(val) (val / SCALING_FACTOR)
|
||||
#define unscale(val) (val * SCALING_FACTOR)
|
||||
#define SCALED_EPSILON scale_(EPSILON)
|
||||
typedef long coord_t;
|
||||
typedef double coordf_t;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue