GCodeProcessor/GCodeViewer -> Extract bed shape from gcode files generated by PrusaSlicer
This commit is contained in:
parent
16e282110d
commit
9d4344a78c
3 changed files with 36 additions and 10 deletions
src/slic3r/GUI
|
@ -323,14 +323,20 @@ void GCodeViewer::load(const GCodeProcessor::Result& gcode_result, const Print&
|
|||
|
||||
#if ENABLE_GCODE_VIEWER_AS_STATE
|
||||
if (wxGetApp().mainframe->get_mode() == MainFrame::EMode::GCodeViewer) {
|
||||
// adjust printbed size in dependence of toolpaths bbox
|
||||
const double margin = 10.0;
|
||||
Vec2d min(m_paths_bounding_box.min(0) - margin, m_paths_bounding_box.min(1) - margin);
|
||||
Vec2d max(m_paths_bounding_box.max(0) + margin, m_paths_bounding_box.max(1) + margin);
|
||||
Pointfs bed_shape = { { min(0), min(1) },
|
||||
{ max(0), min(1) },
|
||||
{ max(0), max(1) },
|
||||
{ min(0), max(1) } };
|
||||
Pointfs bed_shape;
|
||||
if (!gcode_result.bed_shape.empty())
|
||||
// bed shape detected in the gcode
|
||||
bed_shape = gcode_result.bed_shape;
|
||||
else {
|
||||
// adjust printbed size in dependence of toolpaths bbox
|
||||
const double margin = 10.0;
|
||||
Vec2d min(m_paths_bounding_box.min(0) - margin, m_paths_bounding_box.min(1) - margin);
|
||||
Vec2d max(m_paths_bounding_box.max(0) + margin, m_paths_bounding_box.max(1) + margin);
|
||||
bed_shape = { { min(0), min(1) },
|
||||
{ max(0), min(1) },
|
||||
{ max(0), max(1) },
|
||||
{ min(0), max(1) } };
|
||||
}
|
||||
wxGetApp().plater()->set_bed_shape(bed_shape, "", "");
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER_AS_STATE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue