mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 16:21:24 -06:00
Initial work for 3D rendering of toolpaths
This commit is contained in:
parent
18e815d032
commit
e0a3d2577c
12 changed files with 166 additions and 2 deletions
|
@ -164,6 +164,14 @@ ExtrusionPath::gcode(Extruder* extruder, double e, double F,
|
|||
return stream.str();
|
||||
}
|
||||
|
||||
Polygons
|
||||
ExtrusionPath::grow() const
|
||||
{
|
||||
Polygons pp;
|
||||
offset(this->polyline, &pp, +this->width/2);
|
||||
return pp;
|
||||
}
|
||||
|
||||
ExtrusionLoop::operator Polygon() const
|
||||
{
|
||||
Polygon polygon;
|
||||
|
@ -363,6 +371,17 @@ ExtrusionLoop::is_solid_infill() const
|
|||
|| this->paths.front().role == erTopSolidInfill;
|
||||
}
|
||||
|
||||
Polygons
|
||||
ExtrusionLoop::grow() const
|
||||
{
|
||||
Polygons pp;
|
||||
for (ExtrusionPaths::const_iterator path = this->paths.begin(); path != this->paths.end(); ++path) {
|
||||
Polygons path_pp = path->grow();
|
||||
pp.insert(pp.end(), path_pp.begin(), path_pp.end());
|
||||
}
|
||||
return pp;
|
||||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
REGISTER_CLASS(ExtrusionLoop, "ExtrusionLoop");
|
||||
#endif
|
||||
|
|
|
@ -43,6 +43,7 @@ class ExtrusionEntity
|
|||
virtual void reverse() = 0;
|
||||
virtual Point first_point() const = 0;
|
||||
virtual Point last_point() const = 0;
|
||||
virtual Polygons grow() const = 0;
|
||||
};
|
||||
|
||||
typedef std::vector<ExtrusionEntity*> ExtrusionEntitiesPtr;
|
||||
|
@ -73,6 +74,7 @@ class ExtrusionPath : public ExtrusionEntity
|
|||
std::string gcode(Extruder* extruder, double e, double F,
|
||||
double xofs, double yofs, std::string extrusion_axis,
|
||||
std::string gcode_line_suffix) const;
|
||||
Polygons grow() const;
|
||||
|
||||
private:
|
||||
void _inflate_collection(const Polylines &polylines, ExtrusionEntityCollection* collection) const;
|
||||
|
@ -106,6 +108,7 @@ class ExtrusionLoop : public ExtrusionEntity
|
|||
bool is_perimeter() const;
|
||||
bool is_infill() const;
|
||||
bool is_solid_infill() const;
|
||||
Polygons grow() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -110,6 +110,17 @@ ExtrusionEntityCollection::chained_path_from(Point start_near, ExtrusionEntityCo
|
|||
}
|
||||
}
|
||||
|
||||
Polygons
|
||||
ExtrusionEntityCollection::grow() const
|
||||
{
|
||||
Polygons pp;
|
||||
for (ExtrusionEntitiesPtr::const_iterator it = this->entities.begin(); it != this->entities.end(); ++it) {
|
||||
Polygons entity_pp = (*it)->grow();
|
||||
pp.insert(pp.end(), entity_pp.begin(), entity_pp.end());
|
||||
}
|
||||
return pp;
|
||||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
// there is no ExtrusionLoop::Collection or ExtrusionEntity::Collection
|
||||
REGISTER_CLASS(ExtrusionEntityCollection, "ExtrusionPath::Collection");
|
||||
|
|
|
@ -22,6 +22,7 @@ class ExtrusionEntityCollection : public ExtrusionEntity
|
|||
void reverse();
|
||||
Point first_point() const;
|
||||
Point last_point() const;
|
||||
Polygons grow() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -201,6 +201,13 @@ Linef3::intersect_plane(double z) const
|
|||
);
|
||||
}
|
||||
|
||||
void
|
||||
Linef3::scale(double factor)
|
||||
{
|
||||
this->a.scale(factor);
|
||||
this->b.scale(factor);
|
||||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
REGISTER_CLASS(Linef3, "Linef3");
|
||||
#endif
|
||||
|
|
|
@ -55,6 +55,7 @@ class Linef3
|
|||
Linef3() {};
|
||||
explicit Linef3(Pointf3 _a, Pointf3 _b): a(_a), b(_b) {};
|
||||
Pointf3 intersect_plane(double z) const;
|
||||
void scale(double factor);
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
void from_SV(SV* line_sv);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue