mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-13 17:31:45 +08:00
New "rear" seam position
This commit is contained in:
parent
4d521ca839
commit
d984864ce0
@ -183,6 +183,26 @@ BoundingBox3Base<PointClass>::size() const
|
|||||||
}
|
}
|
||||||
template Pointf3 BoundingBox3Base<Pointf3>::size() const;
|
template Pointf3 BoundingBox3Base<Pointf3>::size() const;
|
||||||
|
|
||||||
|
template <class PointClass> double
|
||||||
|
BoundingBoxBase<PointClass>::radius() const
|
||||||
|
{
|
||||||
|
double x = this->max.x - this->min.x;
|
||||||
|
double y = this->max.y - this->min.y;
|
||||||
|
return 0.5 * sqrt(x*x+y*y);
|
||||||
|
}
|
||||||
|
template double BoundingBoxBase<Point>::radius() const;
|
||||||
|
template double BoundingBoxBase<Pointf>::radius() const;
|
||||||
|
|
||||||
|
template <class PointClass> double
|
||||||
|
BoundingBox3Base<PointClass>::radius() const
|
||||||
|
{
|
||||||
|
double x = this->max.x - this->min.x;
|
||||||
|
double y = this->max.y - this->min.y;
|
||||||
|
double z = this->max.z - this->min.z;
|
||||||
|
return 0.5 * sqrt(x*x+y*y+z*z);
|
||||||
|
}
|
||||||
|
template double BoundingBox3Base<Pointf3>::radius() const;
|
||||||
|
|
||||||
template <class PointClass> void
|
template <class PointClass> void
|
||||||
BoundingBoxBase<PointClass>::translate(coordf_t x, coordf_t y)
|
BoundingBoxBase<PointClass>::translate(coordf_t x, coordf_t y)
|
||||||
{
|
{
|
||||||
|
@ -29,6 +29,7 @@ class BoundingBoxBase
|
|||||||
void merge(const BoundingBoxBase<PointClass> &bb);
|
void merge(const BoundingBoxBase<PointClass> &bb);
|
||||||
void scale(double factor);
|
void scale(double factor);
|
||||||
PointClass size() const;
|
PointClass size() const;
|
||||||
|
double radius() const;
|
||||||
void translate(coordf_t x, coordf_t y);
|
void translate(coordf_t x, coordf_t y);
|
||||||
void offset(coordf_t delta);
|
void offset(coordf_t delta);
|
||||||
PointClass center() const;
|
PointClass center() const;
|
||||||
@ -48,6 +49,7 @@ class BoundingBox3Base : public BoundingBoxBase<PointClass>
|
|||||||
void merge(const std::vector<PointClass> &points);
|
void merge(const std::vector<PointClass> &points);
|
||||||
void merge(const BoundingBox3Base<PointClass> &bb);
|
void merge(const BoundingBox3Base<PointClass> &bb);
|
||||||
PointClass size() const;
|
PointClass size() const;
|
||||||
|
double radius() const;
|
||||||
void translate(coordf_t x, coordf_t y, coordf_t z);
|
void translate(coordf_t x, coordf_t y, coordf_t z);
|
||||||
void offset(coordf_t delta);
|
void offset(coordf_t delta);
|
||||||
PointClass center() const;
|
PointClass center() const;
|
||||||
|
@ -324,7 +324,7 @@ GCode::extrude(ExtrusionLoop loop, std::string description, double speed)
|
|||||||
Point last_pos = this->last_pos();
|
Point last_pos = this->last_pos();
|
||||||
if (this->config.spiral_vase) {
|
if (this->config.spiral_vase) {
|
||||||
loop.split_at(last_pos);
|
loop.split_at(last_pos);
|
||||||
} else if (seam_position == spNearest || seam_position == spAligned) {
|
} else if (seam_position == spNearest || seam_position == spAligned || seam_position == spRear) {
|
||||||
const Polygon polygon = loop.polygon();
|
const Polygon polygon = loop.polygon();
|
||||||
|
|
||||||
// simplify polygon in order to skip false positives in concave/convex detection
|
// simplify polygon in order to skip false positives in concave/convex detection
|
||||||
@ -354,8 +354,13 @@ GCode::extrude(ExtrusionLoop loop, std::string description, double speed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// retrieve the last start position for this object
|
// retrieve the last start position for this object
|
||||||
if (this->layer != NULL && this->_seam_position.count(this->layer->object()) > 0) {
|
if (this->layer != NULL) {
|
||||||
last_pos = this->_seam_position[this->layer->object()];
|
if (seam_position == spRear) {
|
||||||
|
last_pos = this->layer->object()->bounding_box().center();
|
||||||
|
last_pos.y += coord_t(3. * this->layer->object()->bounding_box().radius());
|
||||||
|
} else if (this->_seam_position.count(this->layer->object()) > 0) {
|
||||||
|
last_pos = this->_seam_position[this->layer->object()];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Point point;
|
Point point;
|
||||||
@ -392,6 +397,7 @@ GCode::extrude(ExtrusionLoop loop, std::string description, double speed)
|
|||||||
last_pos = Point(polygon.bounding_box().max.x, centroid.y);
|
last_pos = Point(polygon.bounding_box().max.x, centroid.y);
|
||||||
last_pos.rotate(fmod((float)rand()/16.0, 2.0*PI), centroid);
|
last_pos.rotate(fmod((float)rand()/16.0, 2.0*PI), centroid);
|
||||||
}
|
}
|
||||||
|
// Find the closest point, avoid overhangs.
|
||||||
loop.split_at(last_pos, true);
|
loop.split_at(last_pos, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -943,9 +943,11 @@ PrintConfigDef::PrintConfigDef()
|
|||||||
def->enum_values.push_back("random");
|
def->enum_values.push_back("random");
|
||||||
def->enum_values.push_back("nearest");
|
def->enum_values.push_back("nearest");
|
||||||
def->enum_values.push_back("aligned");
|
def->enum_values.push_back("aligned");
|
||||||
|
def->enum_values.push_back("rear");
|
||||||
def->enum_labels.push_back("Random");
|
def->enum_labels.push_back("Random");
|
||||||
def->enum_labels.push_back("Nearest");
|
def->enum_labels.push_back("Nearest");
|
||||||
def->enum_labels.push_back("Aligned");
|
def->enum_labels.push_back("Aligned");
|
||||||
|
def->enum_labels.push_back("Rear");
|
||||||
def->default_value = new ConfigOptionEnum<SeamPosition>(spAligned);
|
def->default_value = new ConfigOptionEnum<SeamPosition>(spAligned);
|
||||||
|
|
||||||
def = this->add("serial_port", coString);
|
def = this->add("serial_port", coString);
|
||||||
|
@ -41,7 +41,7 @@ enum SupportMaterialPattern {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum SeamPosition {
|
enum SeamPosition {
|
||||||
spRandom, spNearest, spAligned
|
spRandom, spNearest, spAligned, spRear
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> inline t_config_enum_values ConfigOptionEnum<GCodeFlavor>::get_enum_values() {
|
template<> inline t_config_enum_values ConfigOptionEnum<GCodeFlavor>::get_enum_values() {
|
||||||
@ -89,6 +89,7 @@ template<> inline t_config_enum_values ConfigOptionEnum<SeamPosition>::get_enum_
|
|||||||
keys_map["random"] = spRandom;
|
keys_map["random"] = spRandom;
|
||||||
keys_map["nearest"] = spNearest;
|
keys_map["nearest"] = spNearest;
|
||||||
keys_map["aligned"] = spAligned;
|
keys_map["aligned"] = spAligned;
|
||||||
|
keys_map["rear"] = spRear;
|
||||||
return keys_map;
|
return keys_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user