From acd225cee288f00a7c5f31ab545a49316bec5b66 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 11 Jan 2022 09:09:09 +0100 Subject: [PATCH 01/40] Techs ENABLE_NEW_CAMERA_MOVEMENTS_XXXX - 1st installment - Modified camera manipulation and selection by mouse --- src/libslic3r/Technologies.hpp | 4 + src/slic3r/GUI/GLCanvas3D.cpp | 127 +++++++++++++++---- src/slic3r/GUI/GLSelectionRectangle.cpp | 12 +- src/slic3r/GUI/GLSelectionRectangle.hpp | 22 ++-- src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp | 4 +- src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp | 4 +- 6 files changed, 126 insertions(+), 47 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 8f372e7c58..957a060eda 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -65,6 +65,10 @@ // Enable detection of layers for spiral vase prints #define ENABLE_SPIRAL_VASE_LAYERS (1 && ENABLE_2_4_1_RC) +// Enable modified camera control and selection using mouse +#define ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE (1 && ENABLE_2_4_1_RC) +#define ENABLE_NEW_CAMERA_MOVEMENTS_MIDMOUSE_ROTATE (1 && ENABLE_2_4_1_RC) +#define ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION (1 && ENABLE_2_4_1_RC) #endif // _prusaslicer_technologies_h_ diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 6d5bc3eb42..7a8c13e5d8 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1460,7 +1460,11 @@ void GLCanvas3D::render() wxGetApp().imgui()->new_frame(); if (m_picking_enabled) { +#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + if (m_rectangle_selection.is_dragging() && !m_rectangle_selection.is_empty()) +#else if (m_rectangle_selection.is_dragging()) +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION // picking pass using rectangle selection _rectangular_selection_picking_pass(); else if (!m_volumes.empty()) @@ -2635,8 +2639,13 @@ void GLCanvas3D::on_key(wxKeyEvent& evt) _update_selection_from_hover(); m_rectangle_selection.stop_dragging(); m_mouse.ignore_left_up = true; +#if !ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION m_dirty = true; +#endif // !ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION } +#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + m_dirty = true; +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION // set_cursor(Standard); } else if (keyCode == WXK_ALT) { @@ -2680,15 +2689,16 @@ void GLCanvas3D::on_key(wxKeyEvent& evt) if (keyCode == WXK_SHIFT) { translationProcessor.process(evt); - if (m_picking_enabled && (m_gizmos.get_current_type() != GLGizmosManager::SlaSupports)) - { + if (m_picking_enabled && (m_gizmos.get_current_type() != GLGizmosManager::SlaSupports)) { m_mouse.ignore_left_up = false; // set_cursor(Cross); } +#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + m_dirty = true; +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION } else if (keyCode == WXK_ALT) { - if (m_picking_enabled && (m_gizmos.get_current_type() != GLGizmosManager::SlaSupports)) - { + if (m_picking_enabled && (m_gizmos.get_current_type() != GLGizmosManager::SlaSupports)) { m_mouse.ignore_left_up = false; // set_cursor(Cross); } @@ -3085,6 +3095,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_layers_editing.state = LayersEditing::Editing; _perform_layer_editing_action(&evt); } +#if !ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION else if (evt.LeftDown() && (evt.ShiftDown() || evt.AltDown()) && m_picking_enabled) { if (m_gizmos.get_current_type() != GLGizmosManager::SlaSupports && m_gizmos.get_current_type() != GLGizmosManager::FdmSupports @@ -3094,23 +3105,52 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_dirty = true; } } +#endif // !ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION else { +#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + if (evt.LeftDown() && (evt.ShiftDown() || evt.AltDown()) && m_picking_enabled) { + if (m_gizmos.get_current_type() != GLGizmosManager::SlaSupports + && m_gizmos.get_current_type() != GLGizmosManager::FdmSupports + && m_gizmos.get_current_type() != GLGizmosManager::Seam + && m_gizmos.get_current_type() != GLGizmosManager::MmuSegmentation) { + m_rectangle_selection.start_dragging(m_mouse.position, evt.ShiftDown() ? GLSelectionRectangle::EState::Select : GLSelectionRectangle::EState::Deselect); + m_dirty = true; + } + } +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + // Select volume in this 3D canvas. // Don't deselect a volume if layer editing is enabled or any gizmo is active. We want the object to stay selected // during the scene manipulation. +#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + if (m_picking_enabled && (!any_gizmo_active || !evt.ShiftDown()) && (!m_hover_volume_idxs.empty() || !is_layers_editing_enabled())) { +#else if (m_picking_enabled && (!any_gizmo_active || !evt.CmdDown()) && (!m_hover_volume_idxs.empty() || !is_layers_editing_enabled())) { +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION if (evt.LeftDown() && !m_hover_volume_idxs.empty()) { int volume_idx = get_first_hover_volume_idx(); bool already_selected = m_selection.contains_volume(volume_idx); +#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + bool shift_down = evt.ShiftDown(); +#else bool ctrl_down = evt.CmdDown(); +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION Selection::IndicesList curr_idxs = m_selection.get_volume_idxs(); +#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + if (already_selected && shift_down) +#else if (already_selected && ctrl_down) +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION m_selection.remove(volume_idx); else { +#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + m_selection.add(volume_idx, !shift_down, true); +#else m_selection.add(volume_idx, !ctrl_down, true); +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION m_mouse.drag.move_requires_threshold = !already_selected; if (already_selected) m_mouse.set_move_start_threshold_position_2D_as_invalid(); @@ -3135,7 +3175,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) if (!m_hover_volume_idxs.empty()) { if (evt.LeftDown() && m_moving_enabled && m_mouse.drag.move_volume_idx == -1) { // Only accept the initial position, if it is inside the volume bounding box. - int volume_idx = get_first_hover_volume_idx(); + const int volume_idx = get_first_hover_volume_idx(); BoundingBoxf3 volume_bbox = m_volumes.volumes[volume_idx]->transformed_bounding_box(); volume_bbox.offset(1.0); if ((!any_gizmo_active || !evt.CmdDown()) && volume_bbox.contains(m_mouse.scene_position)) { @@ -3143,6 +3183,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) // The dragging operation is initiated. m_mouse.drag.move_volume_idx = volume_idx; m_selection.start_dragging(); +#if ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE + if (!evt.CmdDown()) +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE m_mouse.drag.start_position_3D = m_mouse.scene_position; m_sequential_print_clearance_first_displacement = true; m_moving = true; @@ -3151,31 +3194,35 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } } } +#if ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE + else if (evt.Dragging() && evt.LeftIsDown() && !evt.CmdDown() && m_layers_editing.state == LayersEditing::Unknown && m_mouse.drag.move_volume_idx != -1) { +#else else if (evt.Dragging() && evt.LeftIsDown() && m_layers_editing.state == LayersEditing::Unknown && m_mouse.drag.move_volume_idx != -1) { - if (!m_mouse.drag.move_requires_threshold) { +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE + if (!m_mouse.drag.move_requires_threshold) { m_mouse.dragging = true; Vec3d cur_pos = m_mouse.drag.start_position_3D; // we do not want to translate objects if the user just clicked on an object while pressing shift to remove it from the selection and then drag if (m_selection.contains_volume(get_first_hover_volume_idx())) { const Camera& camera = wxGetApp().plater()->get_camera(); - if (std::abs(camera.get_dir_forward()(2)) < EPSILON) { + if (std::abs(camera.get_dir_forward().z()) < EPSILON) { // side view -> move selected volumes orthogonally to camera view direction - Linef3 ray = mouse_ray(pos); - Vec3d dir = ray.unit_vector(); + const Linef3 ray = mouse_ray(pos); + const Vec3d dir = ray.unit_vector(); // finds the intersection of the mouse ray with the plane parallel to the camera viewport and passing throught the starting position // use ray-plane intersection see i.e. https://en.wikipedia.org/wiki/Line%E2%80%93plane_intersection algebric form // in our case plane normal and ray direction are the same (orthogonal view) // when moving to perspective camera the negative z unit axis of the camera needs to be transformed in world space and used as plane normal - Vec3d inters = ray.a + (m_mouse.drag.start_position_3D - ray.a).dot(dir) / dir.squaredNorm() * dir; + const Vec3d inters = ray.a + (m_mouse.drag.start_position_3D - ray.a).dot(dir) / dir.squaredNorm() * dir; // vector from the starting position to the found intersection - Vec3d inters_vec = inters - m_mouse.drag.start_position_3D; + const Vec3d inters_vec = inters - m_mouse.drag.start_position_3D; - Vec3d camera_right = camera.get_dir_right(); - Vec3d camera_up = camera.get_dir_up(); + const Vec3d camera_right = camera.get_dir_right(); + const Vec3d camera_up = camera.get_dir_up(); // finds projection of the vector along the camera axes - double projection_x = inters_vec.dot(camera_right); - double projection_z = inters_vec.dot(camera_up); + const double projection_x = inters_vec.dot(camera_right); + const double projection_z = inters_vec.dot(camera_up); // apply offset cur_pos = m_mouse.drag.start_position_3D + projection_x * camera_right + projection_z * camera_up; @@ -3185,7 +3232,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) // Get new position at the same Z of the initial click point. float z0 = 0.0f; float z1 = 1.0f; - cur_pos = Linef3(_mouse_to_3d(pos, &z0), _mouse_to_3d(pos, &z1)).intersect_plane(m_mouse.drag.start_position_3D(2)); + cur_pos = Linef3(_mouse_to_3d(pos, &z0), _mouse_to_3d(pos, &z1)).intersect_plane(m_mouse.drag.start_position_3D.z()); } } @@ -3210,13 +3257,21 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } } // do not process the dragging if the left mouse was set down in another canvas +#if ENABLE_NEW_CAMERA_MOVEMENTS_MIDMOUSE_ROTATE + else if (evt.LeftIsDown() || evt.MiddleIsDown()) { +#else else if (evt.LeftIsDown()) { +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_MIDMOUSE_ROTATE // if dragging over blank area with left button, rotate +#if ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE + if ((any_gizmo_active || evt.CmdDown() || evt.MiddleIsDown() || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) { +#else if ((any_gizmo_active || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) { - const Vec3d rot = (Vec3d(pos.x(), pos.y(), 0.) - m_mouse.drag.start_position_3D) * (PI * TRACKBALLSIZE / 180.); +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE + const Vec3d rot = (Vec3d(pos.x(), pos.y(), 0.0) - m_mouse.drag.start_position_3D) * (PI * TRACKBALLSIZE / 180.0); if (wxGetApp().app_config->get("use_free_camera") == "1") // Virtual track ball (similar to the 3DConnexion mouse). - wxGetApp().plater()->get_camera().rotate_local_around_target(Vec3d(rot.y(), rot.x(), 0.)); + wxGetApp().plater()->get_camera().rotate_local_around_target(Vec3d(rot.y(), rot.x(), 0.0)); else { // Forces camera right vector to be parallel to XY plane in case it has been misaligned using the 3D mouse free rotation. // It is cheaper to call this function right away instead of testing wxGetApp().plater()->get_mouse3d_controller().connected(), @@ -3229,15 +3284,20 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_dirty = true; } - m_mouse.drag.start_position_3D = Vec3d((double)pos(0), (double)pos(1), 0.0); + m_mouse.drag.start_position_3D = Vec3d((double)pos.x(), (double)pos.y(), 0.0); } +#if ENABLE_NEW_CAMERA_MOVEMENTS_MIDMOUSE_ROTATE + else if (evt.RightIsDown()) { + // If dragging with right button, pan. +#else else if (evt.MiddleIsDown() || evt.RightIsDown()) { // If dragging over blank area with right button, pan. +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_MIDMOUSE_ROTATE if (m_mouse.is_start_position_2D_defined()) { // get point in model space at Z = 0 float z = 0.0f; const Vec3d& cur_pos = _mouse_to_3d(pos, &z); - Vec3d orig = _mouse_to_3d(m_mouse.drag.start_position_2D, &z); + const Vec3d orig = _mouse_to_3d(m_mouse.drag.start_position_2D, &z); Camera& camera = wxGetApp().plater()->get_camera(); if (wxGetApp().app_config->get("use_free_camera") != "1") // Forces camera right vector to be parallel to XY plane in case it has been misaligned using the 3D mouse free rotation. @@ -3254,7 +3314,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } } else if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp()) { - if (evt.LeftUp()) + if (evt.LeftUp() && m_selection.is_dragging()) m_selection.stop_dragging(); if (m_layers_editing.state != LayersEditing::Unknown) { @@ -3313,7 +3373,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) if (!m_mouse.dragging) { // do not post the event if the user is panning the scene // or if right click was done over the wipe tower - bool post_right_click_event = m_hover_volume_idxs.empty() || !m_volumes.volumes[get_first_hover_volume_idx()]->is_wipe_tower; + const bool post_right_click_event = m_hover_volume_idxs.empty() || !m_volumes.volumes[get_first_hover_volume_idx()]->is_wipe_tower; if (post_right_click_event) post_event(RBtnEvent(EVT_GLCANVAS_RIGHT_CLICK, { logical_pos, m_hover_volume_idxs.empty() })); } @@ -5675,9 +5735,14 @@ void GLCanvas3D::_update_volumes_hover_state() if (volume.hover != GLVolume::HS_None) continue; +#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + bool deselect = volume.selected && ((shift_pressed && m_rectangle_selection.is_empty()) || (alt_pressed && !m_rectangle_selection.is_empty())); + bool select = !volume.selected && (m_rectangle_selection.is_empty() || (shift_pressed && !m_rectangle_selection.is_empty())); +#else bool deselect = volume.selected && ((ctrl_pressed && !shift_pressed) || alt_pressed); // (volume->is_modifier && !selection_modifiers_only && !is_ctrl_pressed) -> allows hovering on selected modifiers belonging to selection of type Instance bool select = (!volume.selected || (volume.is_modifier && !selection_modifiers_only && !ctrl_pressed)) && !alt_pressed; +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION if (select || deselect) { bool as_volume = @@ -6436,7 +6501,7 @@ void GLCanvas3D::_update_selection_from_hover() bool ctrl_pressed = wxGetKeyState(WXK_CONTROL); if (m_hover_volume_idxs.empty()) { - if (!ctrl_pressed && (m_rectangle_selection.get_state() == GLSelectionRectangle::Select)) + if (!ctrl_pressed && m_rectangle_selection.get_state() == GLSelectionRectangle::EState::Select) m_selection.remove_all(); return; @@ -6453,7 +6518,10 @@ void GLCanvas3D::_update_selection_from_hover() } bool selection_changed = false; - if (state == GLSelectionRectangle::Select) { +#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + if (!m_rectangle_selection.is_empty()) { +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + if (state == GLSelectionRectangle::EState::Select) { bool contains_all = true; for (int i : m_hover_volume_idxs) { if (!m_selection.contains_volume((unsigned int)i)) { @@ -6464,7 +6532,7 @@ void GLCanvas3D::_update_selection_from_hover() // the selection is going to be modified (Add) if (!contains_all) { - wxGetApp().plater()->take_snapshot(_(L("Selection-Add from rectangle")), UndoRedo::SnapshotType::Selection); + wxGetApp().plater()->take_snapshot(_L("Selection-Add from rectangle"), UndoRedo::SnapshotType::Selection); selection_changed = true; } } @@ -6479,21 +6547,24 @@ void GLCanvas3D::_update_selection_from_hover() // the selection is going to be modified (Remove) if (contains_any) { - wxGetApp().plater()->take_snapshot(_(L("Selection-Remove from rectangle")), UndoRedo::SnapshotType::Selection); + wxGetApp().plater()->take_snapshot(_L("Selection-Remove from rectangle"), UndoRedo::SnapshotType::Selection); selection_changed = true; } } +#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + } +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION if (!selection_changed) return; Plater::SuppressSnapshots suppress(wxGetApp().plater()); - if ((state == GLSelectionRectangle::Select) && !ctrl_pressed) + if (state == GLSelectionRectangle::EState::Select && !ctrl_pressed) m_selection.clear(); for (int i : m_hover_volume_idxs) { - if (state == GLSelectionRectangle::Select) { + if (state == GLSelectionRectangle::EState::Select) { if (hover_modifiers_only) { const GLVolume& v = *m_volumes.volumes[i]; m_selection.add_volume(v.object_idx(), v.volume_idx(), v.instance_idx(), false); diff --git a/src/slic3r/GUI/GLSelectionRectangle.cpp b/src/slic3r/GUI/GLSelectionRectangle.cpp index 13467499a1..f3d032fc31 100644 --- a/src/slic3r/GUI/GLSelectionRectangle.cpp +++ b/src/slic3r/GUI/GLSelectionRectangle.cpp @@ -13,12 +13,12 @@ namespace GUI { void GLSelectionRectangle::start_dragging(const Vec2d& mouse_position, EState state) { - if (is_dragging() || (state == Off)) + if (is_dragging() || state == EState::Off) return; m_state = state; m_start_corner = mouse_position; - m_end_corner = mouse_position; + m_end_corner = mouse_position; } void GLSelectionRectangle::dragging(const Vec2d& mouse_position) @@ -36,7 +36,7 @@ namespace GUI { if (!is_dragging()) return out; - m_state = Off; + m_state = EState::Off; const Camera& camera = wxGetApp().plater()->get_camera(); Matrix4d modelview = camera.get_view_matrix().matrix(); @@ -66,7 +66,7 @@ namespace GUI { void GLSelectionRectangle::stop_dragging() { if (is_dragging()) - m_state = Off; + m_state = EState::Off; } void GLSelectionRectangle::render(const GLCanvas3D& canvas) const @@ -93,8 +93,8 @@ namespace GUI { glsafe(::glLineWidth(1.5f)); float color[3]; - color[0] = (m_state == Select) ? 0.3f : 1.0f; - color[1] = (m_state == Select) ? 1.0f : 0.3f; + color[0] = (m_state == EState::Select) ? 0.3f : 1.0f; + color[1] = (m_state == EState::Select) ? 1.0f : 0.3f; color[2] = 0.3f; glsafe(::glColor3fv(color)); diff --git a/src/slic3r/GUI/GLSelectionRectangle.hpp b/src/slic3r/GUI/GLSelectionRectangle.hpp index d9869771ef..dbbb056a94 100644 --- a/src/slic3r/GUI/GLSelectionRectangle.hpp +++ b/src/slic3r/GUI/GLSelectionRectangle.hpp @@ -11,7 +11,7 @@ class GLCanvas3D; class GLSelectionRectangle { public: - enum EState { + enum class EState { Off, Select, Deselect @@ -32,18 +32,22 @@ public: void render(const GLCanvas3D& canvas) const; - bool is_dragging() const { return m_state != Off; } + bool is_dragging() const { return m_state != EState::Off; } +#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + bool is_empty() const { return m_state == EState::Off || m_start_corner.isApprox(m_end_corner); } +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + EState get_state() const { return m_state; } - float get_width() const { return std::abs(m_start_corner(0) - m_end_corner(0)); } - float get_height() const { return std::abs(m_start_corner(1) - m_end_corner(1)); } - float get_left() const { return std::min(m_start_corner(0), m_end_corner(0)); } - float get_right() const { return std::max(m_start_corner(0), m_end_corner(0)); } - float get_top() const { return std::max(m_start_corner(1), m_end_corner(1)); } - float get_bottom() const { return std::min(m_start_corner(1), m_end_corner(1)); } + float get_width() const { return std::abs(m_start_corner.x() - m_end_corner.x()); } + float get_height() const { return std::abs(m_start_corner.y() - m_end_corner.y()); } + float get_left() const { return std::min(m_start_corner.x(), m_end_corner.x()); } + float get_right() const { return std::max(m_start_corner.x(), m_end_corner.x()); } + float get_top() const { return std::max(m_start_corner.y(), m_end_corner.y()); } + float get_bottom() const { return std::min(m_start_corner.y(), m_end_corner.y()); } private: - EState m_state = Off; + EState m_state{ EState::Off }; Vec2d m_start_corner; Vec2d m_end_corner; }; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp index 691a867063..e5dee5248f 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp @@ -258,7 +258,7 @@ bool GLGizmoHollow::gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_pos if (action == SLAGizmoEventType::LeftDown && (shift_down || alt_down || control_down)) { if (m_hover_id == -1) { if (shift_down || alt_down) { - m_selection_rectangle.start_dragging(mouse_position, shift_down ? GLSelectionRectangle::Select : GLSelectionRectangle::Deselect); + m_selection_rectangle.start_dragging(mouse_position, shift_down ? GLSelectionRectangle::EState::Select : GLSelectionRectangle::EState::Deselect); } } else { @@ -324,7 +324,7 @@ bool GLGizmoHollow::gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_pos trafo, wxGetApp().plater()->get_camera(), points_inside, m_c->object_clipper()->get_clipping_plane())) { - if (rectangle_status == GLSelectionRectangle::Deselect) + if (rectangle_status == GLSelectionRectangle::EState::Deselect) unselect_point(points_idxs[idx]); else select_point(points_idxs[idx]); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index 29e1fd2f30..8395adadf2 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -344,7 +344,7 @@ bool GLGizmoSlaSupports::gizmo_event(SLAGizmoEventType action, const Vec2d& mous if (action == SLAGizmoEventType::LeftDown && (shift_down || alt_down || control_down)) { if (m_hover_id == -1) { if (shift_down || alt_down) { - m_selection_rectangle.start_dragging(mouse_position, shift_down ? GLSelectionRectangle::Select : GLSelectionRectangle::Deselect); + m_selection_rectangle.start_dragging(mouse_position, shift_down ? GLSelectionRectangle::EState::Select : GLSelectionRectangle::EState::Deselect); } } else { @@ -415,7 +415,7 @@ bool GLGizmoSlaSupports::gizmo_event(SLAGizmoEventType action, const Vec2d& mous { if (idx >= orig_pts_num) // this is a cone-base, get index of point it belongs to idx -= orig_pts_num; - if (rectangle_status == GLSelectionRectangle::Deselect) + if (rectangle_status == GLSelectionRectangle::EState::Deselect) unselect_point(points_idxs[idx]); else select_point(points_idxs[idx]); From 7274d2bb6e7009a0bfbd0f5a281a8b6037ca7ad5 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 11 Jan 2022 09:43:43 +0100 Subject: [PATCH 02/40] Fixed warning --- src/slic3r/GUI/GLCanvas3D.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 7a8c13e5d8..955287f0f6 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -5706,7 +5706,9 @@ void GLCanvas3D::_update_volumes_hover_state() return; } +#if !ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION bool selection_modifiers_only = m_selection.is_empty() || m_selection.is_any_modifier(); +#endif // !ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION bool hover_modifiers_only = true; for (int i : m_hover_volume_idxs) { From f09c3e111803bc30d4cb007b898770869d93f730 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Fri, 14 Jan 2022 11:28:20 +0100 Subject: [PATCH 03/40] Techs ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE, ENABLE_NEW_CAMERA_MOVEMENTS_MIDMOUSE_ROTATE and ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION moved to 2.5.1.alpha1 --- src/libslic3r/Technologies.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index f267d4f55f..1641e5804a 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -43,10 +43,6 @@ // Enable detection of layers for spiral vase prints #define ENABLE_SPIRAL_VASE_LAYERS (1 && ENABLE_2_4_1_RC) -// Enable modified camera control and selection using mouse -#define ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE (1 && ENABLE_2_4_1_RC) -#define ENABLE_NEW_CAMERA_MOVEMENTS_MIDMOUSE_ROTATE (1 && ENABLE_2_4_1_RC) -#define ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION (1 && ENABLE_2_4_1_RC) //==================== @@ -62,6 +58,10 @@ #define ENABLE_PREVIEW_LAYER_TIME (1 && ENABLE_2_5_0_ALPHA1) // Enable showing time estimate for travel moves in legend #define ENABLE_TRAVEL_TIME (1 && ENABLE_2_5_0_ALPHA1) +// Enable modified camera control and selection using mouse +#define ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE (1 && ENABLE_2_5_0_ALPHA1) +#define ENABLE_NEW_CAMERA_MOVEMENTS_MIDMOUSE_ROTATE (1 && ENABLE_2_5_0_ALPHA1) +#define ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION (1 && ENABLE_2_5_0_ALPHA1) #endif // _prusaslicer_technologies_h_ From 1ad8460a3cfbd840d374fe32c0e01749effcb39e Mon Sep 17 00:00:00 2001 From: Nick Berardi Date: Sun, 27 Feb 2022 09:58:07 -0500 Subject: [PATCH 04/40] creality.ini: add Ender-3 Pro Added missing profile for Creality Ender-3 Pro --- resources/profiles/Creality.ini | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/resources/profiles/Creality.ini b/resources/profiles/Creality.ini index 381efbe2ff..1ebcb8ebcb 100644 --- a/resources/profiles/Creality.ini +++ b/resources/profiles/Creality.ini @@ -32,6 +32,15 @@ bed_model = ender3_bed.stl bed_texture = ender3.svg default_materials = Generic PLA @CREALITY; Generic PETG @CREALITY; Generic ABS @CREALITY; Creality PLA @CREALITY; Prusament PLA @CREALITY; Prusament PETG @CREALITY; AzureFilm PLA @CREALITY; Devil Design PLA @CREALITY; Devil Design PLA Matt @CREALITY; Devil Design PLA Galaxy @CREALITY; Extrudr PLA NX2 @CREALITY; Real Filament PLA @CREALITY; Velleman PLA @CREALITY; 3DJAKE ecoPLA @CREALITY; 3DJAKE ecoPLA Matt @CREALITY; 3DJAKE ecoPLA Tough @CREALITY; 123-3D Jupiter PLA @CREALITY +[printer_model:ENDER3PRO] +name = Creality Ender-3 Pro +variants = 0.4 +technology = FFF +family = ENDER +bed_model = ender3_bed.stl +bed_texture = ender3.svg +default_materials = Generic PLA @CREALITY; Generic PETG @CREALITY; Generic ABS @CREALITY; Creality PLA @CREALITY; Prusament PLA @CREALITY; Prusament PETG @CREALITY; AzureFilm PLA @CREALITY; Devil Design PLA @CREALITY; Devil Design PLA Matt @CREALITY; Devil Design PLA Galaxy @CREALITY; Extrudr PLA NX2 @CREALITY; Real Filament PLA @CREALITY; Velleman PLA @CREALITY; 3DJAKE ecoPLA @CREALITY; 3DJAKE ecoPLA Matt @CREALITY; 3DJAKE ecoPLA Tough @CREALITY; 123-3D Jupiter PLA @CREALITY + [printer_model:ENDER3V2] name = Creality Ender-3 V2 variants = 0.4 @@ -960,6 +969,14 @@ inherits = Creality Ender-3; *fastabl* renamed_from = "Creality ENDER-3 BLTouch" printer_model = ENDER3BLTOUCH +[printer:Creality Ender-3 Pro] +inherits = *common* +renamed_from = "Creality Ender-3 Pro" +bed_shape = 5x0,215x0,215x220,5x220 +max_print_height = 250 +printer_model = ENDER3PRO +printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_CREALITY\nPRINTER_MODEL_ENDER3PRO\nPRINTER_HAS_BOWDEN + [printer:Creality Ender-3 V2] inherits = *common* renamed_from = "Creality Ender-3V2" From 537fa118df7cd16ac1b265056f7cbdb5d280c768 Mon Sep 17 00:00:00 2001 From: Nick Berardi Date: Sun, 27 Feb 2022 10:32:58 -0500 Subject: [PATCH 05/40] Added support for `*pauseprint*` to Ender-3 models Added support for `*pauseprint*` to Ender-3 models, as they do support `M25` out of the box from at least the Ender-3 line forward. --- resources/profiles/Creality.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/profiles/Creality.ini b/resources/profiles/Creality.ini index 1ebcb8ebcb..b3d8507093 100644 --- a/resources/profiles/Creality.ini +++ b/resources/profiles/Creality.ini @@ -970,7 +970,7 @@ renamed_from = "Creality ENDER-3 BLTouch" printer_model = ENDER3BLTOUCH [printer:Creality Ender-3 Pro] -inherits = *common* +inherits = *common*; *pauseprint* renamed_from = "Creality Ender-3 Pro" bed_shape = 5x0,215x0,215x220,5x220 max_print_height = 250 @@ -978,7 +978,7 @@ printer_model = ENDER3PRO printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_CREALITY\nPRINTER_MODEL_ENDER3PRO\nPRINTER_HAS_BOWDEN [printer:Creality Ender-3 V2] -inherits = *common* +inherits = *common*; *pauseprint* renamed_from = "Creality Ender-3V2" bed_shape = 5x0,215x0,215x220,5x220 max_print_height = 250 @@ -986,7 +986,7 @@ printer_model = ENDER3V2 printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_CREALITY\nPRINTER_MODEL_ENDER3V2\nPRINTER_HAS_BOWDEN [printer:Creality Ender-3 S1] -inherits = *common*; *spriteextruder* +inherits = *common*; *pauseprint*; *spriteextruder* bed_shape = 5x0,215x0,215x220,5x220 max_print_height = 270 printer_model = ENDER3S1 From a1846e38d2439854d17a0985de7277849204cc1d Mon Sep 17 00:00:00 2001 From: Nick Berardi Date: Sun, 27 Feb 2022 10:37:08 -0500 Subject: [PATCH 06/40] Reved Creality.ini version Reved Creality.ini version, and included `*pauseprint*` for Ender-3 Max as well. --- resources/profiles/Creality.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/profiles/Creality.ini b/resources/profiles/Creality.ini index b3d8507093..0fa14d8a8b 100644 --- a/resources/profiles/Creality.ini +++ b/resources/profiles/Creality.ini @@ -5,7 +5,7 @@ name = Creality # Configuration version of this file. Config file will only be installed, if the config_version differs. # This means, the server may force the PrusaSlicer configuration to be downgraded. -config_version = 0.1.3 +config_version = 0.1.4 # Where to get the updates from? config_update_url = https://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/Creality/ # changelog_url = https://files.prusa3d.com/?latest=slicer-profiles&lng=%1% @@ -993,7 +993,7 @@ printer_model = ENDER3S1 printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_CREALITY\nPRINTER_MODEL_ENDER3S1 [printer:Creality Ender-3 Max] -inherits = *common* +inherits = *common*; *pauseprint* retract_length = 6 bed_shape = 5x5,295x5,295x295,5x295 max_print_height = 340 From 9d2314557dcc26cd8e5aff43f618fdeb8aafb023 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 10 Mar 2022 13:40:37 +0100 Subject: [PATCH 07/40] Tech ENABLE_GL_SHADERS_ATTRIBUTES - Removed remaining pairs glPushMatrix()/glPopMatrix() --- src/slic3r/GUI/GLCanvas3D.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 4a42e11c1b..d8d1556c87 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -5764,6 +5764,7 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale() void GLCanvas3D::_render_overlays() { glsafe(::glDisable(GL_DEPTH_TEST)); +#if !ENABLE_GL_SHADERS_ATTRIBUTES glsafe(::glPushMatrix()); glsafe(::glLoadIdentity()); // ensure that the textures are renderered inside the frustrum @@ -5772,6 +5773,7 @@ void GLCanvas3D::_render_overlays() // ensure that the overlay fits the frustrum near z plane double gui_scale = camera.get_gui_scale(); glsafe(::glScaled(gui_scale, gui_scale, 1.0)); +#endif // !ENABLE_GL_SHADERS_ATTRIBUTES _check_and_update_toolbar_icon_scale(); @@ -5810,7 +5812,9 @@ void GLCanvas3D::_render_overlays() } m_labels.render(sorted_instances); +#if !ENABLE_GL_SHADERS_ATTRIBUTES glsafe(::glPopMatrix()); +#endif // !ENABLE_GL_SHADERS_ATTRIBUTES } void GLCanvas3D::_render_volumes_for_picking() const From 3dddfa919a6340a73973c6c48db3a7c0d98fe650 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 10 Mar 2022 15:55:15 +0100 Subject: [PATCH 08/40] Debug tech ENABLE_GLMODEL_STATISTICS - Shows an imgui dialog with GLModel statistics data --- src/libslic3r/Technologies.hpp | 2 + src/slic3r/GUI/GLCanvas3D.cpp | 7 ++ src/slic3r/GUI/GLModel.cpp | 95 +++++++++++++++++++++++++ src/slic3r/GUI/GLModel.hpp | 31 ++++++++ src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp | 3 +- 5 files changed, 136 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index f8f9f80e21..85158ccb22 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -70,6 +70,8 @@ #define ENABLE_LEGACY_OPENGL_REMOVAL (1 && ENABLE_2_5_0_ALPHA1) // Enable using vertex attributes and matrices in shaders #define ENABLE_GL_SHADERS_ATTRIBUTES (1 && ENABLE_LEGACY_OPENGL_REMOVAL) +// Shows an imgui dialog with GLModel statistics data +#define ENABLE_GLMODEL_STATISTICS (0 && ENABLE_LEGACY_OPENGL_REMOVAL) // Enable show non-manifold edges #define ENABLE_SHOW_NON_MANIFOLD_EDGES (1 && ENABLE_2_5_0_ALPHA1) // Enable rework of Reload from disk command diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index d8d1556c87..46219c1d12 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1667,6 +1667,10 @@ void GLCanvas3D::render() wxGetApp().plater()->init_environment_texture(); #endif // ENABLE_ENVIRONMENT_MAP +#if ENABLE_GLMODEL_STATISTICS + GLModel::reset_statistics_counters(); +#endif // ENABLE_GLMODEL_STATISTICS + const Size& cnv_size = get_canvas_size(); // Probably due to different order of events on Linux/GTK2, when one switched from 3D scene // to preview, this was called before canvas had its final size. It reported zero width @@ -1776,6 +1780,9 @@ void GLCanvas3D::render() #if ENABLE_CAMERA_STATISTICS camera.debug_render(); #endif // ENABLE_CAMERA_STATISTICS +#if ENABLE_GLMODEL_STATISTICS + GLModel::render_statistics(); +#endif // ENABLE_GLMODEL_STATISTICS std::string tooltip; diff --git a/src/slic3r/GUI/GLModel.cpp b/src/slic3r/GUI/GLModel.cpp index a92153330c..b81287ecee 100644 --- a/src/slic3r/GUI/GLModel.cpp +++ b/src/slic3r/GUI/GLModel.cpp @@ -4,6 +4,10 @@ #include "3DScene.hpp" #include "GUI_App.hpp" #include "GLShader.hpp" +#if ENABLE_GLMODEL_STATISTICS +#include "Plater.hpp" +#include "GLCanvas3D.hpp" +#endif // ENABLE_GLMODEL_STATISTICS #include "libslic3r/TriangleMesh.hpp" #include "libslic3r/Model.hpp" @@ -13,6 +17,10 @@ #include "libslic3r/Geometry/ConvexHull.hpp" #endif // ENABLE_LEGACY_OPENGL_REMOVAL +#if ENABLE_GLMODEL_STATISTICS +#include +#endif // ENABLE_GLMODEL_STATISTICS + #include #include @@ -380,6 +388,10 @@ size_t GLModel::Geometry::indices_count() const } #endif // ENABLE_LEGACY_OPENGL_REMOVAL +#if ENABLE_GLMODEL_STATISTICS +GLModel::Statistics GLModel::s_statistics; +#endif // ENABLE_GLMODEL_STATISTICS + #if ENABLE_LEGACY_OPENGL_REMOVAL void GLModel::init_from(Geometry&& data) #else @@ -702,10 +714,16 @@ void GLModel::reset() if (m_render_data.ibo_id > 0) { glsafe(::glDeleteBuffers(1, &m_render_data.ibo_id)); m_render_data.ibo_id = 0; +#if ENABLE_GLMODEL_STATISTICS + s_statistics.gpu_memory.indices.current -= indices_size_bytes(); +#endif // ENABLE_GLMODEL_STATISTICS } if (m_render_data.vbo_id > 0) { glsafe(::glDeleteBuffers(1, &m_render_data.vbo_id)); m_render_data.vbo_id = 0; +#if ENABLE_GLMODEL_STATISTICS + s_statistics.gpu_memory.vertices.current -= vertices_size_bytes(); +#endif // ENABLE_GLMODEL_STATISTICS } m_render_data.vertices_count = 0; @@ -899,6 +917,10 @@ void GLModel::render(const std::pair& range) #endif // ENABLE_GL_SHADERS_ATTRIBUTES glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0)); + +#if ENABLE_GLMODEL_STATISTICS + ++s_statistics.render_calls; +#endif // ENABLE_GLMODEL_STATISTICS } #endif // ENABLE_LEGACY_OPENGL_REMOVAL @@ -1054,6 +1076,10 @@ void GLModel::render_instanced(unsigned int instances_vbo, unsigned int instance #endif // ENABLE_LEGACY_OPENGL_REMOVAL glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0)); + +#if ENABLE_GLMODEL_STATISTICS + ++s_statistics.render_instanced_calls; +#endif // ENABLE_GLMODEL_STATISTICS } #if ENABLE_LEGACY_OPENGL_REMOVAL @@ -1076,6 +1102,10 @@ bool GLModel::send_to_gpu() glsafe(::glBufferData(GL_ARRAY_BUFFER, data.vertices_size_bytes(), data.vertices.data(), GL_STATIC_DRAW)); glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0)); m_render_data.vertices_count = vertices_count(); +#if ENABLE_GLMODEL_STATISTICS + s_statistics.gpu_memory.vertices.current += data.vertices_size_bytes(); + s_statistics.gpu_memory.vertices.max = std::max(s_statistics.gpu_memory.vertices.current, s_statistics.gpu_memory.vertices.max); +#endif // ENABLE_GLMODEL_STATISTICS data.vertices = std::vector(); // indices @@ -1107,10 +1137,75 @@ bool GLModel::send_to_gpu() glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); } m_render_data.indices_count = indices_count; +#if ENABLE_GLMODEL_STATISTICS + s_statistics.gpu_memory.indices.current += data.indices_size_bytes(); + s_statistics.gpu_memory.indices.max = std::max(s_statistics.gpu_memory.indices.current, s_statistics.gpu_memory.indices.max); +#endif // ENABLE_GLMODEL_STATISTICS data.indices = std::vector(); return true; } + +#if ENABLE_GLMODEL_STATISTICS +void GLModel::render_statistics() +{ + static const float offset = 175.0f; + ImGuiWrapper& imgui = *wxGetApp().imgui(); + + auto add_memory = [&imgui](const std::string& label, int64_t memory) { + auto format_string = [memory](const std::string& units, float value) { + return std::to_string(memory) + " bytes (" + + Slic3r::float_to_string_decimal_point(float(memory) * value, 3) + + " " + units + ")"; + }; + + static const float kb = 1024.0f; + static const float inv_kb = 1.0f / kb; + static const float mb = 1024.0f * kb; + static const float inv_mb = 1.0f / mb; + static const float gb = 1024.0f * mb; + static const float inv_gb = 1.0f / gb; + imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, label); + ImGui::SameLine(offset); + if (static_cast(memory) < mb) + imgui.text(format_string("KB", inv_kb)); + else if (static_cast(memory) < gb) + imgui.text(format_string("MB", inv_mb)); + else + imgui.text(format_string("GB", inv_gb)); + }; + + auto add_counter = [&imgui](const std::string& label, int64_t counter) { + imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, label); + ImGui::SameLine(offset); + imgui.text(std::to_string(counter)); + }; + + imgui.set_next_window_pos(0.5f * wxGetApp().plater()->get_current_canvas3D()->get_canvas_size().get_width(), 0.0f, ImGuiCond_Once, 0.5f, 0.0f); + ImGui::SetNextWindowSizeConstraints({ 300.0f, 100.0f }, { 600.0f, 900.0f }); + imgui.begin(std::string("GLModel Statistics"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize); + ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindow()); + + add_counter(std::string("Render calls:"), s_statistics.render_calls); + add_counter(std::string("Render instanced calls:"), s_statistics.render_instanced_calls); + + if (ImGui::CollapsingHeader("GPU memory")) { + ImGui::Indent(10.0f); + if (ImGui::CollapsingHeader("Vertices")) { + add_memory(std::string("Current:"), s_statistics.gpu_memory.vertices.current); + add_memory(std::string("Max:"), s_statistics.gpu_memory.vertices.max); + } + if (ImGui::CollapsingHeader("Indices")) { + add_memory(std::string("Current:"), s_statistics.gpu_memory.indices.current); + add_memory(std::string("Max:"), s_statistics.gpu_memory.indices.max); + } + ImGui::Unindent(10.0f); + } + + imgui.end(); +} +#endif // ENABLE_GLMODEL_STATISTICS + #else void GLModel::send_to_gpu(RenderData& data, const std::vector& vertices, const std::vector& indices) { diff --git a/src/slic3r/GUI/GLModel.hpp b/src/slic3r/GUI/GLModel.hpp index e18d046783..e2da09484d 100644 --- a/src/slic3r/GUI/GLModel.hpp +++ b/src/slic3r/GUI/GLModel.hpp @@ -177,6 +177,29 @@ namespace GUI { private: #if ENABLE_LEGACY_OPENGL_REMOVAL +#if ENABLE_GLMODEL_STATISTICS + struct Statistics + { + struct Buffers + { + struct Data + { + size_t current{ 0 }; + size_t max{ 0 }; + }; + Data indices; + Data vertices; + }; + + Buffers gpu_memory; + + int64_t render_calls{ 0 }; + int64_t render_instanced_calls{ 0 }; + }; + + static Statistics s_statistics; +#endif // ENABLE_GLMODEL_STATISTICS + RenderData m_render_data; // By default the vertex and index buffers data are sent to gpu at the first call to render() method. @@ -272,6 +295,14 @@ namespace GUI { ret += indices_size_bytes(); return ret; } + +#if ENABLE_GLMODEL_STATISTICS + static void render_statistics(); + static void reset_statistics_counters() { + s_statistics.render_calls = 0; + s_statistics.render_instanced_calls = 0; + } +#endif // ENABLE_GLMODEL_STATISTICS #endif // ENABLE_LEGACY_OPENGL_REMOVAL private: diff --git a/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp b/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp index 266b6a3cac..1d817b58bc 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp @@ -182,8 +182,7 @@ void GLGizmoRotate::on_render() #if ENABLE_GL_SHADERS_ATTRIBUTES const Camera& camera = wxGetApp().plater()->get_camera(); - Transform3d view_model_matrix = camera.get_view_matrix() * m_grabbers.front().matrix; - + const Transform3d view_model_matrix = camera.get_view_matrix() * m_grabbers.front().matrix; shader->set_uniform("view_model_matrix", view_model_matrix); shader->set_uniform("projection_matrix", camera.get_projection_matrix()); #endif // ENABLE_GL_SHADERS_ATTRIBUTES From b32c97ea76493dc4125e390585f2cedc4478e44d Mon Sep 17 00:00:00 2001 From: rtyr <36745189+rtyr@users.noreply.github.com> Date: Fri, 11 Mar 2022 10:55:47 +0100 Subject: [PATCH 09/40] Added Ender-3 Pro. --- resources/profiles/Creality.idx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/profiles/Creality.idx b/resources/profiles/Creality.idx index f8abfb40a0..1ff148aad3 100644 --- a/resources/profiles/Creality.idx +++ b/resources/profiles/Creality.idx @@ -1,3 +1,5 @@ +min_slic3r_version = 2.4.1 +0.1.4 Added Ender-3 Pro. Added M25 support for some printers. min_slic3r_version = 2.4.0-rc 0.1.3 Ender-3 S1 improvements. 0.1.2 Added alpha Ender 3 S1 profiles. From 2342002151a2ce4f25cb3b0b9cae10ce797ddc8e Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Fri, 11 Mar 2022 11:28:08 +0100 Subject: [PATCH 10/40] Tech ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE - Fixed volumes moving after releasing CTRL key Tech ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION - Selection rectangle not started while hovering on a volume --- src/slic3r/GUI/GLCanvas3D.cpp | 39 +++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 76bcde9471..6e1c1c536f 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2928,8 +2928,7 @@ void GLCanvas3D::on_key(wxKeyEvent& evt) if (imgui->update_key_data(evt)) { render(); } - else - { + else { if (!m_gizmos.on_key(evt)) { if (evt.GetEventType() == wxEVT_KEY_UP) { if (evt.ShiftDown() && evt.ControlDown() && keyCode == WXK_SPACE) { @@ -2970,8 +2969,17 @@ void GLCanvas3D::on_key(wxKeyEvent& evt) } // set_cursor(Standard); } - else if (keyCode == WXK_CONTROL) + else if (keyCode == WXK_CONTROL) { +#if ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE + if (m_mouse.dragging) { + // if the user releases CTRL while rotating the 3D scene + // prevent from moving the selected volume + m_mouse.drag.move_volume_idx = -1; + m_mouse.set_start_position_3D_as_invalid(); + } +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE m_dirty = true; + } else if (m_gizmos.is_enabled() && !m_selection.is_empty()) { translationProcessor.process(evt); @@ -3444,10 +3452,10 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) else { #if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION if (evt.LeftDown() && (evt.ShiftDown() || evt.AltDown()) && m_picking_enabled) { - if (m_gizmos.get_current_type() != GLGizmosManager::SlaSupports - && m_gizmos.get_current_type() != GLGizmosManager::FdmSupports - && m_gizmos.get_current_type() != GLGizmosManager::Seam - && m_gizmos.get_current_type() != GLGizmosManager::MmuSegmentation) { + if (m_gizmos.get_current_type() != GLGizmosManager::SlaSupports && + m_gizmos.get_current_type() != GLGizmosManager::FdmSupports && + m_gizmos.get_current_type() != GLGizmosManager::Seam && + m_gizmos.get_current_type() != GLGizmosManager::MmuSegmentation) { m_rectangle_selection.start_dragging(m_mouse.position, evt.ShiftDown() ? GLSelectionRectangle::EState::Select : GLSelectionRectangle::EState::Deselect); m_dirty = true; } @@ -3459,7 +3467,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) // during the scene manipulation. #if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION - if (m_picking_enabled && (!any_gizmo_active || !evt.ShiftDown()) && (!m_hover_volume_idxs.empty() || !is_layers_editing_enabled())) { + if (m_picking_enabled && (!any_gizmo_active || !evt.ShiftDown()) && (!m_hover_volume_idxs.empty() || !is_layers_editing_enabled()) && + !m_rectangle_selection.is_dragging()) { #else if (m_picking_enabled && (!any_gizmo_active || !evt.CmdDown()) && (!m_hover_volume_idxs.empty() || !is_layers_editing_enabled())) { #endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION @@ -3507,7 +3516,11 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } } +#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + if (!m_hover_volume_idxs.empty() && !m_rectangle_selection.is_dragging()) { +#else if (!m_hover_volume_idxs.empty()) { +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION if (evt.LeftDown() && m_moving_enabled && m_mouse.drag.move_volume_idx == -1) { // Only accept the initial position, if it is inside the volume bounding box. const int volume_idx = get_first_hover_volume_idx(); @@ -3518,6 +3531,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) // The dragging operation is initiated. m_mouse.drag.move_volume_idx = volume_idx; #if ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE + m_selection.setup_cache(); if (!evt.CmdDown()) #endif // ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE m_mouse.drag.start_position_3D = m_mouse.scene_position; @@ -3529,7 +3543,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } } #if ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE - else if (evt.Dragging() && evt.LeftIsDown() && !evt.CmdDown() && m_layers_editing.state == LayersEditing::Unknown && m_mouse.drag.move_volume_idx != -1) { + else if (evt.Dragging() && evt.LeftIsDown() && !evt.CmdDown() && m_layers_editing.state == LayersEditing::Unknown && + m_mouse.drag.move_volume_idx != -1 && m_mouse.is_start_position_3D_defined()) { #else else if (evt.Dragging() && evt.LeftIsDown() && m_layers_editing.state == LayersEditing::Unknown && m_mouse.drag.move_volume_idx != -1) { #endif // ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE @@ -3578,7 +3593,13 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } } else if (evt.Dragging() && evt.LeftIsDown() && m_picking_enabled && m_rectangle_selection.is_dragging()) { +#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION + // keeps the mouse position updated while dragging the selection rectangle + m_mouse.position = pos.cast(); + m_rectangle_selection.dragging(m_mouse.position); +#else m_rectangle_selection.dragging(pos.cast()); +#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION m_dirty = true; } else if (evt.Dragging()) { From ac0ec5fa4391423e6a23dd8d4463431fb6c43d02 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Fri, 11 Mar 2022 12:36:09 +0100 Subject: [PATCH 11/40] Tech ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE renamed as ENABLE_NEW_CAMERA_MOVEMENTS Tech ENABLE_NEW_CAMERA_MOVEMENTS_MIDMOUSE_ROTATE merged into ENABLE_NEW_CAMERA_MOVEMENTS Tech ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION renamed as ENABLE_NEW_RECTANGLE_SELECTION --- src/libslic3r/Technologies.hpp | 8 +- src/slic3r/GUI/GLCanvas3D.cpp | 97 ++++++++++++------------- src/slic3r/GUI/GLSelectionRectangle.hpp | 4 +- 3 files changed, 53 insertions(+), 56 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index c306cccc4d..b46b8731fd 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -80,10 +80,10 @@ #define ENABLE_SHOW_TOOLPATHS_COG (1 && ENABLE_2_5_0_ALPHA1) // Enable recalculating toolpaths when switching to/from volumetric rate visualization #define ENABLE_VOLUMETRIC_RATE_TOOLPATHS_RECALC (1 && ENABLE_2_5_0_ALPHA1) -// Enable modified camera control and selection using mouse -#define ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE (1 && ENABLE_2_5_0_ALPHA1) -#define ENABLE_NEW_CAMERA_MOVEMENTS_MIDMOUSE_ROTATE (1 && ENABLE_2_5_0_ALPHA1) -#define ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION (1 && ENABLE_2_5_0_ALPHA1) +// Enable modified camera control using mouse +#define ENABLE_NEW_CAMERA_MOVEMENTS (1 && ENABLE_2_5_0_ALPHA1) +// Enable modified rectangle selection +#define ENABLE_NEW_RECTANGLE_SELECTION (1 && ENABLE_2_5_0_ALPHA1) #endif // _prusaslicer_technologies_h_ diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 6e1c1c536f..ea08f98711 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1696,11 +1696,11 @@ void GLCanvas3D::render() wxGetApp().imgui()->new_frame(); if (m_picking_enabled) { -#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if ENABLE_NEW_RECTANGLE_SELECTION if (m_rectangle_selection.is_dragging() && !m_rectangle_selection.is_empty()) #else if (m_rectangle_selection.is_dragging()) -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // ENABLE_NEW_RECTANGLE_SELECTION // picking pass using rectangle selection _rectangular_selection_picking_pass(); else if (!m_volumes.empty()) @@ -2951,13 +2951,13 @@ void GLCanvas3D::on_key(wxKeyEvent& evt) _update_selection_from_hover(); m_rectangle_selection.stop_dragging(); m_mouse.ignore_left_up = true; -#if !ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if !ENABLE_NEW_RECTANGLE_SELECTION m_dirty = true; -#endif // !ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // !ENABLE_NEW_RECTANGLE_SELECTION } -#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if ENABLE_NEW_RECTANGLE_SELECTION m_dirty = true; -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // ENABLE_NEW_RECTANGLE_SELECTION // set_cursor(Standard); } else if (keyCode == WXK_ALT) { @@ -2970,14 +2970,14 @@ void GLCanvas3D::on_key(wxKeyEvent& evt) // set_cursor(Standard); } else if (keyCode == WXK_CONTROL) { -#if ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE +#if ENABLE_NEW_CAMERA_MOVEMENTS if (m_mouse.dragging) { // if the user releases CTRL while rotating the 3D scene // prevent from moving the selected volume m_mouse.drag.move_volume_idx = -1; m_mouse.set_start_position_3D_as_invalid(); } -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE +#endif // ENABLE_NEW_CAMERA_MOVEMENTS m_dirty = true; } else if (m_gizmos.is_enabled() && !m_selection.is_empty()) { @@ -3014,9 +3014,9 @@ void GLCanvas3D::on_key(wxKeyEvent& evt) m_mouse.ignore_left_up = false; // set_cursor(Cross); } -#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if ENABLE_NEW_RECTANGLE_SELECTION m_dirty = true; -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // ENABLE_NEW_RECTANGLE_SELECTION } else if (keyCode == WXK_ALT) { if (m_picking_enabled && (m_gizmos.get_current_type() != GLGizmosManager::SlaSupports)) { @@ -3438,7 +3438,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_layers_editing.state = LayersEditing::Editing; _perform_layer_editing_action(&evt); } -#if !ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if !ENABLE_NEW_RECTANGLE_SELECTION else if (evt.LeftDown() && (evt.ShiftDown() || evt.AltDown()) && m_picking_enabled) { if (m_gizmos.get_current_type() != GLGizmosManager::SlaSupports && m_gizmos.get_current_type() != GLGizmosManager::FdmSupports @@ -3448,9 +3448,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_dirty = true; } } -#endif // !ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // !ENABLE_NEW_RECTANGLE_SELECTION else { -#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if ENABLE_NEW_RECTANGLE_SELECTION if (evt.LeftDown() && (evt.ShiftDown() || evt.AltDown()) && m_picking_enabled) { if (m_gizmos.get_current_type() != GLGizmosManager::SlaSupports && m_gizmos.get_current_type() != GLGizmosManager::FdmSupports && @@ -3460,41 +3460,40 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_dirty = true; } } -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // ENABLE_NEW_RECTANGLE_SELECTION // Select volume in this 3D canvas. // Don't deselect a volume if layer editing is enabled or any gizmo is active. We want the object to stay selected // during the scene manipulation. -#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if ENABLE_NEW_RECTANGLE_SELECTION if (m_picking_enabled && (!any_gizmo_active || !evt.ShiftDown()) && (!m_hover_volume_idxs.empty() || !is_layers_editing_enabled()) && !m_rectangle_selection.is_dragging()) { #else if (m_picking_enabled && (!any_gizmo_active || !evt.CmdDown()) && (!m_hover_volume_idxs.empty() || !is_layers_editing_enabled())) { -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // ENABLE_NEW_RECTANGLE_SELECTION if (evt.LeftDown() && !m_hover_volume_idxs.empty()) { int volume_idx = get_first_hover_volume_idx(); bool already_selected = m_selection.contains_volume(volume_idx); -#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if ENABLE_NEW_RECTANGLE_SELECTION bool shift_down = evt.ShiftDown(); #else bool ctrl_down = evt.CmdDown(); -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // ENABLE_NEW_RECTANGLE_SELECTION Selection::IndicesList curr_idxs = m_selection.get_volume_idxs(); -#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if ENABLE_NEW_RECTANGLE_SELECTION if (already_selected && shift_down) -#else - if (already_selected && ctrl_down) -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION m_selection.remove(volume_idx); else { -#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION m_selection.add(volume_idx, !shift_down, true); #else + if (already_selected && ctrl_down) + m_selection.remove(volume_idx); + else { m_selection.add(volume_idx, !ctrl_down, true); -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // ENABLE_NEW_RECTANGLE_SELECTION m_mouse.drag.move_requires_threshold = !already_selected; if (already_selected) m_mouse.set_move_start_threshold_position_2D_as_invalid(); @@ -3516,11 +3515,11 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } } -#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if ENABLE_NEW_RECTANGLE_SELECTION if (!m_hover_volume_idxs.empty() && !m_rectangle_selection.is_dragging()) { #else if (!m_hover_volume_idxs.empty()) { -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // ENABLE_NEW_RECTANGLE_SELECTION if (evt.LeftDown() && m_moving_enabled && m_mouse.drag.move_volume_idx == -1) { // Only accept the initial position, if it is inside the volume bounding box. const int volume_idx = get_first_hover_volume_idx(); @@ -3530,11 +3529,11 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_volumes.volumes[volume_idx]->hover = GLVolume::HS_None; // The dragging operation is initiated. m_mouse.drag.move_volume_idx = volume_idx; -#if ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE +#if ENABLE_NEW_CAMERA_MOVEMENTS m_selection.setup_cache(); if (!evt.CmdDown()) -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE - m_mouse.drag.start_position_3D = m_mouse.scene_position; +#endif // ENABLE_NEW_CAMERA_MOVEMENTS + m_mouse.drag.start_position_3D = m_mouse.scene_position; m_sequential_print_clearance_first_displacement = true; m_moving = true; } @@ -3542,12 +3541,12 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } } } -#if ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE +#if ENABLE_NEW_CAMERA_MOVEMENTS else if (evt.Dragging() && evt.LeftIsDown() && !evt.CmdDown() && m_layers_editing.state == LayersEditing::Unknown && m_mouse.drag.move_volume_idx != -1 && m_mouse.is_start_position_3D_defined()) { #else else if (evt.Dragging() && evt.LeftIsDown() && m_layers_editing.state == LayersEditing::Unknown && m_mouse.drag.move_volume_idx != -1) { -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE +#endif // ENABLE_NEW_CAMERA_MOVEMENTS if (!m_mouse.drag.move_requires_threshold) { m_mouse.dragging = true; Vec3d cur_pos = m_mouse.drag.start_position_3D; @@ -3593,13 +3592,13 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } } else if (evt.Dragging() && evt.LeftIsDown() && m_picking_enabled && m_rectangle_selection.is_dragging()) { -#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if ENABLE_NEW_RECTANGLE_SELECTION // keeps the mouse position updated while dragging the selection rectangle m_mouse.position = pos.cast(); m_rectangle_selection.dragging(m_mouse.position); #else m_rectangle_selection.dragging(pos.cast()); -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // ENABLE_NEW_RECTANGLE_SELECTION m_dirty = true; } else if (evt.Dragging()) { @@ -3612,17 +3611,15 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } } // do not process the dragging if the left mouse was set down in another canvas -#if ENABLE_NEW_CAMERA_MOVEMENTS_MIDMOUSE_ROTATE +#if ENABLE_NEW_CAMERA_MOVEMENTS else if (evt.LeftIsDown() || evt.MiddleIsDown()) { -#else - else if (evt.LeftIsDown()) { -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_MIDMOUSE_ROTATE // if dragging over blank area with left button, rotate -#if ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE if ((any_gizmo_active || evt.CmdDown() || evt.MiddleIsDown() || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) { #else + // if dragging over blank area with left button, rotate + else if (evt.LeftIsDown()) { if ((any_gizmo_active || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) { -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_CTRL_ROTATE +#endif // ENABLE_NEW_CAMERA_MOVEMENTS const Vec3d rot = (Vec3d(pos.x(), pos.y(), 0.0) - m_mouse.drag.start_position_3D) * (PI * TRACKBALLSIZE / 180.0); if (wxGetApp().app_config->get("use_free_camera") == "1") // Virtual track ball (similar to the 3DConnexion mouse). @@ -3641,13 +3638,13 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } m_mouse.drag.start_position_3D = Vec3d((double)pos.x(), (double)pos.y(), 0.0); } -#if ENABLE_NEW_CAMERA_MOVEMENTS_MIDMOUSE_ROTATE +#if ENABLE_NEW_CAMERA_MOVEMENTS else if (evt.RightIsDown()) { // If dragging with right button, pan. #else else if (evt.MiddleIsDown() || evt.RightIsDown()) { // If dragging over blank area with right button, pan. -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_MIDMOUSE_ROTATE +#endif // ENABLE_NEW_CAMERA_MOVEMENTS if (m_mouse.is_start_position_2D_defined()) { // get point in model space at Z = 0 float z = 0.0f; @@ -6418,9 +6415,9 @@ void GLCanvas3D::_update_volumes_hover_state() return; } -#if !ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if !ENABLE_NEW_RECTANGLE_SELECTION bool selection_modifiers_only = m_selection.is_empty() || m_selection.is_any_modifier(); -#endif // !ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // !ENABLE_NEW_RECTANGLE_SELECTION bool hover_modifiers_only = true; for (int i : m_hover_volume_idxs) { @@ -6449,14 +6446,14 @@ void GLCanvas3D::_update_volumes_hover_state() if (volume.hover != GLVolume::HS_None) continue; -#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if ENABLE_NEW_RECTANGLE_SELECTION bool deselect = volume.selected && ((shift_pressed && m_rectangle_selection.is_empty()) || (alt_pressed && !m_rectangle_selection.is_empty())); - bool select = !volume.selected && (m_rectangle_selection.is_empty() || (shift_pressed && !m_rectangle_selection.is_empty())); + bool select = !volume.selected && (m_rectangle_selection.is_empty() || (shift_pressed && !m_rectangle_selection.is_empty())); #else bool deselect = volume.selected && ((ctrl_pressed && !shift_pressed) || alt_pressed); // (volume->is_modifier && !selection_modifiers_only && !is_ctrl_pressed) -> allows hovering on selected modifiers belonging to selection of type Instance bool select = (!volume.selected || (volume.is_modifier && !selection_modifiers_only && !ctrl_pressed)) && !alt_pressed; -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // ENABLE_NEW_RECTANGLE_SELECTION if (select || deselect) { bool as_volume = @@ -7391,9 +7388,9 @@ void GLCanvas3D::_update_selection_from_hover() } bool selection_changed = false; -#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if ENABLE_NEW_RECTANGLE_SELECTION if (!m_rectangle_selection.is_empty()) { -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // ENABLE_NEW_RECTANGLE_SELECTION if (state == GLSelectionRectangle::EState::Select) { bool contains_all = true; for (int i : m_hover_volume_idxs) { @@ -7424,9 +7421,9 @@ void GLCanvas3D::_update_selection_from_hover() selection_changed = true; } } -#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if ENABLE_NEW_RECTANGLE_SELECTION } -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // ENABLE_NEW_RECTANGLE_SELECTION if (!selection_changed) return; diff --git a/src/slic3r/GUI/GLSelectionRectangle.hpp b/src/slic3r/GUI/GLSelectionRectangle.hpp index f18dc4a6ab..49b3447ba9 100644 --- a/src/slic3r/GUI/GLSelectionRectangle.hpp +++ b/src/slic3r/GUI/GLSelectionRectangle.hpp @@ -36,9 +36,9 @@ public: void render(const GLCanvas3D& canvas); bool is_dragging() const { return m_state != EState::Off; } -#if ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#if ENABLE_NEW_RECTANGLE_SELECTION bool is_empty() const { return m_state == EState::Off || m_start_corner.isApprox(m_end_corner); } -#endif // ENABLE_NEW_CAMERA_MOVEMENTS_SHIFT_SELECTION +#endif // ENABLE_NEW_RECTANGLE_SELECTION EState get_state() const { return m_state; } From d0d89a4d5bc02a87f417a2f2c73f5f91db0da5d6 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Mon, 14 Mar 2022 09:04:44 +0100 Subject: [PATCH 12/40] Tech ENABLE_GL_IMGUI_SHADERS - Render imgui using shaders --- resources/shaders/imgui.fs | 11 +++ resources/shaders/imgui.vs | 17 ++++ src/libslic3r/Technologies.hpp | 2 + src/slic3r/GUI/GLShader.cpp | 16 +++- src/slic3r/GUI/GLShader.hpp | 8 ++ src/slic3r/GUI/GLShadersManager.cpp | 2 + src/slic3r/GUI/ImGuiWrapper.cpp | 133 ++++++++++++++++++++++++++-- 7 files changed, 182 insertions(+), 7 deletions(-) create mode 100644 resources/shaders/imgui.fs create mode 100644 resources/shaders/imgui.vs diff --git a/resources/shaders/imgui.fs b/resources/shaders/imgui.fs new file mode 100644 index 0000000000..4b0e27ce9d --- /dev/null +++ b/resources/shaders/imgui.fs @@ -0,0 +1,11 @@ +#version 110 + +uniform sampler2D Texture; + +varying vec2 Frag_UV; +varying vec4 Frag_Color; + +void main() +{ + gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st); +} \ No newline at end of file diff --git a/resources/shaders/imgui.vs b/resources/shaders/imgui.vs new file mode 100644 index 0000000000..100813e2b5 --- /dev/null +++ b/resources/shaders/imgui.vs @@ -0,0 +1,17 @@ +#version 110 + +uniform mat4 ProjMtx; + +attribute vec2 Position; +attribute vec2 UV; +attribute vec4 Color; + +varying vec2 Frag_UV; +varying vec4 Frag_Color; + +void main() +{ + Frag_UV = UV; + Frag_Color = Color; + gl_Position = ProjMtx * vec4(Position.xy, 0.0, 1.0); +} \ No newline at end of file diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 85158ccb22..b90769541c 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -70,6 +70,8 @@ #define ENABLE_LEGACY_OPENGL_REMOVAL (1 && ENABLE_2_5_0_ALPHA1) // Enable using vertex attributes and matrices in shaders #define ENABLE_GL_SHADERS_ATTRIBUTES (1 && ENABLE_LEGACY_OPENGL_REMOVAL) +// Enable rendering imgui using shaders +#define ENABLE_GL_IMGUI_SHADERS (1 && ENABLE_GL_SHADERS_ATTRIBUTES) // Shows an imgui dialog with GLModel statistics data #define ENABLE_GLMODEL_STATISTICS (0 && ENABLE_LEGACY_OPENGL_REMOVAL) // Enable show non-manifold edges diff --git a/src/slic3r/GUI/GLShader.cpp b/src/slic3r/GUI/GLShader.cpp index 7e5704e87d..c82658e5c0 100644 --- a/src/slic3r/GUI/GLShader.cpp +++ b/src/slic3r/GUI/GLShader.cpp @@ -122,8 +122,7 @@ bool GLShaderProgram::init_from_texts(const std::string& name, const ShaderSourc for (size_t i = 0; i < static_cast(EShaderType::Count); ++i) { const std::string& source = sources[i]; - if (!source.empty()) - { + if (!source.empty()) { EShaderType type = static_cast(i); auto [result, id] = create_shader(type); if (result) @@ -303,6 +302,19 @@ void GLShaderProgram::set_uniform(int id, const Matrix3d& value) const } #endif // ENABLE_GL_SHADERS_ATTRIBUTES +#if ENABLE_GL_IMGUI_SHADERS +void GLShaderProgram::set_uniform(int id, const Matrix4f& value) const +{ + if (id >= 0) + glsafe(::glUniformMatrix4fv(id, 1, GL_FALSE, static_cast(value.data()))); +} + +void GLShaderProgram::set_uniform(int id, const Matrix4d& value) const +{ + set_uniform(id, (Matrix4f)value.cast()); +} +#endif // ENABLE_GL_IMGUI_SHADERS + void GLShaderProgram::set_uniform(int id, const Vec3f& value) const { if (id >= 0) diff --git a/src/slic3r/GUI/GLShader.hpp b/src/slic3r/GUI/GLShader.hpp index a867a62bda..3b669fc77d 100644 --- a/src/slic3r/GUI/GLShader.hpp +++ b/src/slic3r/GUI/GLShader.hpp @@ -64,6 +64,10 @@ public: #if ENABLE_GL_SHADERS_ATTRIBUTES void set_uniform(const char* name, const Matrix3d& value) const { set_uniform(get_uniform_location(name), value); } #endif // ENABLE_GL_SHADERS_ATTRIBUTES +#if ENABLE_GL_IMGUI_SHADERS + void set_uniform(const char* name, const Matrix4f& value) const { set_uniform(get_uniform_location(name), value); } + void set_uniform(const char* name, const Matrix4d& value) const { set_uniform(get_uniform_location(name), value); } +#endif // ENABLE_GL_IMGUI_SHADERS void set_uniform(const char* name, const Vec3f& value) const { set_uniform(get_uniform_location(name), value); } void set_uniform(const char* name, const Vec3d& value) const { set_uniform(get_uniform_location(name), value); } void set_uniform(const char* name, const ColorRGB& value) const { set_uniform(get_uniform_location(name), value); } @@ -86,6 +90,10 @@ public: #if ENABLE_GL_SHADERS_ATTRIBUTES void set_uniform(int id, const Matrix3d& value) const; #endif // ENABLE_GL_SHADERS_ATTRIBUTES +#if ENABLE_GL_IMGUI_SHADERS + void set_uniform(int id, const Matrix4f& value) const; + void set_uniform(int id, const Matrix4d& value) const; +#endif // ENABLE_GL_IMGUI_SHADERS void set_uniform(int id, const Vec3f& value) const; void set_uniform(int id, const Vec3d& value) const; void set_uniform(int id, const ColorRGB& value) const; diff --git a/src/slic3r/GUI/GLShadersManager.cpp b/src/slic3r/GUI/GLShadersManager.cpp index 75b6824a70..9f0b03ea0e 100644 --- a/src/slic3r/GUI/GLShadersManager.cpp +++ b/src/slic3r/GUI/GLShadersManager.cpp @@ -35,6 +35,8 @@ std::pair GLShadersManager::init() #if ENABLE_LEGACY_OPENGL_REMOVAL #if ENABLE_GL_SHADERS_ATTRIBUTES + // imgui shader + valid &= append_shader("imgui", { "imgui.vs", "imgui.fs" }); // basic shader, used to render all what was previously rendered using the immediate mode valid &= append_shader("flat_attr", { "flat_attr.vs", "flat.fs" }); // basic shader for textures, used to render textures diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index 4b75befb6c..819d6141e0 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -26,13 +26,18 @@ #include "libslic3r/libslic3r.h" #include "libslic3r/Utils.hpp" #include "libslic3r/Color.hpp" + #include "3DScene.hpp" #include "GUI.hpp" #include "I18N.hpp" #include "Search.hpp" #include "BitmapCache.hpp" +#if ENABLE_GL_IMGUI_SHADERS +#include "GUI_App.hpp" +#endif // ENABLE_GL_IMGUI_SHADERS #include "../Utils/MacDarkMode.hpp" + #include "nanosvg/nanosvg.h" #include "nanosvg/nanosvgrast.h" @@ -1442,12 +1447,30 @@ void ImGuiWrapper::init_style() void ImGuiWrapper::render_draw_data(ImDrawData *draw_data) { + if (draw_data == nullptr || draw_data->CmdListsCount == 0) + return; + +#if ENABLE_GL_IMGUI_SHADERS + GLShaderProgram* shader = wxGetApp().get_shader("imgui"); + if (shader == nullptr) + return; +#endif // ENABLE_GL_IMGUI_SHADERS + // Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates) ImGuiIO& io = ImGui::GetIO(); const int fb_width = (int)(draw_data->DisplaySize.x * io.DisplayFramebufferScale.x); const int fb_height = (int)(draw_data->DisplaySize.y * io.DisplayFramebufferScale.y); if (fb_width == 0 || fb_height == 0) return; + +#if ENABLE_GL_IMGUI_SHADERS + GLShaderProgram* curr_shader = wxGetApp().get_current_shader(); + if (curr_shader != nullptr) + curr_shader->stop_using(); + + shader->start_using(); +#endif // ENABLE_GL_IMGUI_SHADERS + draw_data->ScaleClipRects(io.DisplayFramebufferScale); // We are using the OpenGL fixed pipeline to make the example code simpler to read! @@ -1464,17 +1487,37 @@ void ImGuiWrapper::render_draw_data(ImDrawData *draw_data) glsafe(::glDisable(GL_LIGHTING)); glsafe(::glDisable(GL_COLOR_MATERIAL)); glsafe(::glEnable(GL_SCISSOR_TEST)); +#if !ENABLE_GL_IMGUI_SHADERS glsafe(::glEnableClientState(GL_VERTEX_ARRAY)); glsafe(::glEnableClientState(GL_TEXTURE_COORD_ARRAY)); glsafe(::glEnableClientState(GL_COLOR_ARRAY)); +#endif // !ENABLE_GL_IMGUI_SHADERS glsafe(::glEnable(GL_TEXTURE_2D)); glsafe(::glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)); glsafe(::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)); GLint texture_env_mode = GL_MODULATE; glsafe(::glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &texture_env_mode)); glsafe(::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)); - //glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound +#if ENABLE_GL_IMGUI_SHADERS + // Setup viewport, orthographic projection matrix + // Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps. + glsafe(::glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height)); + const float L = draw_data->DisplayPos.x; + const float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x; + const float T = draw_data->DisplayPos.y; + const float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y; + + Matrix4f ortho_projection; + ortho_projection << + 2.0f / (R - L), 0.0f, 0.0f, (R + L) / (L - R), + 0.0f, 2.0f / (T - B), 0.0f, (T + B) / (B - T), + 0.0f, 0.0f, -1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f; + + shader->set_uniform("Texture", 0); + shader->set_uniform("ProjMtx", ortho_projection); +#else // Setup viewport, orthographic projection matrix // Our visible imgui space lies from draw_data->DisplayPps (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps. glsafe(::glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height)); @@ -1485,16 +1528,57 @@ void ImGuiWrapper::render_draw_data(ImDrawData *draw_data) glsafe(::glMatrixMode(GL_MODELVIEW)); glsafe(::glPushMatrix()); glsafe(::glLoadIdentity()); +#endif // ENABLE_GL_IMGUI_SHADERS + +#if ENABLE_GL_IMGUI_SHADERS + // Will project scissor/clipping rectangles into framebuffer space + const ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports + const ImVec2 clip_scale = draw_data->FramebufferScale; // (1,1) unless using retina display which are often (2,2) +#else + const ImVec2 pos = draw_data->DisplayPos; +#endif // ENABLE_GL_IMGUI_SHADERS // Render command lists - ImVec2 pos = draw_data->DisplayPos; for (int n = 0; n < draw_data->CmdListsCount; ++n) { const ImDrawList* cmd_list = draw_data->CmdLists[n]; const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data; const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data; +#if ENABLE_GL_IMGUI_SHADERS + const GLsizeiptr vtx_buffer_size = (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert); + const GLsizeiptr idx_buffer_size = (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx); + + GLuint vbo_id; + glsafe(::glGenBuffers(1, &vbo_id)); + glsafe(::glBindBuffer(GL_ARRAY_BUFFER, vbo_id)); + glsafe(::glBufferData(GL_ARRAY_BUFFER, vtx_buffer_size, nullptr, GL_STREAM_DRAW)); + glsafe(::glBufferSubData(GL_ARRAY_BUFFER, 0, vtx_buffer_size, (const GLvoid*)cmd_list->VtxBuffer.Data)); + + GLuint ibo_id; + glsafe(::glGenBuffers(1, &ibo_id)); + glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id)); + glsafe(::glBufferData(GL_ELEMENT_ARRAY_BUFFER, idx_buffer_size, nullptr, GL_STREAM_DRAW)); + glsafe(::glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, idx_buffer_size, (const GLvoid*)cmd_list->IdxBuffer.Data)); + + const int position_id = shader->get_attrib_location("Position"); + if (position_id != -1) { + glVertexAttribPointer(position_id, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, pos)); + glEnableVertexAttribArray(position_id); + } + const int uv_id = shader->get_attrib_location("UV"); + if (uv_id != -1) { + glVertexAttribPointer(uv_id, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, uv)); + glEnableVertexAttribArray(uv_id); + } + const int color_id = shader->get_attrib_location("Color"); + if (color_id != -1) { + glVertexAttribPointer(color_id, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, col)); + glEnableVertexAttribArray(color_id); + } +#else glsafe(::glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, pos)))); glsafe(::glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, uv)))); glsafe(::glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, col)))); +#endif // ENABLE_GL_IMGUI_SHADERS for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; ++cmd_i) { const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i]; @@ -1502,34 +1586,73 @@ void ImGuiWrapper::render_draw_data(ImDrawData *draw_data) // User callback (registered via ImDrawList::AddCallback) pcmd->UserCallback(cmd_list, pcmd); else { - ImVec4 clip_rect = ImVec4(pcmd->ClipRect.x - pos.x, pcmd->ClipRect.y - pos.y, pcmd->ClipRect.z - pos.x, pcmd->ClipRect.w - pos.y); +#if ENABLE_GL_IMGUI_SHADERS + // Project scissor/clipping rectangles into framebuffer space + const ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y); + const ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y); + if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y) + continue; + + // Apply scissor/clipping rectangle (Y is inverted in OpenGL) + glScissor((int)clip_min.x, (int)(fb_height - clip_max.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y)); + + // Bind texture, Draw + glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->GetTexID())); + glsafe(::glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)))); +#else + const ImVec4 clip_rect = ImVec4(pcmd->ClipRect.x - pos.x, pcmd->ClipRect.y - pos.y, pcmd->ClipRect.z - pos.x, pcmd->ClipRect.w - pos.y); if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f) { // Apply scissor/clipping rectangle glsafe(::glScissor((int)clip_rect.x, (int)(fb_height - clip_rect.w), (int)(clip_rect.z - clip_rect.x), (int)(clip_rect.w - clip_rect.y))); // Bind texture, Draw - glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId)); - glsafe(::glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer)); + glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->GetTexID())); + glsafe(::glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)))); } +#endif // ENABLE_GL_IMGUI_SHADERS } idx_buffer += pcmd->ElemCount; } + +#if ENABLE_GL_IMGUI_SHADERS + if (position_id != -1) + glDisableVertexAttribArray(position_id); + if (uv_id != -1) + glDisableVertexAttribArray(uv_id); + if (color_id != -1) + glDisableVertexAttribArray(color_id); + + glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); + glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0)); + + glsafe(::glDeleteBuffers(1, &ibo_id)); + glsafe(::glDeleteBuffers(1, &vbo_id)); +#endif // ENABLE_GL_IMGUI_SHADERS } // Restore modified state glsafe(::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, texture_env_mode)); +#if !ENABLE_GL_IMGUI_SHADERS glsafe(::glDisableClientState(GL_COLOR_ARRAY)); glsafe(::glDisableClientState(GL_TEXTURE_COORD_ARRAY)); glsafe(::glDisableClientState(GL_VERTEX_ARRAY)); +#endif // !ENABLE_GL_IMGUI_SHADERS glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)last_texture)); +#if !ENABLE_GL_IMGUI_SHADERS glsafe(::glMatrixMode(GL_MODELVIEW)); glsafe(::glPopMatrix()); glsafe(::glMatrixMode(GL_PROJECTION)); glsafe(::glPopMatrix()); +#endif // !ENABLE_GL_IMGUI_SHADERS glsafe(::glPopAttrib()); glsafe(::glPolygonMode(GL_FRONT, (GLenum)last_polygon_mode[0]); glPolygonMode(GL_BACK, (GLenum)last_polygon_mode[1])); glsafe(::glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3])); glsafe(::glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3])); + +#if ENABLE_GL_IMGUI_SHADERS + if (curr_shader != nullptr) + curr_shader->start_using(); +#endif // ENABLE_GL_IMGUI_SHADERS } bool ImGuiWrapper::display_initialized() const From 5586fd92f2c32a7bb71a31fb5b6a31d540d32e20 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Mon, 14 Mar 2022 09:50:25 +0100 Subject: [PATCH 13/40] Follow-up of d0d89a4d5bc02a87f417a2f2c73f5f91db0da5d6 - Fixed warnings --- src/slic3r/GUI/ImGuiWrapper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index 819d6141e0..622f3b3907 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -1551,13 +1551,13 @@ void ImGuiWrapper::render_draw_data(ImDrawData *draw_data) glsafe(::glGenBuffers(1, &vbo_id)); glsafe(::glBindBuffer(GL_ARRAY_BUFFER, vbo_id)); glsafe(::glBufferData(GL_ARRAY_BUFFER, vtx_buffer_size, nullptr, GL_STREAM_DRAW)); - glsafe(::glBufferSubData(GL_ARRAY_BUFFER, 0, vtx_buffer_size, (const GLvoid*)cmd_list->VtxBuffer.Data)); + glsafe(::glBufferSubData(GL_ARRAY_BUFFER, 0, vtx_buffer_size, (const GLvoid*)vtx_buffer)); GLuint ibo_id; glsafe(::glGenBuffers(1, &ibo_id)); glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id)); glsafe(::glBufferData(GL_ELEMENT_ARRAY_BUFFER, idx_buffer_size, nullptr, GL_STREAM_DRAW)); - glsafe(::glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, idx_buffer_size, (const GLvoid*)cmd_list->IdxBuffer.Data)); + glsafe(::glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, idx_buffer_size, (const GLvoid*)idx_buffer)); const int position_id = shader->get_attrib_location("Position"); if (position_id != -1) { From 4eee0d05f3367c9b05f195ec2e4e4ada41ba5b94 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Mon, 14 Mar 2022 09:50:42 +0100 Subject: [PATCH 14/40] Tech ENABLE_GL_SHADERS_ATTRIBUTES - Use shader's vertex attributes and matrices in GLMmSegmentationGizmo3DScene --- .../GUI/Gizmos/GLGizmoMmuSegmentation.cpp | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp index 13c8a71c62..49eb8cb95b 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp @@ -600,11 +600,17 @@ void TriangleSelectorMmGui::render(ImGuiWrapper *imgui) return; #if ENABLE_GL_SHADERS_ATTRIBUTES assert(shader->get_name() == "mm_gouraud_attr"); + + const Camera& camera = wxGetApp().plater()->get_camera(); + const Transform3d view_model_matrix = camera.get_view_matrix() * matrix; + shader->set_uniform("view_model_matrix", view_model_matrix); + shader->set_uniform("projection_matrix", camera.get_projection_matrix()); + shader->set_uniform("normal_matrix", (Matrix3d)view_model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose()); #else assert(shader->get_name() == "mm_gouraud"); #endif // ENABLE_GL_SHADERS_ATTRIBUTES - for (size_t color_idx = 0; color_idx < m_gizmo_scene.triangle_indices.size(); ++color_idx) + for (size_t color_idx = 0; color_idx < m_gizmo_scene.triangle_indices.size(); ++color_idx) { if (m_gizmo_scene.has_VBOs(color_idx)) { if (color_idx > m_colors.size()) // Seed fill VBO shader->set_uniform("uniform_color", TriangleSelectorGUI::get_seed_fill_color(color_idx == (m_colors.size() + 1) ? m_default_volume_color : m_colors[color_idx - (m_colors.size() + 1) - 1])); @@ -613,6 +619,7 @@ void TriangleSelectorMmGui::render(ImGuiWrapper *imgui) m_gizmo_scene.render(color_idx); } + } #if ENABLE_LEGACY_OPENGL_REMOVAL #if ENABLE_GL_SHADERS_ATTRIBUTES @@ -724,19 +731,41 @@ void GLMmSegmentationGizmo3DScene::render(size_t triangle_indices_idx) const assert(this->vertices_VBO_id != 0); assert(this->triangle_indices_VBO_ids[triangle_indices_idx] != 0); - glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->vertices_VBO_id)); - glsafe(::glVertexPointer(3, GL_FLOAT, 3 * sizeof(float), (const void*)(0 * sizeof(float)))); +#if ENABLE_GL_SHADERS_ATTRIBUTES + GLShaderProgram* shader = wxGetApp().get_current_shader(); + if (shader == nullptr) + return; +#endif // ENABLE_GL_SHADERS_ATTRIBUTES + glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->vertices_VBO_id)); +#if ENABLE_GL_SHADERS_ATTRIBUTES + const GLint position_id = shader->get_attrib_location("v_position"); + if (position_id != -1) { + glsafe(::glVertexAttribPointer(position_id, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (GLvoid*)0)); + glsafe(::glEnableVertexAttribArray(position_id)); + } + + // Render using the Vertex Buffer Objects. + if (this->triangle_indices_VBO_ids[triangle_indices_idx] != 0 && + this->triangle_indices_sizes[triangle_indices_idx] > 0) { +#else + glsafe(::glVertexPointer(3, GL_FLOAT, 3 * sizeof(float), (const void*)(0 * sizeof(float)))); glsafe(::glEnableClientState(GL_VERTEX_ARRAY)); // Render using the Vertex Buffer Objects. if (this->triangle_indices_sizes[triangle_indices_idx] > 0) { +#endif // ENABLE_GL_SHADERS_ATTRIBUTES glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->triangle_indices_VBO_ids[triangle_indices_idx])); glsafe(::glDrawElements(GL_TRIANGLES, GLsizei(this->triangle_indices_sizes[triangle_indices_idx]), GL_UNSIGNED_INT, nullptr)); - glsafe(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); + glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); } +#if ENABLE_GL_SHADERS_ATTRIBUTES + if (position_id != -1) + glsafe(::glDisableVertexAttribArray(position_id)); +#else glsafe(::glDisableClientState(GL_VERTEX_ARRAY)); +#endif // ENABLE_GL_SHADERS_ATTRIBUTES glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0)); } From f0bad14748f12ec758248627fd7a047c13f089e5 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Mon, 14 Mar 2022 09:59:38 +0100 Subject: [PATCH 15/40] Tech ENABLE_GL_SHADERS_ATTRIBUTES - Small refactoring into GCodeViewer::render_toolpaths() --- src/slic3r/GUI/GCodeViewer.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index cb54376357..d174f781c6 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -3194,15 +3194,13 @@ void GCodeViewer::render_toolpaths() shader->start_using(); #if ENABLE_GL_SHADERS_ATTRIBUTES - int position_id = -1; - int normal_id = -1; const Transform3d& view_matrix = camera.get_view_matrix(); shader->set_uniform("view_model_matrix", view_matrix); shader->set_uniform("projection_matrix", camera.get_projection_matrix()); shader->set_uniform("normal_matrix", (Matrix3d)view_matrix.matrix().block(0, 0, 3, 3).inverse().transpose()); - position_id = shader->get_attrib_location("v_position"); - normal_id = shader->get_attrib_location("v_normal"); + const int position_id = shader->get_attrib_location("v_position"); + const int normal_id = shader->get_attrib_location("v_normal"); #endif // ENABLE_GL_SHADERS_ATTRIBUTES if (buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::InstancedModel) { @@ -3319,16 +3317,14 @@ void GCodeViewer::render_toolpaths() shader->start_using(); #if ENABLE_GL_SHADERS_ATTRIBUTES - int position_id = -1; - int normal_id = -1; const Camera& camera = wxGetApp().plater()->get_camera(); const Transform3d& view_matrix = camera.get_view_matrix(); shader->set_uniform("view_model_matrix", view_matrix); shader->set_uniform("projection_matrix", camera.get_projection_matrix()); shader->set_uniform("normal_matrix", (Matrix3d)view_matrix.matrix().block(0, 0, 3, 3).inverse().transpose()); - position_id = shader->get_attrib_location("v_position"); - normal_id = shader->get_attrib_location("v_normal"); + const int position_id = shader->get_attrib_location("v_position"); + const int normal_id = shader->get_attrib_location("v_normal"); #endif // ENABLE_GL_SHADERS_ATTRIBUTES glsafe(::glBindBuffer(GL_ARRAY_BUFFER, cap.vbo)); From 2ab8469cb64bc7f8c37d5f7f583275510c68116b Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Mon, 14 Mar 2022 13:34:08 +0100 Subject: [PATCH 16/40] Refactoring in ImGuiWrapper::render_draw_data() --- src/slic3r/GUI/ImGuiWrapper.cpp | 46 ++++++++++++++------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index 622f3b3907..613b168415 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -1458,7 +1458,7 @@ void ImGuiWrapper::render_draw_data(ImDrawData *draw_data) // Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates) ImGuiIO& io = ImGui::GetIO(); - const int fb_width = (int)(draw_data->DisplaySize.x * io.DisplayFramebufferScale.x); + const int fb_width = (int)(draw_data->DisplaySize.x * io.DisplayFramebufferScale.x); const int fb_height = (int)(draw_data->DisplaySize.y * io.DisplayFramebufferScale.y); if (fb_width == 0 || fb_height == 0) return; @@ -1469,9 +1469,9 @@ void ImGuiWrapper::render_draw_data(ImDrawData *draw_data) curr_shader->stop_using(); shader->start_using(); -#endif // ENABLE_GL_IMGUI_SHADERS - +#else draw_data->ScaleClipRects(io.DisplayFramebufferScale); +#endif // ENABLE_GL_IMGUI_SHADERS // We are using the OpenGL fixed pipeline to make the example code simpler to read! // Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers, polygon fill. @@ -1479,15 +1479,16 @@ void ImGuiWrapper::render_draw_data(ImDrawData *draw_data) GLint last_polygon_mode[2]; glsafe(::glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode)); GLint last_viewport[4]; glsafe(::glGetIntegerv(GL_VIEWPORT, last_viewport)); GLint last_scissor_box[4]; glsafe(::glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box)); + GLint last_texture_env_mode; glsafe(::glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &last_texture_env_mode)); glsafe(::glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TRANSFORM_BIT)); glsafe(::glEnable(GL_BLEND)); glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); glsafe(::glDisable(GL_CULL_FACE)); glsafe(::glDisable(GL_DEPTH_TEST)); - glsafe(::glDisable(GL_LIGHTING)); - glsafe(::glDisable(GL_COLOR_MATERIAL)); glsafe(::glEnable(GL_SCISSOR_TEST)); #if !ENABLE_GL_IMGUI_SHADERS + glsafe(::glDisable(GL_LIGHTING)); + glsafe(::glDisable(GL_COLOR_MATERIAL)); glsafe(::glEnableClientState(GL_VERTEX_ARRAY)); glsafe(::glEnableClientState(GL_TEXTURE_COORD_ARRAY)); glsafe(::glEnableClientState(GL_COLOR_ARRAY)); @@ -1495,9 +1496,6 @@ void ImGuiWrapper::render_draw_data(ImDrawData *draw_data) glsafe(::glEnable(GL_TEXTURE_2D)); glsafe(::glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)); glsafe(::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)); - GLint texture_env_mode = GL_MODULATE; - glsafe(::glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &texture_env_mode)); - glsafe(::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)); #if ENABLE_GL_IMGUI_SHADERS // Setup viewport, orthographic projection matrix @@ -1550,29 +1548,27 @@ void ImGuiWrapper::render_draw_data(ImDrawData *draw_data) GLuint vbo_id; glsafe(::glGenBuffers(1, &vbo_id)); glsafe(::glBindBuffer(GL_ARRAY_BUFFER, vbo_id)); - glsafe(::glBufferData(GL_ARRAY_BUFFER, vtx_buffer_size, nullptr, GL_STREAM_DRAW)); - glsafe(::glBufferSubData(GL_ARRAY_BUFFER, 0, vtx_buffer_size, (const GLvoid*)vtx_buffer)); + glsafe(::glBufferData(GL_ARRAY_BUFFER, vtx_buffer_size, vtx_buffer, GL_STATIC_DRAW)); GLuint ibo_id; glsafe(::glGenBuffers(1, &ibo_id)); glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id)); - glsafe(::glBufferData(GL_ELEMENT_ARRAY_BUFFER, idx_buffer_size, nullptr, GL_STREAM_DRAW)); - glsafe(::glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, idx_buffer_size, (const GLvoid*)idx_buffer)); + glsafe(::glBufferData(GL_ELEMENT_ARRAY_BUFFER, idx_buffer_size, idx_buffer, GL_STATIC_DRAW)); const int position_id = shader->get_attrib_location("Position"); if (position_id != -1) { - glVertexAttribPointer(position_id, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, pos)); - glEnableVertexAttribArray(position_id); + glsafe(::glVertexAttribPointer(position_id, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, pos))); + glsafe(::glEnableVertexAttribArray(position_id)); } const int uv_id = shader->get_attrib_location("UV"); if (uv_id != -1) { - glVertexAttribPointer(uv_id, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, uv)); - glEnableVertexAttribArray(uv_id); + glsafe(::glVertexAttribPointer(uv_id, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, uv))); + glsafe(::glEnableVertexAttribArray(uv_id)); } const int color_id = shader->get_attrib_location("Color"); if (color_id != -1) { - glVertexAttribPointer(color_id, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, col)); - glEnableVertexAttribArray(color_id); + glsafe(::glVertexAttribPointer(color_id, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, col))); + glsafe(::glEnableVertexAttribArray(color_id)); } #else glsafe(::glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, pos)))); @@ -1594,7 +1590,7 @@ void ImGuiWrapper::render_draw_data(ImDrawData *draw_data) continue; // Apply scissor/clipping rectangle (Y is inverted in OpenGL) - glScissor((int)clip_min.x, (int)(fb_height - clip_max.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y)); + glsafe(::glScissor((int)clip_min.x, (int)(fb_height - clip_max.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y))); // Bind texture, Draw glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->GetTexID())); @@ -1616,11 +1612,11 @@ void ImGuiWrapper::render_draw_data(ImDrawData *draw_data) #if ENABLE_GL_IMGUI_SHADERS if (position_id != -1) - glDisableVertexAttribArray(position_id); + glsafe(::glDisableVertexAttribArray(position_id)); if (uv_id != -1) - glDisableVertexAttribArray(uv_id); + glsafe(::glDisableVertexAttribArray(uv_id)); if (color_id != -1) - glDisableVertexAttribArray(color_id); + glsafe(::glDisableVertexAttribArray(color_id)); glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0)); @@ -1631,14 +1627,12 @@ void ImGuiWrapper::render_draw_data(ImDrawData *draw_data) } // Restore modified state - glsafe(::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, texture_env_mode)); + glsafe(::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, last_texture_env_mode)); + glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)last_texture)); #if !ENABLE_GL_IMGUI_SHADERS glsafe(::glDisableClientState(GL_COLOR_ARRAY)); glsafe(::glDisableClientState(GL_TEXTURE_COORD_ARRAY)); glsafe(::glDisableClientState(GL_VERTEX_ARRAY)); -#endif // !ENABLE_GL_IMGUI_SHADERS - glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)last_texture)); -#if !ENABLE_GL_IMGUI_SHADERS glsafe(::glMatrixMode(GL_MODELVIEW)); glsafe(::glPopMatrix()); glsafe(::glMatrixMode(GL_PROJECTION)); From 9174fc487211d3434e2029a8136cda0b3b091591 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Mon, 14 Mar 2022 14:25:09 +0100 Subject: [PATCH 17/40] Removed obsolete tech ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS --- src/libslic3r/Technologies.hpp | 2 -- src/slic3r/GUI/GCodeViewer.cpp | 8 -------- 2 files changed, 10 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index b90769541c..5a1e2dc7d3 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -34,8 +34,6 @@ #define ENABLE_ENVIRONMENT_MAP 0 // Enable smoothing of objects normals #define ENABLE_SMOOTH_NORMALS 0 -// Enable rendering markers for options in preview as fixed screen size points -#define ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS 1 //================ diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index d174f781c6..fcff51d37d 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -2968,11 +2968,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool void GCodeViewer::render_toolpaths() { -#if ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS - const float point_size = 20.0f; -#else const float point_size = 0.8f; -#endif // ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS #if !ENABLE_GL_SHADERS_ATTRIBUTES const std::array light_intensity = { 0.25f, 0.70f, 0.75f, 0.75f }; #endif // !ENABLE_GL_SHADERS_ATTRIBUTES @@ -2983,11 +2979,7 @@ void GCodeViewer::render_toolpaths() static_cast(viewport[3]) * 0.0005; auto shader_init_as_points = [zoom, point_size, near_plane_height](GLShaderProgram& shader) { -#if ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS - shader.set_uniform("use_fixed_screen_size", 1); -#else shader.set_uniform("use_fixed_screen_size", 0); -#endif // ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS shader.set_uniform("zoom", zoom); shader.set_uniform("percent_outline_radius", 0.0f); shader.set_uniform("percent_center_radius", 0.33f); From 033bee64311d7645a581020dde77b028aac9dbc2 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Mon, 14 Mar 2022 14:55:25 +0100 Subject: [PATCH 18/40] Removed obsolete code from GCodeViewer --- src/slic3r/GUI/GCodeViewer.cpp | 75 +++------------------------------- src/slic3r/GUI/GCodeViewer.hpp | 7 ---- 2 files changed, 6 insertions(+), 76 deletions(-) diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index fcff51d37d..84175e8033 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -1310,18 +1310,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) log_memory_used(label, vertices_size + indices_size); }; - // format data into the buffers to be rendered as points - auto add_vertices_as_point = [](const GCodeProcessorResult::MoveVertex& curr, VertexBuffer& vertices) { - vertices.push_back(curr.position.x()); - vertices.push_back(curr.position.y()); - vertices.push_back(curr.position.z()); - }; - auto add_indices_as_point = [](const GCodeProcessorResult::MoveVertex& curr, TBuffer& buffer, - unsigned int ibuffer_id, IndexBuffer& indices, size_t move_id) { - buffer.add_path(curr, ibuffer_id, indices.size(), move_id); - indices.push_back(static_cast(indices.size())); - }; - // format data into the buffers to be rendered as lines auto add_vertices_as_line = [](const GCodeProcessorResult::MoveVertex& prev, const GCodeProcessorResult::MoveVertex& curr, VertexBuffer& vertices) { #if !ENABLE_GL_SHADERS_ATTRIBUTES @@ -1816,7 +1804,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) switch (t_buffer.render_primitive_type) { - case TBuffer::ERenderPrimitiveType::Point: { add_vertices_as_point(curr, v_buffer); break; } case TBuffer::ERenderPrimitiveType::Line: { add_vertices_as_line(prev, curr, v_buffer); break; } #if ENABLE_VOLUMETRIC_RATE_TOOLPATHS_RECALC case TBuffer::ERenderPrimitiveType::Triangle: { add_vertices_as_solid(prev, curr, t_buffer, static_cast(v_multibuffer.size()) - 1, v_buffer, move_id, account_for_volumetric_rate); break; } @@ -2152,8 +2139,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) if (i_multibuffer.back().size() * sizeof(IBufferType) >= IBUFFER_THRESHOLD_BYTES - indiced_size_to_add) { i_multibuffer.push_back(IndexBuffer()); vbo_index_list.push_back(t_buffer.vertices.vbos[curr_vertex_buffer.first]); - if (t_buffer.render_primitive_type != TBuffer::ERenderPrimitiveType::Point && - t_buffer.render_primitive_type != TBuffer::ERenderPrimitiveType::BatchedModel) { + if (t_buffer.render_primitive_type != TBuffer::ERenderPrimitiveType::BatchedModel) { Path& last_path = t_buffer.paths.back(); last_path.add_sub_path(prev, static_cast(i_multibuffer.size()) - 1, 0, move_id - 1); } @@ -2169,8 +2155,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) curr_vertex_buffer.second = 0; vbo_index_list.push_back(t_buffer.vertices.vbos[curr_vertex_buffer.first]); - if (t_buffer.render_primitive_type != TBuffer::ERenderPrimitiveType::Point && - t_buffer.render_primitive_type != TBuffer::ERenderPrimitiveType::BatchedModel) { + if (t_buffer.render_primitive_type != TBuffer::ERenderPrimitiveType::BatchedModel) { Path& last_path = t_buffer.paths.back(); last_path.add_sub_path(prev, static_cast(i_multibuffer.size()) - 1, 0, move_id - 1); } @@ -2180,11 +2165,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) switch (t_buffer.render_primitive_type) { - case TBuffer::ERenderPrimitiveType::Point: { - add_indices_as_point(curr, t_buffer, static_cast(i_multibuffer.size()) - 1, i_buffer, move_id); - curr_vertex_buffer.second += t_buffer.max_vertices_per_segment(); - break; - } case TBuffer::ERenderPrimitiveType::Line: { #if ENABLE_VOLUMETRIC_RATE_TOOLPATHS_RECALC add_indices_as_line(prev, curr, t_buffer, static_cast(i_multibuffer.size()) - 1, i_buffer, move_id, account_for_volumetric_rate); @@ -2732,10 +2712,6 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool unsigned int size_in_indices = 0; switch (buffer.render_primitive_type) { - case TBuffer::ERenderPrimitiveType::Point: { - size_in_indices = buffer.indices_per_segment(); - break; - } case TBuffer::ERenderPrimitiveType::Line: case TBuffer::ERenderPrimitiveType::Triangle: { unsigned int segments_count = std::min(m_sequential_view.current.last, sub_path.last.s_id) - std::max(m_sequential_view.current.first, sub_path.first.s_id); @@ -2978,39 +2954,6 @@ void GCodeViewer::render_toolpaths() const float near_plane_height = camera.get_type() == Camera::EType::Perspective ? static_cast(viewport[3]) / (2.0f * static_cast(2.0 * std::tan(0.5 * Geometry::deg2rad(camera.get_fov())))) : static_cast(viewport[3]) * 0.0005; - auto shader_init_as_points = [zoom, point_size, near_plane_height](GLShaderProgram& shader) { - shader.set_uniform("use_fixed_screen_size", 0); - shader.set_uniform("zoom", zoom); - shader.set_uniform("percent_outline_radius", 0.0f); - shader.set_uniform("percent_center_radius", 0.33f); - shader.set_uniform("point_size", point_size); - shader.set_uniform("near_plane_height", near_plane_height); - }; - - auto render_as_points = [ -#if ENABLE_GCODE_VIEWER_STATISTICS - this -#endif // ENABLE_GCODE_VIEWER_STATISTICS - ](std::vector::iterator it_path, std::vector::iterator it_end, GLShaderProgram& shader, int uniform_color) { - glsafe(::glEnable(GL_VERTEX_PROGRAM_POINT_SIZE)); - glsafe(::glEnable(GL_POINT_SPRITE)); - - for (auto it = it_path; it != it_end && it_path->ibuffer_id == it->ibuffer_id; ++it) { - const RenderPath& path = *it; - // Some OpenGL drivers crash on empty glMultiDrawElements, see GH #7415. - assert(! path.sizes.empty()); - assert(! path.offsets.empty()); - shader.set_uniform(uniform_color, path.color); - glsafe(::glMultiDrawElements(GL_POINTS, (const GLsizei*)path.sizes.data(), GL_UNSIGNED_SHORT, (const void* const*)path.offsets.data(), (GLsizei)path.sizes.size())); -#if ENABLE_GCODE_VIEWER_STATISTICS - ++m_statistics.gl_multi_points_calls_count; -#endif // ENABLE_GCODE_VIEWER_STATISTICS - } - - glsafe(::glDisable(GL_POINT_SPRITE)); - glsafe(::glDisable(GL_VERTEX_PROGRAM_POINT_SIZE)); - }; - #if !ENABLE_GL_SHADERS_ATTRIBUTES auto shader_init_as_lines = [light_intensity](GLShaderProgram &shader) { shader.set_uniform("light_intensity", light_intensity); @@ -3190,9 +3133,6 @@ void GCodeViewer::render_toolpaths() shader->set_uniform("view_model_matrix", view_matrix); shader->set_uniform("projection_matrix", camera.get_projection_matrix()); shader->set_uniform("normal_matrix", (Matrix3d)view_matrix.matrix().block(0, 0, 3, 3).inverse().transpose()); - - const int position_id = shader->get_attrib_location("v_position"); - const int normal_id = shader->get_attrib_location("v_normal"); #endif // ENABLE_GL_SHADERS_ATTRIBUTES if (buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::InstancedModel) { @@ -3203,6 +3143,8 @@ void GCodeViewer::render_toolpaths() else if (buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::BatchedModel) { shader->set_uniform("emission_factor", 0.25f); #if ENABLE_GL_SHADERS_ATTRIBUTES + const int position_id = shader->get_attrib_location("v_position"); + const int normal_id = shader->get_attrib_location("v_normal"); render_as_batched_model(buffer, *shader, position_id, normal_id); #else render_as_batched_model(buffer, *shader); @@ -3211,8 +3153,8 @@ void GCodeViewer::render_toolpaths() } else { #if ENABLE_GL_SHADERS_ATTRIBUTES - if (buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::Point) - shader_init_as_points(*shader); + const int position_id = shader->get_attrib_location("v_position"); + const int normal_id = shader->get_attrib_location("v_normal"); #else switch (buffer.render_primitive_type) { case TBuffer::ERenderPrimitiveType::Point: shader_init_as_points(*shader); break; @@ -3259,10 +3201,6 @@ void GCodeViewer::render_toolpaths() // Render all elements with it_path->ibuffer_id == ibuffer_id, possible with varying colors. switch (buffer.render_primitive_type) { - case TBuffer::ERenderPrimitiveType::Point: { - render_as_points(it_path, buffer.render_paths.end(), *shader, uniform_color); - break; - } case TBuffer::ERenderPrimitiveType::Line: { glsafe(::glLineWidth(static_cast(line_width(zoom)))); render_as_lines(it_path, buffer.render_paths.end(), *shader, uniform_color); @@ -4670,7 +4608,6 @@ void GCodeViewer::render_statistics() } if (ImGui::CollapsingHeader("OpenGL calls")) { - add_counter(std::string("Multi GL_POINTS:"), m_statistics.gl_multi_points_calls_count); add_counter(std::string("Multi GL_LINES:"), m_statistics.gl_multi_lines_calls_count); add_counter(std::string("Multi GL_TRIANGLES:"), m_statistics.gl_multi_triangles_calls_count); add_counter(std::string("GL_TRIANGLES:"), m_statistics.gl_triangles_calls_count); diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index 438fc55fd1..e2ee6dcd0d 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -284,7 +284,6 @@ class GCodeViewer { enum class ERenderPrimitiveType : unsigned char { - Point, Line, Triangle, InstancedModel, @@ -325,7 +324,6 @@ class GCodeViewer unsigned int max_vertices_per_segment() const { switch (render_primitive_type) { - case ERenderPrimitiveType::Point: { return 1; } case ERenderPrimitiveType::Line: { return 2; } case ERenderPrimitiveType::Triangle: { return 8; } default: { return 0; } @@ -337,7 +335,6 @@ class GCodeViewer unsigned int indices_per_segment() const { switch (render_primitive_type) { - case ERenderPrimitiveType::Point: { return 1; } case ERenderPrimitiveType::Line: { return 2; } case ERenderPrimitiveType::Triangle: { return 30; } // 3 indices x 10 triangles default: { return 0; } @@ -347,7 +344,6 @@ class GCodeViewer unsigned int max_indices_per_segment() const { switch (render_primitive_type) { - case ERenderPrimitiveType::Point: { return 1; } case ERenderPrimitiveType::Line: { return 2; } case ERenderPrimitiveType::Triangle: { return 36; } // 3 indices x 12 triangles default: { return 0; } @@ -358,7 +354,6 @@ class GCodeViewer bool has_data() const { switch (render_primitive_type) { - case ERenderPrimitiveType::Point: case ERenderPrimitiveType::Line: case ERenderPrimitiveType::Triangle: { return !vertices.vbos.empty() && vertices.vbos.front() != 0 && !indices.empty() && indices.front().ibo != 0; @@ -585,7 +580,6 @@ class GCodeViewer int64_t refresh_time{ 0 }; int64_t refresh_paths_time{ 0 }; // opengl calls - int64_t gl_multi_points_calls_count{ 0 }; int64_t gl_multi_lines_calls_count{ 0 }; int64_t gl_multi_triangles_calls_count{ 0 }; int64_t gl_triangles_calls_count{ 0 }; @@ -628,7 +622,6 @@ class GCodeViewer } void reset_opengl() { - gl_multi_points_calls_count = 0; gl_multi_lines_calls_count = 0; gl_multi_triangles_calls_count = 0; gl_triangles_calls_count = 0; From 0a2001ed1c862553ff9d1229cf09be8b9bdbf8c8 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Mon, 14 Mar 2022 15:21:00 +0100 Subject: [PATCH 19/40] #8032 - GCodeProcessor - Fixed parsing of LAYER_CHANGE tag for spiral vase mode --- src/libslic3r/GCode/GCodeProcessor.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 50c0ce4a54..3bf7c4ffd3 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -1952,12 +1952,15 @@ void GCodeProcessor::process_tags(const std::string_view comment, bool producers ++m_layer_id; #if ENABLE_SPIRAL_VASE_LAYERS if (m_spiral_vase_active) { - assert(!m_result.moves.empty()); - size_t move_id = m_result.moves.size() - 1; - if (!m_result.spiral_vase_layers.empty() && m_end_position[Z] == m_result.spiral_vase_layers.back().first) - m_result.spiral_vase_layers.back().second.second = move_id; - else - m_result.spiral_vase_layers.push_back({ static_cast(m_end_position[Z]), { move_id, move_id } }); + if (m_result.moves.empty()) + m_result.spiral_vase_layers.push_back({ m_first_layer_height, { 0, 0 } }); + else { + const size_t move_id = m_result.moves.size() - 1; + if (!m_result.spiral_vase_layers.empty() && m_end_position[Z] == m_result.spiral_vase_layers.back().first) + m_result.spiral_vase_layers.back().second.second = move_id; + else + m_result.spiral_vase_layers.push_back({ static_cast(m_end_position[Z]), { move_id, move_id } }); + } } #endif // ENABLE_SPIRAL_VASE_LAYERS return; From 887ce895580686f87693dbe8a59800950a9b767e Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 15 Mar 2022 08:50:00 +0100 Subject: [PATCH 20/40] Limit width of GCodeViewer::SequentialView::GCodeWindow --- src/slic3r/GUI/GCodeViewer.cpp | 73 +++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 31 deletions(-) diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 84175e8033..2a63a30049 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -459,6 +459,7 @@ void GCodeViewer::SequentialView::GCodeWindow::render(float top, float bottom, u static const ImVec4 COMMAND_COLOR = { 0.8f, 0.8f, 0.0f, 1.0f }; static const ImVec4 PARAMETERS_COLOR = { 1.0f, 1.0f, 1.0f, 1.0f }; static const ImVec4 COMMENT_COLOR = { 0.7f, 0.7f, 0.7f, 1.0f }; + static const ImVec4 ELLIPSIS_COLOR = { 0.0f, 0.7f, 0.0f, 1.0f }; if (!m_visible || m_filename.empty() || m_lines_ends.empty() || curr_line_id == 0) return; @@ -503,6 +504,35 @@ void GCodeViewer::SequentialView::GCodeWindow::render(float top, float bottom, u ImGuiWrapper& imgui = *wxGetApp().imgui(); + auto add_item_to_line = [&imgui](const std::string& txt, const ImVec4& color, float spacing, size_t& current_length) { + static const size_t LENGTH_THRESHOLD = 60; + + if (txt.empty()) + return false; + + std::string out_text = txt; + bool reduced = false; + if (current_length + out_text.length() > LENGTH_THRESHOLD) { + out_text = out_text.substr(0, LENGTH_THRESHOLD - current_length); + reduced = true; + } + + current_length += out_text.length(); + + ImGui::SameLine(0.0f, spacing); + ImGui::PushStyleColor(ImGuiCol_Text, color); + imgui.text(out_text); + ImGui::PopStyleColor(); + if (reduced) { + ImGui::SameLine(0.0f, 0.0f); + ImGui::PushStyleColor(ImGuiCol_Text, ELLIPSIS_COLOR); + imgui.text("..."); + ImGui::PopStyleColor(); + } + + return reduced; + }; + imgui.set_next_window_pos(0.0f, top, ImGuiCond_Always, 0.0f, 0.0f); imgui.set_next_window_size(0.0f, wnd_height, ImGuiCond_Always); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); @@ -527,41 +557,22 @@ void GCodeViewer::SequentialView::GCodeWindow::render(float top, float bottom, u ImGui::GetColorU32(SELECTION_RECT_COLOR)); } - // render line number const std::string id_str = std::to_string(id); // spacer to right align text ImGui::Dummy({ id_width - ImGui::CalcTextSize(id_str.c_str()).x, text_height }); - ImGui::SameLine(0.0f, 0.0f); - ImGui::PushStyleColor(ImGuiCol_Text, LINE_NUMBER_COLOR); - imgui.text(id_str); - ImGui::PopStyleColor(); - if (!line.command.empty() || !line.comment.empty()) - ImGui::SameLine(); - - // render command - if (!line.command.empty()) { - ImGui::PushStyleColor(ImGuiCol_Text, COMMAND_COLOR); - imgui.text(line.command); - ImGui::PopStyleColor(); - } - - // render parameters - if (!line.parameters.empty()) { - ImGui::SameLine(0.0f, 0.0f); - ImGui::PushStyleColor(ImGuiCol_Text, PARAMETERS_COLOR); - imgui.text(line.parameters); - ImGui::PopStyleColor(); - } - - // render comment - if (!line.comment.empty()) { - if (!line.command.empty()) - ImGui::SameLine(0.0f, 0.0f); - ImGui::PushStyleColor(ImGuiCol_Text, COMMENT_COLOR); - imgui.text(line.comment); - ImGui::PopStyleColor(); - } + size_t line_length = 0; + // render line number + bool stop_adding = add_item_to_line(id_str, LINE_NUMBER_COLOR, 0.0f, line_length); + if (!stop_adding && !line.command.empty()) + // render command + stop_adding = add_item_to_line(line.command, COMMAND_COLOR, -1.0f, line_length); + if (!stop_adding && !line.parameters.empty()) + // render parameters + stop_adding = add_item_to_line(line.parameters, PARAMETERS_COLOR, 0.0f, line_length); + if (!stop_adding && !line.comment.empty()) + // render comment + stop_adding = add_item_to_line(line.comment, COMMENT_COLOR, line.command.empty() ? -1.0f : 0.0f, line_length); } imgui.end(); From 58701b237d233f2b0517106c7ce3a4f10db55873 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 15 Mar 2022 09:05:16 +0100 Subject: [PATCH 21/40] Tech ENABLE_GL_SHADERS_ATTRIBUTES - Fixed rendering of bed texture in thumbnails --- src/slic3r/GUI/3DBed.cpp | 15 +++++++++++---- src/slic3r/GUI/3DBed.hpp | 8 +++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index 177c508ad3..f3176d2c73 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -515,7 +515,7 @@ void Bed3D::render_system(GLCanvas3D& canvas, const Transform3d& view_matrix, co render_model(view_matrix, projection_matrix); if (show_texture) - render_texture(bottom, canvas); + render_texture(bottom, canvas, view_matrix, projection_matrix); } #else void Bed3D::render_system(GLCanvas3D& canvas, bool bottom, bool show_texture) @@ -528,7 +528,11 @@ void Bed3D::render_system(GLCanvas3D& canvas, bool bottom, bool show_texture) } #endif // ENABLE_GL_SHADERS_ATTRIBUTES +#if ENABLE_GL_SHADERS_ATTRIBUTES +void Bed3D::render_texture(bool bottom, GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix) +#else void Bed3D::render_texture(bool bottom, GLCanvas3D& canvas) +#endif // ENABLE_GL_SHADERS_ATTRIBUTES { if (m_texture_filename.empty()) { m_texture.reset(); @@ -600,9 +604,8 @@ void Bed3D::render_texture(bool bottom, GLCanvas3D& canvas) if (shader != nullptr) { shader->start_using(); #if ENABLE_GL_SHADERS_ATTRIBUTES - const Camera& camera = wxGetApp().plater()->get_camera(); - shader->set_uniform("view_model_matrix", camera.get_view_matrix()); - shader->set_uniform("projection_matrix", camera.get_projection_matrix()); + shader->set_uniform("view_model_matrix", view_matrix); + shader->set_uniform("projection_matrix", projection_matrix); #endif // ENABLE_GL_SHADERS_ATTRIBUTES shader->set_uniform("transparent_background", bottom); shader->set_uniform("svg_source", boost::algorithm::iends_with(m_texture.get_source(), ".svg")); @@ -766,7 +769,11 @@ void Bed3D::render_custom(GLCanvas3D& canvas, bool bottom, bool show_texture, bo #endif // ENABLE_GL_SHADERS_ATTRIBUTES if (show_texture) +#if ENABLE_GL_SHADERS_ATTRIBUTES + render_texture(bottom, canvas, view_matrix, projection_matrix); +#else render_texture(bottom, canvas); +#endif // ENABLE_GL_SHADERS_ATTRIBUTES } void Bed3D::render_default(bool bottom, bool picking) diff --git a/src/slic3r/GUI/3DBed.hpp b/src/slic3r/GUI/3DBed.hpp index de4fa99cfc..167577882a 100644 --- a/src/slic3r/GUI/3DBed.hpp +++ b/src/slic3r/GUI/3DBed.hpp @@ -168,14 +168,12 @@ private: void render_axes(); #if ENABLE_GL_SHADERS_ATTRIBUTES void render_system(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, bool show_texture); -#else - void render_system(GLCanvas3D& canvas, bool bottom, bool show_texture); -#endif // ENABLE_GL_SHADERS_ATTRIBUTES - void render_texture(bool bottom, GLCanvas3D& canvas); -#if ENABLE_GL_SHADERS_ATTRIBUTES + void render_texture(bool bottom, GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix); void render_model(const Transform3d& view_matrix, const Transform3d& projection_matrix); void render_custom(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, bool show_texture, bool picking); #else + void render_system(GLCanvas3D& canvas, bool bottom, bool show_texture); + void render_texture(bool bottom, GLCanvas3D& canvas); void render_model(); void render_custom(GLCanvas3D& canvas, bool bottom, bool show_texture, bool picking); #endif // ENABLE_GL_SHADERS_ATTRIBUTES From 568bd39c5ab3ea4ed43b8f43f14e2c746b289087 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 15 Mar 2022 09:16:06 +0100 Subject: [PATCH 22/40] Tech ENABLE_GL_SHADERS_ATTRIBUTES - Fixed rendering of default bed in thumbnails --- src/slic3r/GUI/3DBed.cpp | 37 ++++++++++++++++++++++++++++++++++--- src/slic3r/GUI/3DBed.hpp | 4 +++- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index f3176d2c73..3cbebfff8c 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -536,7 +536,11 @@ void Bed3D::render_texture(bool bottom, GLCanvas3D& canvas) { if (m_texture_filename.empty()) { m_texture.reset(); +#if ENABLE_GL_SHADERS_ATTRIBUTES + render_default(bottom, false, view_matrix, projection_matrix); +#else render_default(bottom, false); +#endif // ENABLE_GL_SHADERS_ATTRIBUTES return; } @@ -549,7 +553,11 @@ void Bed3D::render_texture(bool bottom, GLCanvas3D& canvas) if (m_temp_texture.get_id() == 0 || m_temp_texture.get_source() != m_texture_filename) { // generate a temporary lower resolution texture to show while no main texture levels have been compressed if (!m_temp_texture.load_from_svg_file(m_texture_filename, false, false, false, max_tex_size / 8)) { +#if ENABLE_GL_SHADERS_ATTRIBUTES + render_default(bottom, false, view_matrix, projection_matrix); +#else render_default(bottom, false); +#endif // ENABLE_GL_SHADERS_ATTRIBUTES return; } canvas.request_extra_frame(); @@ -557,7 +565,11 @@ void Bed3D::render_texture(bool bottom, GLCanvas3D& canvas) // starts generating the main texture, compression will run asynchronously if (!m_texture.load_from_svg_file(m_texture_filename, true, true, true, max_tex_size)) { +#if ENABLE_GL_SHADERS_ATTRIBUTES + render_default(bottom, false, view_matrix, projection_matrix); +#else render_default(bottom, false); +#endif // ENABLE_GL_SHADERS_ATTRIBUTES return; } } @@ -565,7 +577,11 @@ void Bed3D::render_texture(bool bottom, GLCanvas3D& canvas) // generate a temporary lower resolution texture to show while no main texture levels have been compressed if (m_temp_texture.get_id() == 0 || m_temp_texture.get_source() != m_texture_filename) { if (!m_temp_texture.load_from_file(m_texture_filename, false, GLTexture::None, false)) { +#if ENABLE_GL_SHADERS_ATTRIBUTES + render_default(bottom, false, view_matrix, projection_matrix); +#else render_default(bottom, false); +#endif // ENABLE_GL_SHADERS_ATTRIBUTES return; } canvas.request_extra_frame(); @@ -573,12 +589,20 @@ void Bed3D::render_texture(bool bottom, GLCanvas3D& canvas) // starts generating the main texture, compression will run asynchronously if (!m_texture.load_from_file(m_texture_filename, true, GLTexture::MultiThreaded, true)) { +#if ENABLE_GL_SHADERS_ATTRIBUTES + render_default(bottom, false, view_matrix, projection_matrix); +#else render_default(bottom, false); +#endif // ENABLE_GL_SHADERS_ATTRIBUTES return; } } else { +#if ENABLE_GL_SHADERS_ATTRIBUTES + render_default(bottom, false, view_matrix, projection_matrix); +#else render_default(bottom, false); +#endif // ENABLE_GL_SHADERS_ATTRIBUTES return; } } @@ -757,7 +781,11 @@ void Bed3D::render_custom(GLCanvas3D& canvas, bool bottom, bool show_texture, bo #endif // ENABLE_GL_SHADERS_ATTRIBUTES { if (m_texture_filename.empty() && m_model_filename.empty()) { +#if ENABLE_GL_SHADERS_ATTRIBUTES + render_default(bottom, picking, view_matrix, projection_matrix); +#else render_default(bottom, picking); +#endif // ENABLE_GL_SHADERS_ATTRIBUTES return; } @@ -776,7 +804,11 @@ void Bed3D::render_custom(GLCanvas3D& canvas, bool bottom, bool show_texture, bo #endif // ENABLE_GL_SHADERS_ATTRIBUTES } +#if ENABLE_GL_SHADERS_ATTRIBUTES +void Bed3D::render_default(bool bottom, bool picking, const Transform3d& view_matrix, const Transform3d& projection_matrix) +#else void Bed3D::render_default(bool bottom, bool picking) +#endif // ENABLE_GL_SHADERS_ATTRIBUTES { m_texture.reset(); @@ -793,9 +825,8 @@ void Bed3D::render_default(bool bottom, bool picking) shader->start_using(); #if ENABLE_GL_SHADERS_ATTRIBUTES - const Camera& camera = wxGetApp().plater()->get_camera(); - shader->set_uniform("view_model_matrix", camera.get_view_matrix()); - shader->set_uniform("projection_matrix", camera.get_projection_matrix()); + shader->set_uniform("view_model_matrix", view_matrix); + shader->set_uniform("projection_matrix", projection_matrix); #endif // ENABLE_GL_SHADERS_ATTRIBUTES glsafe(::glEnable(GL_DEPTH_TEST)); diff --git a/src/slic3r/GUI/3DBed.hpp b/src/slic3r/GUI/3DBed.hpp index 167577882a..7c334cb939 100644 --- a/src/slic3r/GUI/3DBed.hpp +++ b/src/slic3r/GUI/3DBed.hpp @@ -171,13 +171,15 @@ private: void render_texture(bool bottom, GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix); void render_model(const Transform3d& view_matrix, const Transform3d& projection_matrix); void render_custom(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, bool show_texture, bool picking); + void render_default(bool bottom, bool picking, const Transform3d& view_matrix, const Transform3d& projection_matrix); #else void render_system(GLCanvas3D& canvas, bool bottom, bool show_texture); void render_texture(bool bottom, GLCanvas3D& canvas); void render_model(); void render_custom(GLCanvas3D& canvas, bool bottom, bool show_texture, bool picking); -#endif // ENABLE_GL_SHADERS_ATTRIBUTES void render_default(bool bottom, bool picking); +#endif // ENABLE_GL_SHADERS_ATTRIBUTES + #if !ENABLE_LEGACY_OPENGL_REMOVAL void release_VBOs(); #endif // !ENABLE_LEGACY_OPENGL_REMOVAL From 9701d3b01d2d64c3e45d7357c645f8664990f6d2 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 15 Mar 2022 10:31:30 +0100 Subject: [PATCH 23/40] Follow-up of 033bee64311d7645a581020dde77b028aac9dbc2 - Fixed warnings --- src/slic3r/GUI/GCodeViewer.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 2a63a30049..d33004f494 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -2955,15 +2955,11 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool void GCodeViewer::render_toolpaths() { - const float point_size = 0.8f; #if !ENABLE_GL_SHADERS_ATTRIBUTES const std::array light_intensity = { 0.25f, 0.70f, 0.75f, 0.75f }; #endif // !ENABLE_GL_SHADERS_ATTRIBUTES const Camera& camera = wxGetApp().plater()->get_camera(); const double zoom = camera.get_zoom(); - const std::array& viewport = camera.get_viewport(); - const float near_plane_height = camera.get_type() == Camera::EType::Perspective ? static_cast(viewport[3]) / (2.0f * static_cast(2.0 * std::tan(0.5 * Geometry::deg2rad(camera.get_fov())))) : - static_cast(viewport[3]) * 0.0005; #if !ENABLE_GL_SHADERS_ATTRIBUTES auto shader_init_as_lines = [light_intensity](GLShaderProgram &shader) { @@ -3245,9 +3241,9 @@ void GCodeViewer::render_toolpaths() } #if ENABLE_GCODE_VIEWER_STATISTICS - auto render_sequential_range_cap = [this] + auto render_sequential_range_cap = [this, &camera] #else - auto render_sequential_range_cap = [] + auto render_sequential_range_cap = [&camera] #endif // ENABLE_GCODE_VIEWER_STATISTICS (const SequentialRangeCap& cap) { const TBuffer* buffer = cap.buffer; @@ -3258,7 +3254,6 @@ void GCodeViewer::render_toolpaths() shader->start_using(); #if ENABLE_GL_SHADERS_ATTRIBUTES - const Camera& camera = wxGetApp().plater()->get_camera(); const Transform3d& view_matrix = camera.get_view_matrix(); shader->set_uniform("view_model_matrix", view_matrix); shader->set_uniform("projection_matrix", camera.get_projection_matrix()); From 0c4df47bd095e571ed8609b4c8d1820e47f5c9bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Wed, 16 Mar 2022 10:57:18 +0100 Subject: [PATCH 24/40] Fixed various issues in the ported Lightning infill. Added export to SVG for TreeNode. Also was finalized integration of Lightning infill and Lightning infill was enabled. --- src/libslic3r/Fill/Fill.cpp | 6 +- src/libslic3r/Fill/FillBase.cpp | 2 - src/libslic3r/Fill/FillRectilinear.cpp | 8 +- .../Fill/Lightning/DistanceField.cpp | 67 ++++++++++++---- .../Fill/Lightning/DistanceField.hpp | 26 ++++++- src/libslic3r/Fill/Lightning/Generator.cpp | 42 +++++----- src/libslic3r/Fill/Lightning/Generator.hpp | 2 +- src/libslic3r/Fill/Lightning/Layer.cpp | 77 ++++++++++++------- src/libslic3r/Fill/Lightning/Layer.hpp | 19 +++-- src/libslic3r/Fill/Lightning/TreeNode.cpp | 50 ++++++++---- src/libslic3r/Fill/Lightning/TreeNode.hpp | 33 +++++--- src/libslic3r/Layer.hpp | 8 +- src/libslic3r/Point.hpp | 5 ++ src/libslic3r/Print.hpp | 9 ++- src/libslic3r/PrintConfig.cpp | 6 -- src/libslic3r/PrintConfig.hpp | 8 +- src/libslic3r/PrintObject.cpp | 18 ++++- 17 files changed, 265 insertions(+), 121 deletions(-) diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index a3e4aee311..e6b8201885 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -11,6 +11,7 @@ #include "FillBase.hpp" #include "FillRectilinear.hpp" +#include "FillLightning.hpp" namespace Slic3r { @@ -318,7 +319,7 @@ void export_group_fills_to_svg(const char *path, const std::vector #endif // friend to Layer -void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive::Octree* support_fill_octree) +void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive::Octree* support_fill_octree, FillLightning::Generator* lightning_generator) { for (LayerRegion *layerm : m_regions) layerm->fills.clear(); @@ -348,6 +349,9 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive: f->angle = surface_fill.params.angle; f->adapt_fill_octree = (surface_fill.params.pattern == ipSupportCubic) ? support_fill_octree : adaptive_fill_octree; + if (surface_fill.params.pattern == ipLightning) + dynamic_cast(f.get())->generator = lightning_generator; + // calculate flow spacing for infill pattern generation bool using_internal_flow = ! surface_fill.surface.is_solid() && ! surface_fill.params.bridge; double link_max_length = 0.; diff --git a/src/libslic3r/Fill/FillBase.cpp b/src/libslic3r/Fill/FillBase.cpp index 7ca0699c0f..c4f8d6f08f 100644 --- a/src/libslic3r/Fill/FillBase.cpp +++ b/src/libslic3r/Fill/FillBase.cpp @@ -46,9 +46,7 @@ Fill* Fill::new_from_type(const InfillPattern type) case ipAdaptiveCubic: return new FillAdaptive::Filler(); case ipSupportCubic: return new FillAdaptive::Filler(); case ipSupportBase: return new FillSupportBase(); -#if HAS_LIGHTNING_INFILL case ipLightning: return new FillLightning::Filler(); -#endif // HAS_LIGHTNING_INFILL default: throw Slic3r::InvalidArgument("unknown type"); } } diff --git a/src/libslic3r/Fill/FillRectilinear.cpp b/src/libslic3r/Fill/FillRectilinear.cpp index 7d868860a7..264ae8a599 100644 --- a/src/libslic3r/Fill/FillRectilinear.cpp +++ b/src/libslic3r/Fill/FillRectilinear.cpp @@ -406,13 +406,15 @@ public: // for the infill pattern, don't cut the corners. // default miterLimt = 3 //double miterLimit = 10.; - assert(aoffset1 < 0); + // FIXME: Resolve properly the cases when it is constructed with aoffset1 = 0 and aoffset2 = 0, + // that is used in sample_grid_pattern() for Lightning infill. + // assert(aoffset1 < 0); assert(aoffset2 <= 0); - assert(aoffset2 == 0 || aoffset2 < aoffset1); + // assert(aoffset2 == 0 || aoffset2 < aoffset1); // bool sticks_removed = remove_sticks(polygons_src); // if (sticks_removed) BOOST_LOG_TRIVIAL(error) << "Sticks removed!"; - polygons_outer = offset(polygons_src, float(aoffset1), ClipperLib::jtMiter, miterLimit); + polygons_outer = aoffset1 == 0 ? polygons_src : offset(polygons_src, float(aoffset1), ClipperLib::jtMiter, miterLimit); if (aoffset2 < 0) polygons_inner = shrink(polygons_outer, float(aoffset1 - aoffset2), ClipperLib::jtMiter, miterLimit); // Filter out contours with zero area or small area, contours with 2 points only. diff --git a/src/libslic3r/Fill/Lightning/DistanceField.cpp b/src/libslic3r/Fill/Lightning/DistanceField.cpp index 6df1d043ca..308ca41c60 100644 --- a/src/libslic3r/Fill/Lightning/DistanceField.cpp +++ b/src/libslic3r/Fill/Lightning/DistanceField.cpp @@ -10,27 +10,29 @@ namespace Slic3r::FillLightning constexpr coord_t radius_per_cell_size = 6; // The cell-size should be small compared to the radius, but not so small as to be inefficient. -DistanceField::DistanceField(const coord_t& radius, const Polygons& current_outline, const Polygons& current_overhang) : - m_cell_size(radius / radius_per_cell_size), - m_supporting_radius(radius) +DistanceField::DistanceField(const coord_t& radius, const Polygons& current_outline, const BoundingBox& current_outlines_bbox, const Polygons& current_overhang) : + m_cell_size(radius / radius_per_cell_size), + m_supporting_radius(radius), + m_unsupported_points_bbox(current_outlines_bbox) { - m_supporting_radius2 = double(radius) * double(radius); + m_supporting_radius2 = Slic3r::sqr(int64_t(radius)); // Sample source polygons with a regular grid sampling pattern. - for (const ExPolygon &expoly : union_ex(current_outline)) { + for (const ExPolygon &expoly : union_ex(current_overhang)) { for (const Point &p : sample_grid_pattern(expoly, m_cell_size)) { // Find a squared distance to the source expolygon boundary. double d2 = std::numeric_limits::max(); - for (size_t icontour = 0; icontour <= expoly.holes.size(); ++ icontour) { + for (size_t icontour = 0; icontour <= expoly.holes.size(); ++icontour) { const Polygon &contour = icontour == 0 ? expoly.contour : expoly.holes[icontour - 1]; if (contour.size() > 2) { Point prev = contour.points.back(); for (const Point &p2 : contour.points) { - d2 = std::min(d2, Line::distance_to_squared(p, prev, p2)); + d2 = std::min(d2, Line::distance_to_squared(p, prev, p2)); prev = p2; } } } m_unsupported_points.emplace_back(p, sqrt(d2)); + assert(m_unsupported_points_bbox.contains(p)); } } m_unsupported_points.sort([&radius](const UnsupportedCell &a, const UnsupportedCell &b) { @@ -41,8 +43,11 @@ DistanceField::DistanceField(const coord_t& radius, const Polygons& current_outl }); for (auto it = m_unsupported_points.begin(); it != m_unsupported_points.end(); ++it) { UnsupportedCell& cell = *it; - m_unsupported_points_grid.emplace(Point{ cell.loc.x() / m_cell_size, cell.loc.y() / m_cell_size }, it); + m_unsupported_points_grid.emplace(this->to_grid_point(cell.loc), it); } + // Because the distance between two points is at least one axis equal to m_cell_size, every cell + // in m_unsupported_points_grid contains exactly one point. + assert(m_unsupported_points.size() == m_unsupported_points_grid.size()); } void DistanceField::update(const Point& to_node, const Point& added_leaf) @@ -60,17 +65,24 @@ void DistanceField::update(const Point& to_node, const Point& added_leaf) grid.merge(to_node + iextent); grid.merge(added_leaf - iextent); grid.merge(added_leaf + iextent); - grid.min /= m_cell_size; - grid.max /= m_cell_size; + + // Clip grid by m_unsupported_points_bbox. Mainly to ensure that grid.min is a non-negative value. + grid.min.x() = std::max(grid.min.x(), m_unsupported_points_bbox.min.x()); + grid.min.y() = std::max(grid.min.y(), m_unsupported_points_bbox.min.y()); + grid.max.x() = std::min(grid.max.x(), m_unsupported_points_bbox.max.x()); + grid.max.y() = std::min(grid.max.y(), m_unsupported_points_bbox.max.y()); + + grid.min = this->to_grid_point(grid.min); + grid.max = this->to_grid_point(grid.max); } + Point grid_addr; Point grid_loc; - for (coord_t row = grid.min.y(); row <= grid.max.y(); ++ row) { - grid_loc.y() = row * m_cell_size; - for (coord_t col = grid.min.x(); col <= grid.max.y(); ++ col) { - grid_loc.x() = col * m_cell_size; + for (grid_addr.y() = grid.min.y(); grid_addr.y() <= grid.max.y(); ++grid_addr.y()) { + for (grid_addr.x() = grid.min.x(); grid_addr.x() <= grid.max.x(); ++grid_addr.x()) { + grid_loc = this->from_grid_point(grid_addr); // Test inside a circle at the new leaf. - if ((grid_loc - added_leaf).cast().squaredNorm() > m_supporting_radius2) { + if ((grid_loc - added_leaf).cast().squaredNorm() > m_supporting_radius2) { // Not inside a circle at the end of the new leaf. // Test inside a rotated rectangle. Vec2d vx = (grid_loc - to_node).cast(); @@ -84,10 +96,10 @@ void DistanceField::update(const Point& to_node, const Point& added_leaf) } // Inside a circle at the end of the new leaf, or inside a rotated rectangle. // Remove unsupported leafs at this grid location. - if (auto it = m_unsupported_points_grid.find(grid_loc); it != m_unsupported_points_grid.end()) { + if (auto it = m_unsupported_points_grid.find(grid_addr); it != m_unsupported_points_grid.end()) { std::list::iterator& list_it = it->second; UnsupportedCell& cell = *list_it; - if ((cell.loc - added_leaf).cast().squaredNorm() <= m_supporting_radius2) { + if ((cell.loc - added_leaf).cast().squaredNorm() <= m_supporting_radius2) { m_unsupported_points.erase(list_it); m_unsupported_points_grid.erase(it); } @@ -96,4 +108,25 @@ void DistanceField::update(const Point& to_node, const Point& added_leaf) } } +#if 0 +void DistanceField::update(const Point &to_node, const Point &added_leaf) +{ + const Point supporting_radius_point(m_supporting_radius, m_supporting_radius); + const BoundingBox grid(this->to_grid_point(added_leaf - supporting_radius_point), this->to_grid_point(added_leaf + supporting_radius_point)); + + for (coord_t grid_y = grid.min.y(); grid_y <= grid.max.y(); ++grid_y) { + for (coord_t grid_x = grid.min.x(); grid_x <= grid.max.x(); ++grid_x) { + if (auto it = m_unsupported_points_grid.find({grid_x, grid_y}); it != m_unsupported_points_grid.end()) { + std::list::iterator &list_it = it->second; + UnsupportedCell &cell = *list_it; + if ((cell.loc - added_leaf).cast().squaredNorm() <= m_supporting_radius2) { + m_unsupported_points.erase(list_it); + m_unsupported_points_grid.erase(it); + } + } + } + } +} +#endif + } // namespace Slic3r::FillLightning diff --git a/src/libslic3r/Fill/Lightning/DistanceField.hpp b/src/libslic3r/Fill/Lightning/DistanceField.hpp index 7fdce434ce..beb46c5c57 100644 --- a/src/libslic3r/Fill/Lightning/DistanceField.hpp +++ b/src/libslic3r/Fill/Lightning/DistanceField.hpp @@ -4,6 +4,7 @@ #ifndef LIGHTNING_DISTANCE_FIELD_H #define LIGHTNING_DISTANCE_FIELD_H +#include "../../BoundingBox.hpp" #include "../../Point.hpp" #include "../../Polygon.hpp" @@ -29,7 +30,7 @@ public: * \param current_overhang The overhang that needs to be supported on this * layer. */ - DistanceField(const coord_t& radius, const Polygons& current_outline, const Polygons& current_overhang); + DistanceField(const coord_t& radius, const Polygons& current_outline, const BoundingBox& current_outlines_bbox, const Polygons& current_overhang); /*! * Gets the next unsupported location to be supported by a new branch. @@ -69,14 +70,14 @@ protected: * branch of a tree. */ coord_t m_supporting_radius; - double m_supporting_radius2; + int64_t m_supporting_radius2; /*! * Represents a small discrete area of infill that needs to be supported. */ struct UnsupportedCell { - UnsupportedCell(Point loc, coord_t dist_to_boundary) : loc(loc), dist_to_boundary(dist_to_boundary) {} + UnsupportedCell(const Point &loc, coord_t dist_to_boundary) : loc(loc), dist_to_boundary(dist_to_boundary) {} // The position of the center of this cell. Point loc; // How far this cell is removed from the ``current_outline`` polygon, the edge of the infill area. @@ -88,11 +89,30 @@ protected: */ std::list m_unsupported_points; + /*! + * BoundingBox of all points in m_unsupported_points. Used for mapping of sign integer numbers to positive integer numbers. + */ + const BoundingBox m_unsupported_points_bbox; + /*! * Links the unsupported points to a grid point, so that we can quickly look * up the cell belonging to a certain position in the grid. */ std::unordered_map::iterator, PointHash> m_unsupported_points_grid; + + /*! + * Maps the point to the grid coordinates. + */ + Point to_grid_point(const Point &point) const { + return (point - m_unsupported_points_bbox.min) / m_cell_size; + } + + /*! + * Maps the point to the grid coordinates. + */ + Point from_grid_point(const Point &point) const { + return point * m_cell_size + m_unsupported_points_bbox.min; + } }; } // namespace Slic3r::FillLightning diff --git a/src/libslic3r/Fill/Lightning/Generator.cpp b/src/libslic3r/Fill/Lightning/Generator.cpp index 87b593f89b..6a4a675cbe 100644 --- a/src/libslic3r/Fill/Lightning/Generator.cpp +++ b/src/libslic3r/Fill/Lightning/Generator.cpp @@ -35,17 +35,17 @@ Generator::Generator(const PrintObject &print_object) // const int infill_extruder = region_config.infill_extruder.value; const double default_infill_extrusion_width = Flow::auto_extrusion_width(FlowRole::frInfill, float(max_nozzle_diameter)); // Note: There's not going to be a layer below the first one, so the 'initial layer height' doesn't have to be taken into account. - const double layer_thickness = object_config.layer_height; + const double layer_thickness = scaled(object_config.layer_height.value); m_infill_extrusion_width = scaled(region_config.infill_extrusion_width.percent ? default_infill_extrusion_width * 0.01 * region_config.infill_extrusion_width : region_config.infill_extrusion_width); - m_supporting_radius = scaled(m_infill_extrusion_width * 0.001 / region_config.fill_density); + m_supporting_radius = coord_t(m_infill_extrusion_width) * 100 / coord_t(region_config.fill_density.value); - const double lightning_infill_overhang_angle = M_PI / 4; // 45 degrees - const double lightning_infill_prune_angle = M_PI / 4; // 45 degrees + const double lightning_infill_overhang_angle = M_PI / 4; // 45 degrees + const double lightning_infill_prune_angle = M_PI / 4; // 45 degrees const double lightning_infill_straightening_angle = M_PI / 4; // 45 degrees - m_wall_supporting_radius = layer_thickness * std::tan(lightning_infill_overhang_angle); - m_prune_length = layer_thickness * std::tan(lightning_infill_prune_angle); - m_straightening_max_distance = layer_thickness * std::tan(lightning_infill_straightening_angle); + m_wall_supporting_radius = coord_t(layer_thickness * std::tan(lightning_infill_overhang_angle)); + m_prune_length = coord_t(layer_thickness * std::tan(lightning_infill_prune_angle)); + m_straightening_max_distance = coord_t(layer_thickness * std::tan(lightning_infill_straightening_angle)); generateInitialInternalOverhangs(print_object); generateTrees(print_object); @@ -54,19 +54,20 @@ Generator::Generator(const PrintObject &print_object) void Generator::generateInitialInternalOverhangs(const PrintObject &print_object) { m_overhang_per_layer.resize(print_object.layers().size()); - const float infill_wall_offset = - m_infill_extrusion_width; + // FIXME: It can be adjusted to improve bonding between infill and perimeters. + const float infill_wall_offset = 0;// m_infill_extrusion_width; Polygons infill_area_above; //Iterate from top to bottom, to subtract the overhang areas above from the overhang areas on the layer below, to get only overhang in the top layer where it is overhanging. - for (int layer_nr = print_object.layers().size() - 1; layer_nr >= 0; layer_nr--) { + for (int layer_nr = int(print_object.layers().size()) - 1; layer_nr >= 0; layer_nr--) { Polygons infill_area_here; for (const LayerRegion* layerm : print_object.get_layer(layer_nr)->regions()) for (const Surface& surface : layerm->fill_surfaces.surfaces) if (surface.surface_type == stInternal) - append(infill_area_here, offset(surface.expolygon, infill_wall_offset)); + append(infill_area_here, infill_wall_offset == 0 ? surface.expolygon : offset(surface.expolygon, infill_wall_offset)); //Remove the part of the infill area that is already supported by the walls. - Polygons overhang = diff(offset(infill_area_here, -m_wall_supporting_radius), infill_area_above); + Polygons overhang = diff(offset(infill_area_here, -float(m_wall_supporting_radius)), infill_area_above); m_overhang_per_layer[layer_nr] = overhang; infill_area_above = std::move(infill_area_here); @@ -82,16 +83,17 @@ const Layer& Generator::getTreesForLayer(const size_t& layer_id) const void Generator::generateTrees(const PrintObject &print_object) { m_lightning_layers.resize(print_object.layers().size()); - const coord_t infill_wall_offset = - m_infill_extrusion_width; + // FIXME: It can be adjusted to improve bonding between infill and perimeters. + const coord_t infill_wall_offset = 0;// m_infill_extrusion_width; std::vector infill_outlines(print_object.layers().size(), Polygons()); // For-each layer from top to bottom: - for (int layer_id = print_object.layers().size() - 1; layer_id >= 0; layer_id--) + for (int layer_id = int(print_object.layers().size()) - 1; layer_id >= 0; layer_id--) for (const LayerRegion *layerm : print_object.get_layer(layer_id)->regions()) for (const Surface &surface : layerm->fill_surfaces.surfaces) if (surface.surface_type == stInternal) - append(infill_outlines[layer_id], offset(surface.expolygon, infill_wall_offset)); + append(infill_outlines[layer_id], infill_wall_offset == 0 ? surface.expolygon : offset(surface.expolygon, infill_wall_offset)); // For various operations its beneficial to quickly locate nearby features on the polygon: const size_t top_layer_id = print_object.layers().size() - 1; @@ -99,16 +101,16 @@ void Generator::generateTrees(const PrintObject &print_object) outlines_locator.create(infill_outlines[top_layer_id], locator_cell_size); // For-each layer from top to bottom: - for (int layer_id = top_layer_id; layer_id >= 0; layer_id--) - { - Layer& current_lightning_layer = m_lightning_layers[layer_id]; - Polygons& current_outlines = infill_outlines[layer_id]; + for (int layer_id = int(top_layer_id); layer_id >= 0; layer_id--) { + Layer ¤t_lightning_layer = m_lightning_layers[layer_id]; + const Polygons ¤t_outlines = infill_outlines[layer_id]; + const BoundingBox ¤t_outlines_bbox = get_extents(current_outlines); // register all trees propagated from the previous layer as to-be-reconnected std::vector to_be_reconnected_tree_roots = current_lightning_layer.tree_roots; - current_lightning_layer.generateNewTrees(m_overhang_per_layer[layer_id], current_outlines, outlines_locator, m_supporting_radius, m_wall_supporting_radius); - current_lightning_layer.reconnectRoots(to_be_reconnected_tree_roots, current_outlines, outlines_locator, m_supporting_radius, m_wall_supporting_radius); + current_lightning_layer.generateNewTrees(m_overhang_per_layer[layer_id], current_outlines, current_outlines_bbox, outlines_locator, m_supporting_radius, m_wall_supporting_radius); + current_lightning_layer.reconnectRoots(to_be_reconnected_tree_roots, current_outlines, current_outlines_bbox, outlines_locator, m_supporting_radius, m_wall_supporting_radius); // Initialize trees for next lower layer from the current one. if (layer_id == 0) diff --git a/src/libslic3r/Fill/Lightning/Generator.hpp b/src/libslic3r/Fill/Lightning/Generator.hpp index c44ecfe7a2..b538c4dbe2 100644 --- a/src/libslic3r/Fill/Lightning/Generator.hpp +++ b/src/libslic3r/Fill/Lightning/Generator.hpp @@ -45,7 +45,7 @@ public: * already be calculated at this point. * \param mesh The mesh to generate infill for. */ - Generator(const PrintObject &print_object); + explicit Generator(const PrintObject &print_object); /*! * Get a tree of paths generated for a certain layer of the mesh. diff --git a/src/libslic3r/Fill/Lightning/Layer.cpp b/src/libslic3r/Fill/Lightning/Layer.cpp index 1b3936e340..1e1127a792 100644 --- a/src/libslic3r/Fill/Lightning/Layer.cpp +++ b/src/libslic3r/Fill/Lightning/Layer.cpp @@ -3,12 +3,11 @@ #include "Layer.hpp" //The class we're implementing. -#include // advance - #include "DistanceField.hpp" #include "TreeNode.hpp" #include "../../Geometry.hpp" +#include "Utils.hpp" namespace Slic3r::FillLightning { @@ -23,10 +22,15 @@ Point GroundingLocation::p() const return tree_node ? tree_node->getLocation() : *boundary_location; } -void Layer::fillLocator(SparseNodeGrid &tree_node_locator) +inline static Point to_grid_point(const Point &point, const BoundingBox &bbox) { - std::function add_node_to_locator_func = [&tree_node_locator](NodeSPtr node) { - tree_node_locator.insert(std::make_pair(Point(node->getLocation().x() / locator_cell_size, node->getLocation().y() / locator_cell_size), node)); + return (point - bbox.min) / locator_cell_size; +} + +void Layer::fillLocator(SparseNodeGrid &tree_node_locator, const BoundingBox& current_outlines_bbox) +{ + std::function add_node_to_locator_func = [&tree_node_locator, ¤t_outlines_bbox](const NodeSPtr &node) { + tree_node_locator.insert(std::make_pair(to_grid_point(node->getLocation(), current_outlines_bbox), node)); }; for (auto& tree : tree_roots) tree->visitNodes(add_node_to_locator_func); @@ -36,38 +40,46 @@ void Layer::generateNewTrees ( const Polygons& current_overhang, const Polygons& current_outlines, + const BoundingBox& current_outlines_bbox, const EdgeGrid::Grid& outlines_locator, const coord_t supporting_radius, const coord_t wall_supporting_radius ) { - DistanceField distance_field(supporting_radius, current_outlines, current_overhang); + DistanceField distance_field(supporting_radius, current_outlines, current_outlines_bbox, current_overhang); SparseNodeGrid tree_node_locator; - fillLocator(tree_node_locator); + fillLocator(tree_node_locator, current_outlines_bbox); // Until no more points need to be added to support all: // Determine next point from tree/outline areas via distance-field Point unsupported_location; while (distance_field.tryGetNextPoint(&unsupported_location)) { GroundingLocation grounding_loc = getBestGroundingLocation( - unsupported_location, current_outlines, outlines_locator, supporting_radius, wall_supporting_radius, tree_node_locator); + unsupported_location, current_outlines, current_outlines_bbox, outlines_locator, supporting_radius, wall_supporting_radius, tree_node_locator); NodeSPtr new_parent; NodeSPtr new_child; this->attach(unsupported_location, grounding_loc, new_child, new_parent); - tree_node_locator.insert(std::make_pair(Point(new_child->getLocation().x() / locator_cell_size, new_child->getLocation().y() / locator_cell_size), new_child)); + tree_node_locator.insert(std::make_pair(to_grid_point(new_child->getLocation(), current_outlines_bbox), new_child)); if (new_parent) - tree_node_locator.insert(std::make_pair(Point(new_parent->getLocation().x() / locator_cell_size, new_parent->getLocation().y() / locator_cell_size), new_parent)); + tree_node_locator.insert(std::make_pair(to_grid_point(new_parent->getLocation(), current_outlines_bbox), new_parent)); // update distance field distance_field.update(grounding_loc.p(), unsupported_location); } + +#ifdef LIGHTNING_TREE_NODE_DEBUG_OUTPUT + { + static int iRun = 0; + export_to_svg(debug_out_path("FillLightning-TreeNodes-%d.svg", iRun++), current_outlines, this->tree_roots); + } +#endif /* LIGHTNING_TREE_NODE_DEBUG_OUTPUT */ } -static bool polygonCollidesWithLineSegment(const Point from, const Point to, const EdgeGrid::Grid &loc_to_line) +static bool polygonCollidesWithLineSegment(const Point &from, const Point &to, const EdgeGrid::Grid &loc_to_line) { struct Visitor { - explicit Visitor(const EdgeGrid::Grid &grid) : grid(grid) {} + explicit Visitor(const EdgeGrid::Grid &grid, const Line &line) : grid(grid), line(line) {} bool operator()(coord_t iy, coord_t ix) { // Called with a row and colum of the grid cell, which is intersected by a line. @@ -87,7 +99,7 @@ static bool polygonCollidesWithLineSegment(const Point from, const Point to, con const EdgeGrid::Grid& grid; Line line; bool intersect = false; - } visitor(loc_to_line); + } visitor(loc_to_line, {from, to}); loc_to_line.visit_cells_intersecting_line(from, to, visitor); return visitor.intersect; @@ -97,6 +109,7 @@ GroundingLocation Layer::getBestGroundingLocation ( const Point& unsupported_location, const Polygons& current_outlines, + const BoundingBox& current_outlines_bbox, const EdgeGrid::Grid& outline_locator, const coord_t supporting_radius, const coord_t wall_supporting_radius, @@ -128,8 +141,8 @@ GroundingLocation Layer::getBestGroundingLocation if (current_dist >= wall_supporting_radius) { // Only reconnect tree roots to other trees if they are not already close to the outlines. const coord_t search_radius = std::min(current_dist, within_dist); BoundingBox region(unsupported_location - Point(search_radius, search_radius), unsupported_location + Point(search_radius + locator_cell_size, search_radius + locator_cell_size)); - region.min /= locator_cell_size; - region.max /= locator_cell_size; + region.min = to_grid_point(region.min, current_outlines_bbox); + region.max = to_grid_point(region.max, current_outlines_bbox); Point grid_addr; for (grid_addr.y() = region.min.y(); grid_addr.y() < region.max.y(); ++ grid_addr.y()) for (grid_addr.x() = region.min.x(); grid_addr.x() < region.max.x(); ++ grid_addr.x()) { @@ -176,6 +189,7 @@ void Layer::reconnectRoots ( std::vector& to_be_reconnected_tree_roots, const Polygons& current_outlines, + const BoundingBox& current_outlines_bbox, const EdgeGrid::Grid& outline_locator, const coord_t supporting_radius, const coord_t wall_supporting_radius @@ -184,10 +198,10 @@ void Layer::reconnectRoots constexpr coord_t tree_connecting_ignore_offset = 100; SparseNodeGrid tree_node_locator; - fillLocator(tree_node_locator); + fillLocator(tree_node_locator, current_outlines_bbox); const coord_t within_max_dist = outline_locator.resolution() * 2; - for (auto root_ptr : to_be_reconnected_tree_roots) + for (const auto &root_ptr : to_be_reconnected_tree_roots) { auto old_root_it = std::find(tree_roots.begin(), tree_roots.end(), root_ptr); @@ -203,7 +217,7 @@ void Layer::reconnectRoots root_ptr->addChild(new_root); new_root->reroot(); - tree_node_locator.insert(std::make_pair(Point(new_root->getLocation().x() / locator_cell_size, new_root->getLocation().y() / locator_cell_size), new_root)); + tree_node_locator.insert(std::make_pair(to_grid_point(new_root->getLocation(), current_outlines_bbox), new_root)); *old_root_it = std::move(new_root); // replace old root with new root continue; @@ -217,6 +231,7 @@ void Layer::reconnectRoots ( root_ptr->getLocation(), current_outlines, + current_outlines_bbox, outline_locator, supporting_radius, tree_connecting_ignore_width, @@ -233,7 +248,7 @@ void Layer::reconnectRoots attach_ptr->reroot(); new_root->addChild(attach_ptr); - tree_node_locator.insert(std::make_pair(new_root->getLocation(), new_root)); + tree_node_locator.insert(std::make_pair(to_grid_point(new_root->getLocation(), current_outlines_bbox), new_root)); *old_root_it = std::move(new_root); // replace old root with new root } @@ -256,15 +271,25 @@ void Layer::reconnectRoots } } -/* - * Implementation assumes moving inside, but moving outside should just as well be possible. +/*! + * Moves the point \p from onto the nearest polygon or leaves the point as-is, when the comb boundary is not within the root of \p max_dist2 distance. + * Given a \p distance more than zero, the point will end up inside, and conversely outside. + * When the point is already in/outside by more than \p distance, \p from is unaltered, but the polygon is returned. + * When the point is in/outside by less than \p distance, \p from is moved to the correct place. + * Implementation assumes moving inside, but moving outside should just as well be possible. + * + * \param polygons The polygons onto which to move the point + * \param from[in,out] The point to move. + * \param distance The distance by which to move the point. + * \param max_dist2 The squared maximal allowed distance from the point to the nearest polygon. + * \return The index to the polygon onto which we have moved the point. */ static unsigned int moveInside(const Polygons& polygons, Point& from, int distance, int64_t maxDist2) { - Point ret = from; - int64_t bestDist2 = std::numeric_limits::max(); - unsigned int bestPoly = static_cast(-1); - bool is_already_on_correct_side_of_boundary = false; // whether [from] is already on the right side of the boundary + Point ret = from; + int64_t bestDist2 = std::numeric_limits::max(); + auto bestPoly = static_cast(-1); + bool is_already_on_correct_side_of_boundary = false; // whether [from] is already on the right side of the boundary for (unsigned int poly_idx = 0; poly_idx < polygons.size(); poly_idx++) { const Polygon &poly = polygons[poly_idx]; @@ -333,7 +358,7 @@ static unsigned int moveInside(const Polygons& polygons, Point& from, int distan else { // x is projected to a point properly on the line segment (not onto a vertex). The case which looks like | . projected_p_beyond_prev_segment = false; - Point x = a + ab * dot_prod / ab_length2; + Point x = (a.cast() + ab.cast() * dot_prod / ab_length2).cast(); int64_t dist2 = (p - x).cast().squaredNorm(); if (dist2 < bestDist2) diff --git a/src/libslic3r/Fill/Lightning/Layer.hpp b/src/libslic3r/Fill/Lightning/Layer.hpp index 853c634f27..cc79c15b51 100644 --- a/src/libslic3r/Fill/Lightning/Layer.hpp +++ b/src/libslic3r/Fill/Lightning/Layer.hpp @@ -41,9 +41,10 @@ public: ( const Polygons& current_overhang, const Polygons& current_outlines, + const BoundingBox& current_outlines_bbox, const EdgeGrid::Grid& outline_locator, - const coord_t supporting_radius, - const coord_t wall_supporting_radius + coord_t supporting_radius, + coord_t wall_supporting_radius ); /*! Determine & connect to connection point in tree/outline. @@ -53,9 +54,10 @@ public: ( const Point& unsupported_location, const Polygons& current_outlines, + const BoundingBox& current_outlines_bbox, const EdgeGrid::Grid& outline_locator, - const coord_t supporting_radius, - const coord_t wall_supporting_radius, + coord_t supporting_radius, + coord_t wall_supporting_radius, const SparseNodeGrid& tree_node_locator, const NodeSPtr& exclude_tree = nullptr ); @@ -71,16 +73,17 @@ public: ( std::vector& to_be_reconnected_tree_roots, const Polygons& current_outlines, + const BoundingBox& current_outlines_bbox, const EdgeGrid::Grid& outline_locator, - const coord_t supporting_radius, - const coord_t wall_supporting_radius + coord_t supporting_radius, + coord_t wall_supporting_radius ); - Polylines convertToLines(const Polygons& limit_to_outline, const coord_t line_width) const; + Polylines convertToLines(const Polygons& limit_to_outline, coord_t line_width) const; coord_t getWeightedDistance(const Point& boundary_loc, const Point& unsupported_location); - void fillLocator(SparseNodeGrid& tree_node_locator); + void fillLocator(SparseNodeGrid& tree_node_locator, const BoundingBox& current_outlines_bbox); }; } // namespace Slic3r::FillLightning diff --git a/src/libslic3r/Fill/Lightning/TreeNode.cpp b/src/libslic3r/Fill/Lightning/TreeNode.cpp index 8ab11bd6d4..b36a66dbb7 100644 --- a/src/libslic3r/Fill/Lightning/TreeNode.cpp +++ b/src/libslic3r/Fill/Lightning/TreeNode.cpp @@ -4,7 +4,6 @@ #include "TreeNode.hpp" #include "../../Geometry.hpp" -#include "../../ClipperUtils.hpp" namespace Slic3r::FillLightning { @@ -107,7 +106,7 @@ NodeSPtr Node::deepCopy() const return local_root; } -void Node::reroot(NodeSPtr new_parent /*= nullptr*/) +void Node::reroot(const NodeSPtr &new_parent) { if (! m_is_root) { auto old_parent = m_parent.lock(); @@ -142,7 +141,7 @@ NodeSPtr Node::closestNode(const Point& loc) return result; } -bool inside(const Polygons &polygons, const Point p) +bool inside(const Polygons &polygons, const Point &p) { int poly_count_inside = 0; for (const Polygon &poly : polygons) { @@ -181,7 +180,7 @@ bool lineSegmentPolygonsIntersection(const Point& a, const Point& b, const EdgeG } visitor { outline_locator, a.cast(), b.cast() }; outline_locator.visit_cells_intersecting_line(a, b, visitor); - return visitor.d2min < within_max_dist * within_max_dist; + return visitor.d2min < double(within_max_dist) * double(within_max_dist); } bool Node::realign(const Polygons& outlines, const EdgeGrid::Grid& outline_locator, std::vector& rerooted_parts) @@ -226,14 +225,14 @@ bool Node::realign(const Polygons& outlines, const EdgeGrid::Grid& outline_locat void Node::straighten(const coord_t magnitude, const coord_t max_remove_colinear_dist) { - straighten(magnitude, m_p, 0, max_remove_colinear_dist * max_remove_colinear_dist); + straighten(magnitude, m_p, 0, int64_t(max_remove_colinear_dist) * int64_t(max_remove_colinear_dist)); } Node::RectilinearJunction Node::straighten( const coord_t magnitude, const Point& junction_above, const coord_t accumulated_dist, - const coord_t max_remove_colinear_dist2) + const int64_t max_remove_colinear_dist2) { constexpr coord_t junction_magnitude_factor_numerator = 3; constexpr coord_t junction_magnitude_factor_denominator = 4; @@ -245,13 +244,13 @@ Node::RectilinearJunction Node::straighten( auto child_dist = coord_t((m_p - child_p->m_p).cast().norm()); RectilinearJunction junction_below = child_p->straighten(magnitude, junction_above, accumulated_dist + child_dist, max_remove_colinear_dist2); coord_t total_dist_to_junction_below = junction_below.total_recti_dist; - Point a = junction_above; - Point b = junction_below.junction_loc; + const Point& a = junction_above; + Point b = junction_below.junction_loc; if (a != b) // should always be true! { Point ab = b - a; - Point destination = a + ab * accumulated_dist / std::max(coord_t(1), total_dist_to_junction_below); - if ((destination - m_p).cast().squaredNorm() <= magnitude * magnitude) + Point destination = (a.cast() + ab.cast() * int64_t(accumulated_dist) / std::max(int64_t(1), int64_t(total_dist_to_junction_below))).cast(); + if ((destination - m_p).cast().squaredNorm() <= int64_t(magnitude) * int64_t(magnitude)) m_p = destination; else m_p += ((destination - m_p).cast().normalized() * magnitude).cast(); @@ -262,7 +261,7 @@ Node::RectilinearJunction Node::straighten( child_p = m_children.front(); //recursive call to straighten might have removed the child const NodeSPtr& parent_node = m_parent.lock(); if (parent_node && - (child_p->m_p - parent_node->m_p).cast().squaredNorm() < max_remove_colinear_dist2 && + (child_p->m_p - parent_node->m_p).cast().squaredNorm() < max_remove_colinear_dist2 && Line::distance_to_squared(m_p, parent_node->m_p, child_p->m_p) < close_enough * close_enough) { child_p->m_parent = m_parent; for (auto& sibling : parent_node->m_children) @@ -347,7 +346,7 @@ coord_t Node::prune(const coord_t& pruning_distance) void Node::convertToPolylines(Polygons& output, const coord_t line_width) const { Polygons result; - output.emplace_back(); + result.emplace_back(); convertToPolylines(0, result); removeJunctionOverlap(result, line_width); append(output, std::move(result)); @@ -386,7 +385,7 @@ void Node::removeJunctionOverlap(Polygons& result_lines, const coord_t line_widt coord_t to_be_reduced = reduction; Point a = polyline.back(); - for (int point_idx = polyline.size() - 2; point_idx >= 0; point_idx--) { + for (int point_idx = int(polyline.size()) - 2; point_idx >= 0; point_idx--) { const Point b = polyline[point_idx]; const Point ab = b - a; const auto ab_len = coord_t(ab.cast().norm()); @@ -408,4 +407,29 @@ void Node::removeJunctionOverlap(Polygons& result_lines, const coord_t line_widt } } +#ifdef LIGHTNING_TREE_NODE_DEBUG_OUTPUT +void export_to_svg(const NodeSPtr &root_node, SVG &svg) +{ + for (const NodeSPtr &children : root_node->m_children) { + svg.draw(Line(root_node->getLocation(), children->getLocation()), "red"); + export_to_svg(children, svg); + } +} + +void export_to_svg(const std::string &path, const Polygons &contour, const std::vector &root_nodes) { + BoundingBox bbox = get_extents(contour); + + bbox.offset(SCALED_EPSILON); + SVG svg(path, bbox); + svg.draw_outline(contour, "blue"); + + for (const NodeSPtr &root_node: root_nodes) { + for (const NodeSPtr &children: root_node->m_children) { + svg.draw(Line(root_node->getLocation(), children->getLocation()), "red"); + export_to_svg(children, svg); + } + } +} +#endif /* LIGHTNING_TREE_NODE_DEBUG_OUTPUT */ + } // namespace Slic3r::FillLightning diff --git a/src/libslic3r/Fill/Lightning/TreeNode.hpp b/src/libslic3r/Fill/Lightning/TreeNode.hpp index bc2e76dc2f..55ef35e0a8 100644 --- a/src/libslic3r/Fill/Lightning/TreeNode.hpp +++ b/src/libslic3r/Fill/Lightning/TreeNode.hpp @@ -11,6 +11,9 @@ #include "../../EdgeGrid.hpp" #include "../../Polygon.hpp" +#include "SVG.hpp" + +//#define LIGHTNING_TREE_NODE_DEBUG_OUTPUT namespace Slic3r::FillLightning { @@ -99,9 +102,9 @@ public: std::vector& next_trees, const Polygons& next_outlines, const EdgeGrid::Grid& outline_locator, - const coord_t prune_distance, - const coord_t smooth_magnitude, - const coord_t max_remove_colinear_dist + coord_t prune_distance, + coord_t smooth_magnitude, + coord_t max_remove_colinear_dist ) const; /*! @@ -156,7 +159,7 @@ public: * This is then recursively bubbled up until it reaches the (former) root, which then will become a leaf. * \param new_parent The (new) parent-node of the root, useful for recursing or immediately attaching the node to another tree. */ - void reroot(NodeSPtr new_parent = nullptr); + void reroot(const NodeSPtr &new_parent = nullptr); /*! * Retrieves the closest node to the specified location. @@ -211,7 +214,7 @@ protected: * \param magnitude The maximum allowed distance to move the node. * \param max_remove_colinear_dist Maximum distance of the (compound) line-segment from which a co-linear point may be removed. */ - void straighten(const coord_t magnitude, const coord_t max_remove_colinear_dist); + void straighten(coord_t magnitude, coord_t max_remove_colinear_dist); /*! Recursive part of \ref straighten(.) * \param junction_above The last seen junction with multiple children above @@ -219,7 +222,7 @@ protected: * \param max_remove_colinear_dist2 Maximum distance _squared_ of the (compound) line-segment from which a co-linear point may be removed. * \return the total distance along the tree from the last junction above to the first next junction below and the location of the next junction below */ - RectilinearJunction straighten(const coord_t magnitude, const Point& junction_above, const coord_t accumulated_dist, const coord_t max_remove_colinear_dist2); + RectilinearJunction straighten(coord_t magnitude, const Point& junction_above, coord_t accumulated_dist, int64_t max_remove_colinear_dist2); /*! Prune the tree from the extremeties (leaf-nodes) until the pruning distance is reached. * \return The distance that has been pruned. If less than \p distance, then the whole tree was puned away. @@ -236,7 +239,7 @@ public: * * \param output all branches in this tree connected into polylines */ - void convertToPolylines(Polygons& output, const coord_t line_width) const; + void convertToPolylines(Polygons& output, coord_t line_width) const; /*! If this was ever a direct child of the root, it'll have a previous grounding location. * @@ -257,7 +260,7 @@ protected: */ void convertToPolylines(size_t long_line_idx, Polygons& output) const; - void removeJunctionOverlap(Polygons& polylines, const coord_t line_width) const; + void removeJunctionOverlap(Polygons& polylines, coord_t line_width) const; bool m_is_root; Point m_p; @@ -265,10 +268,20 @@ protected: std::vector m_children; std::optional m_last_grounding_location; // &root_nodes); +#endif /* LIGHTNING_TREE_NODE_DEBUG_OUTPUT */ }; -bool inside(const Polygons &polygons, const Point p); -bool lineSegmentPolygonsIntersection(const Point& a, const Point& b, const EdgeGrid::Grid& outline_locator, Point& result, const coord_t within_max_dist); +bool inside(const Polygons &polygons, const Point &p); +bool lineSegmentPolygonsIntersection(const Point& a, const Point& b, const EdgeGrid::Grid& outline_locator, Point& result, coord_t within_max_dist); + +#ifdef LIGHTNING_TREE_NODE_DEBUG_OUTPUT +void export_to_svg(const NodeSPtr &root_node, SVG &svg); +void export_to_svg(const std::string &path, const Polygons &contour, const std::vector &root_nodes); +#endif /* LIGHTNING_TREE_NODE_DEBUG_OUTPUT */ } // namespace Slic3r::FillLightning diff --git a/src/libslic3r/Layer.hpp b/src/libslic3r/Layer.hpp index 0071c7f6e1..a308ac0b62 100644 --- a/src/libslic3r/Layer.hpp +++ b/src/libslic3r/Layer.hpp @@ -20,6 +20,10 @@ namespace FillAdaptive { struct Octree; }; +namespace FillLightning { + class Generator; +}; + class LayerRegion { public: @@ -151,8 +155,8 @@ public: } void make_perimeters(); // Phony version of make_fills() without parameters for Perl integration only. - void make_fills() { this->make_fills(nullptr, nullptr); } - void make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive::Octree* support_fill_octree); + void make_fills() { this->make_fills(nullptr, nullptr, nullptr); } + void make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive::Octree* support_fill_octree, FillLightning::Generator* lightning_generator); void make_ironing(); void export_region_slices_to_svg(const char *path) const; diff --git a/src/libslic3r/Point.hpp b/src/libslic3r/Point.hpp index e5dc334f59..6b430c2fef 100644 --- a/src/libslic3r/Point.hpp +++ b/src/libslic3r/Point.hpp @@ -177,6 +177,11 @@ inline bool operator<(const Point &l, const Point &r) return l.x() < r.x() || (l.x() == r.x() && l.y() < r.y()); } +inline Point operator* (const Point& l, const double &r) +{ + return {coord_t(l.x() * r), coord_t(l.y() * r)}; +} + inline bool is_approx(const Point &p1, const Point &p2, coord_t epsilon = coord_t(SCALED_EPSILON)) { Point d = (p2 - p1).cwiseAbs(); diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index c5e312a2bf..d99e24ca70 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -35,7 +35,13 @@ namespace FillAdaptive { struct Octree; struct OctreeDeleter; using OctreePtr = std::unique_ptr; -}; +}; // namespace FillAdaptive + +namespace FillLightning { + class Generator; + struct GeneratorDeleter; + using GeneratorPtr = std::unique_ptr; +}; // namespace FillLightning // Print step IDs for keeping track of the print state. // The Print steps are applied in this order. @@ -387,6 +393,7 @@ private: void combine_infill(); void _generate_support_material(); std::pair prepare_adaptive_infill_data(); + FillLightning::GeneratorPtr prepare_lightning_infill_data(); // XYZ in scaled coordinates Vec3crd m_size; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 5a674da846..b21ed56318 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -108,9 +108,7 @@ static const t_config_enum_values s_keys_map_InfillPattern { { "octagramspiral", ipOctagramSpiral }, { "adaptivecubic", ipAdaptiveCubic }, { "supportcubic", ipSupportCubic }, -#if HAS_LIGHTNING_INFILL { "lightning", ipLightning } -#endif // HAS_LIGHTNING_INFILL }; CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(InfillPattern) @@ -1155,9 +1153,7 @@ void PrintConfigDef::init_fff_params() def->enum_values.push_back("octagramspiral"); def->enum_values.push_back("adaptivecubic"); def->enum_values.push_back("supportcubic"); -#if HAS_LIGHTNING_INFILL def->enum_values.push_back("lightning"); -#endif // HAS_LIGHTNING_INFILL def->enum_labels.push_back(L("Rectilinear")); def->enum_labels.push_back(L("Aligned Rectilinear")); def->enum_labels.push_back(L("Grid")); @@ -1174,9 +1170,7 @@ void PrintConfigDef::init_fff_params() def->enum_labels.push_back(L("Octagram Spiral")); def->enum_labels.push_back(L("Adaptive Cubic")); def->enum_labels.push_back(L("Support Cubic")); -#if HAS_LIGHTNING_INFILL def->enum_labels.push_back(L("Lightning")); -#endif // HAS_LIGHTNING_INFILL def->set_default_value(new ConfigOptionEnum(ipStars)); def = this->add("first_layer_acceleration", coFloat); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index b97168e84e..950816fa91 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -57,14 +57,10 @@ enum class FuzzySkinType { All, }; -#define HAS_LIGHTNING_INFILL 0 - enum InfillPattern : int { ipRectilinear, ipMonotonic, ipAlignedRectilinear, ipGrid, ipTriangles, ipStars, ipCubic, ipLine, ipConcentric, ipHoneycomb, ip3DHoneycomb, - ipGyroid, ipHilbertCurve, ipArchimedeanChords, ipOctagramSpiral, ipAdaptiveCubic, ipSupportCubic, ipSupportBase, -#if HAS_LIGHTNING_INFILL - ipLightning, -#endif // HAS_LIGHTNING_INFILL + ipGyroid, ipHilbertCurve, ipArchimedeanChords, ipOctagramSpiral, ipAdaptiveCubic, ipSupportCubic, ipSupportBase, + ipLightning, ipCount, }; diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 31d948db9d..9c6178f8b5 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -14,6 +14,7 @@ #include "TriangleMeshSlicer.hpp" #include "Utils.hpp" #include "Fill/FillAdaptive.hpp" +#include "Fill/FillLightning.hpp" #include "Format/STL.hpp" #include @@ -353,14 +354,15 @@ void PrintObject::infill() if (this->set_started(posInfill)) { auto [adaptive_fill_octree, support_fill_octree] = this->prepare_adaptive_infill_data(); + auto lightning_generator = this->prepare_lightning_infill_data(); BOOST_LOG_TRIVIAL(debug) << "Filling layers in parallel - start"; tbb::parallel_for( tbb::blocked_range(0, m_layers.size()), - [this, &adaptive_fill_octree = adaptive_fill_octree, &support_fill_octree = support_fill_octree](const tbb::blocked_range& range) { + [this, &adaptive_fill_octree = adaptive_fill_octree, &support_fill_octree = support_fill_octree, &lightning_generator](const tbb::blocked_range& range) { for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++ layer_idx) { m_print->throw_if_canceled(); - m_layers[layer_idx]->make_fills(adaptive_fill_octree.get(), support_fill_octree.get()); + m_layers[layer_idx]->make_fills(adaptive_fill_octree.get(), support_fill_octree.get(), lightning_generator.get()); } } ); @@ -453,6 +455,18 @@ std::pair PrintObject::prepare support_line_spacing ? build_octree(mesh, overhangs.front(), support_line_spacing, true) : OctreePtr()); } +FillLightning::GeneratorPtr PrintObject::prepare_lightning_infill_data() +{ + bool has_lightning_infill = false; + for (size_t region_id = 0; region_id < this->num_printing_regions(); ++region_id) + if (const PrintRegionConfig &config = this->printing_region(region_id).config(); config.fill_density > 0 && config.fill_pattern == ipLightning) { + has_lightning_infill = true; + break; + } + + return has_lightning_infill ? FillLightning::build_generator(std::as_const(*this)) : FillLightning::GeneratorPtr(); +} + void PrintObject::clear_layers() { for (Layer *l : m_layers) From 5de93c87843a8f5354077fb2a0424f3dab75a55b Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 28 Feb 2022 10:53:39 +0100 Subject: [PATCH 25/40] Fixed incorrect handling of 3rd party 3MFs in SLA mode (#6100 and others) --- src/libslic3r/SLAPrint.cpp | 9 ++++++--- src/slic3r/GUI/GLCanvas3D.cpp | 8 +++++++- src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp | 12 +++++++----- src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp | 13 ++++++------- src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp | 2 +- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 72cb96dd04..81ce0d6cb0 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -1174,7 +1174,8 @@ sla::SupportPoints SLAPrintObject::transformed_support_points() const { assert(m_model_object != nullptr); auto spts = m_model_object->sla_support_points; - auto tr = trafo().cast(); + const Transform3d& vol_trafo = m_model_object->volumes.front()->get_transformation().get_matrix(); + const Transform3f& tr = (trafo() * vol_trafo).cast(); for (sla::SupportPoint& suppt : spts) { suppt.pos = tr * suppt.pos; } @@ -1186,8 +1187,10 @@ sla::DrainHoles SLAPrintObject::transformed_drainhole_points() const { assert(m_model_object != nullptr); auto pts = m_model_object->sla_drain_holes; - auto tr = trafo().cast(); - auto sc = m_model_object->instances.front()->get_scaling_factor().cast(); + const Transform3d& vol_trafo = m_model_object->volumes.front()->get_transformation().get_matrix(); + const Geometry::Transformation trans(trafo() * vol_trafo); + const Transform3f& tr = trans.get_matrix().cast(); + const Vec3f sc = trans.get_scaling_factor().cast(); for (sla::DrainHole &hl : pts) { hl.pos = tr * hl.pos; hl.normal = tr * hl.normal - tr.translation(); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index ea08f98711..91add7c567 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2232,7 +2232,13 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re if (state.step[istep].state == PrintStateBase::DONE) { TriangleMesh mesh = print_object->get_mesh(slaposDrillHoles); assert(! mesh.empty()); - mesh.transform(sla_print->sla_trafo(*m_model->objects[volume.object_idx()]).inverse()); + + // sla_trafo does not contain volume trafo. To get a mesh to create + // a new volume from, we have to apply vol trafo inverse separately. + const ModelObject& mo = *m_model->objects[volume.object_idx()]; + Transform3d trafo = sla_print->sla_trafo(mo) + * mo.volumes.front()->get_transformation().get_matrix(); + mesh.transform(trafo.inverse()); #if ENABLE_SMOOTH_NORMALS #if ENABLE_LEGACY_OPENGL_REMOVAL volume.model.init_from(mesh, true); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp index ebf8aa21b5..e979297df7 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp @@ -122,9 +122,11 @@ void GLGizmoHollow::render_points(const Selection& selection, bool picking) #endif // ENABLE_LEGACY_OPENGL_REMOVAL const GLVolume* vol = selection.get_volume(*selection.get_volume_idxs().begin()); + Geometry::Transformation trafo = vol->get_instance_transformation() * vol->get_volume_transformation(); + #if ENABLE_GL_SHADERS_ATTRIBUTES const Transform3d instance_scaling_matrix_inverse = vol->get_instance_transformation().get_matrix(true, true, false, true).inverse(); - const Transform3d instance_matrix = Geometry::assemble_transform(m_c->selection_info()->get_sla_shift() * Vec3d::UnitZ()) * vol->get_instance_transformation().get_matrix(); + const Transform3d instance_matrix = Geometry::assemble_transform(m_c->selection_info()->get_sla_shift() * Vec3d::UnitZ()) * trafo.get_matrix(); const Camera& camera = wxGetApp().plater()->get_camera(); const Transform3d& view_matrix = camera.get_view_matrix(); @@ -132,8 +134,8 @@ void GLGizmoHollow::render_points(const Selection& selection, bool picking) shader->set_uniform("projection_matrix", projection_matrix); #else - const Transform3d& instance_scaling_matrix_inverse = vol->get_instance_transformation().get_matrix(true, true, false, true).inverse(); - const Transform3d& instance_matrix = vol->get_instance_transformation().get_matrix(); + const Transform3d& instance_scaling_matrix_inverse = trafo.get_matrix(true, true, false, true).inverse(); + const Transform3d& instance_matrix = trafo.get_matrix(); glsafe(::glPushMatrix()); glsafe(::glTranslated(0.0, 0.0, m_c->selection_info()->get_sla_shift())); @@ -222,7 +224,7 @@ bool GLGizmoHollow::is_mesh_point_clipped(const Vec3d& point) const auto sel_info = m_c->selection_info(); int active_inst = m_c->selection_info()->get_active_instance(); const ModelInstance* mi = sel_info->model_object()->instances[active_inst]; - const Transform3d& trafo = mi->get_transformation().get_matrix(); + const Transform3d& trafo = mi->get_transformation().get_matrix() * sel_info->model_object()->volumes.front()->get_matrix(); Vec3d transformed_point = trafo * point; transformed_point(2) += sel_info->get_sla_shift(); @@ -241,7 +243,7 @@ bool GLGizmoHollow::unproject_on_mesh(const Vec2d& mouse_pos, std::pairget_camera(); const Selection& selection = m_parent.get_selection(); const GLVolume* volume = selection.get_volume(*selection.get_volume_idxs().begin()); - Geometry::Transformation trafo = volume->get_instance_transformation(); + Geometry::Transformation trafo = volume->get_instance_transformation() * volume->get_volume_transformation(); trafo.set_offset(trafo.get_offset() + Vec3d(0., 0., m_c->selection_info()->get_sla_shift())); double clp_dist = m_c->object_clipper()->get_position(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index 3173cb10dd..e8c2055f63 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -151,18 +151,17 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking) #endif // ENABLE_LEGACY_OPENGL_REMOVAL const GLVolume* vol = selection.get_volume(*selection.get_volume_idxs().begin()); - const Transform3d instance_scaling_matrix_inverse = vol->get_instance_transformation().get_matrix(true, true, false, true).inverse(); + Geometry::Transformation transformation(vol->get_instance_transformation().get_matrix() * vol->get_volume_transformation().get_matrix()); + const Transform3d& instance_scaling_matrix_inverse = transformation.get_matrix(true, true, false, true).inverse(); #if ENABLE_GL_SHADERS_ATTRIBUTES const Transform3d instance_matrix = Geometry::assemble_transform(m_c->selection_info()->get_sla_shift() * Vec3d::UnitZ()) * vol->get_instance_transformation().get_matrix(); - const Camera& camera = wxGetApp().plater()->get_camera(); const Transform3d& view_matrix = camera.get_view_matrix(); const Transform3d& projection_matrix = camera.get_projection_matrix(); shader->set_uniform("projection_matrix", projection_matrix); #else - const Transform3d& instance_matrix = vol->get_instance_transformation().get_matrix(); - + const Transform3d& instance_matrix = transformation.get_matrix(); const float z_shift = m_c->selection_info()->get_sla_shift(); glsafe(::glPushMatrix()); glsafe(::glTranslated(0.0, 0.0, z_shift)); @@ -344,7 +343,7 @@ bool GLGizmoSlaSupports::is_mesh_point_clipped(const Vec3d& point) const auto sel_info = m_c->selection_info(); int active_inst = m_c->selection_info()->get_active_instance(); const ModelInstance* mi = sel_info->model_object()->instances[active_inst]; - const Transform3d& trafo = mi->get_transformation().get_matrix(); + const Transform3d& trafo = mi->get_transformation().get_matrix() * sel_info->model_object()->volumes.front()->get_matrix(); Vec3d transformed_point = trafo * point; transformed_point(2) += sel_info->get_sla_shift(); @@ -363,7 +362,7 @@ bool GLGizmoSlaSupports::unproject_on_mesh(const Vec2d& mouse_pos, std::pairget_camera(); const Selection& selection = m_parent.get_selection(); const GLVolume* volume = selection.get_volume(*selection.get_volume_idxs().begin()); - Geometry::Transformation trafo = volume->get_instance_transformation(); + Geometry::Transformation trafo = volume->get_instance_transformation() * volume->get_volume_transformation(); trafo.set_offset(trafo.get_offset() + Vec3d(0., 0., m_c->selection_info()->get_sla_shift())); double clp_dist = m_c->object_clipper()->get_position(); @@ -1238,7 +1237,7 @@ void GLGizmoSlaSupports::get_data_from_backend() if (po->model_object()->id() == mo->id()) { m_normal_cache.clear(); const std::vector& points = po->get_support_points(); - auto mat = po->trafo().inverse().cast(); + auto mat = (po->trafo() * po->model_object()->volumes.front()->get_transformation().get_matrix()).inverse().cast(); for (unsigned int i=0; iget_mesh_to_slice(); if (! backend_mesh.empty()) { m_hollowed_mesh_transformed.reset(new TriangleMesh(backend_mesh)); - Transform3d trafo_inv = canvas->sla_print()->sla_trafo(*mo).inverse(); + Transform3d trafo_inv = (canvas->sla_print()->sla_trafo(*mo) * print_object->model_object()->volumes.front()->get_transformation().get_matrix()).inverse(); m_hollowed_mesh_transformed->transform(trafo_inv); m_drainholes = print_object->model_object()->sla_drain_holes; m_old_hollowing_timestamp = timestamp; From ff2b8da8dc731854b9bceca15c71ee72054b4333 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 17 Mar 2022 11:39:58 +0100 Subject: [PATCH 26/40] Fixed crash when pressing 'Reset rotation' button while editing SLA support points (mentioned in #7359) --- src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp b/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp index 42bb0e58c6..f1156f9377 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp @@ -251,7 +251,7 @@ void HollowedMesh::on_update() const GLCanvas3D* canvas = get_pool()->get_canvas(); const PrintObjects& print_objects = canvas->sla_print()->objects(); - const SLAPrintObject* print_object = m_print_object_idx != -1 + const SLAPrintObject* print_object = (m_print_object_idx >= 0 && m_print_object_idx < int(print_objects.size())) ? print_objects[m_print_object_idx] : nullptr; @@ -474,7 +474,7 @@ void SupportsClipper::on_update() const GLCanvas3D* canvas = get_pool()->get_canvas(); const PrintObjects& print_objects = canvas->sla_print()->objects(); - const SLAPrintObject* print_object = m_print_object_idx != -1 + const SLAPrintObject* print_object = (m_print_object_idx >= 0 && m_print_object_idx < int(print_objects.size())) ? print_objects[m_print_object_idx] : nullptr; From dfd6ca899a37fabd2ed8f6ed526fd8e60575e01a Mon Sep 17 00:00:00 2001 From: rtyr <36745189+rtyr@users.noreply.github.com> Date: Thu, 17 Mar 2022 13:41:08 +0100 Subject: [PATCH 27/40] Sync with PrusaSlicer-settings --- resources/profiles/Ultimaker.idx | 1 + resources/profiles/Ultimaker.ini | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/profiles/Ultimaker.idx b/resources/profiles/Ultimaker.idx index a593d2fb4b..8e119931c1 100644 --- a/resources/profiles/Ultimaker.idx +++ b/resources/profiles/Ultimaker.idx @@ -1,2 +1,3 @@ min_slic3r_version = 2.4.0-beta0 +1.0.1 Updated start g-code. 1.0.0 Initial version diff --git a/resources/profiles/Ultimaker.ini b/resources/profiles/Ultimaker.ini index 363e0dec8a..1aeeab0a15 100644 --- a/resources/profiles/Ultimaker.ini +++ b/resources/profiles/Ultimaker.ini @@ -9,7 +9,7 @@ name = Ultimaker # Configuration version of this file. Config file will only be installed, if the config_version differs. # This means, the server may force the PrusaSlicer configuration to be downgraded. -config_version = 1.0.0 +config_version = 1.0.1 # Where to get the updates from? config_update_url = https://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/Ultimaker/ @@ -396,5 +396,5 @@ printer_notes = Dont remove the following keywords! These keywords are used in t nozzle_diameter = 0.4 default_print_profile = 0.20mm NORMAL @ULTIMAKER2 default_filament_profile = Generic PLA @ULTIMAKER2 -start_gcode = ; Printer_Settings_ID: [printer_settings_id]\n\n; # # # # # # START Header\nG21 ; metric values\nG90 ; absolute positioning\nM82 ; set extruder to absolute mode\nM107 ; start with the fan off\n\nG28 X0 Y0 Z0 ; move X/Y/Z to endstops\nG1 X1 Y6 F15000 ; move X/Y to start position\nG1 Z35 F9000 ; move Z to start position\n\n; Heat up bed and nozzle\nM190 S{first_layer_bed_temperature[0] - 5} ; wait for bed temperature - 5\nM140 S[first_layer_bed_temperature] ; continue bed heating\nM109 S[first_layer_temperature] ; wait for nozzle temperature\n\nG92 E0 ; zero the extruded length\nG1 F150 E22 ; purge nozzle with filament\nG92 E0 ; zero the extruded length again\nG1 F75 E7 ; additional priming\nG92 E0 ; zero the extruded length again\n\n; # # # # # # END Header +start_gcode = start_gcode = ; Printer_Settings_ID: [printer_settings_id]\n\n; # # # # # # START Header\nG21 ; metric values\nG90 ; absolute positioning\nM82 ; set extruder to absolute mode\nM107 ; start with the fan off\n\nM140 S[first_layer_bed_temperature] ; start bed heating\n\nG28 X0 Y0 Z0 ; move X/Y/Z to endstops\nG1 X1 Y6 F15000 ; move X/Y to start position\nG1 Z35 F9000 ; move Z to start position\n\n; Wait for bed and nozzle temperatures\nM190 S{first_layer_bed_temperature[0] - 5} ; wait for bed temperature - 5\nM140 S[first_layer_bed_temperature] ; continue bed heating\nM109 S[first_layer_temperature] ; wait for nozzle temperature\n\n; Purge and prime\nM83 ; set extruder to relative mode\nG92 E0 ; reset extrusion distance\nG0 X0 Y1 F10000\nG1 F150 E20 Y10 ; compress the bowden tube\nG1 E-8 F1200\nG0 X30 Y1 F5000 \nG0 F1200 Z{first_layer_height/2} ; Cut the connection to priming blob\nG0 X100 F10000 ; disconnect with the prime blob\nG0 X50 ; Avoid the metal clip holding the Ultimaker glass plate\nG0 Z0.2 F720\nG1 E8 F1200\nG1 X80 E3 F1000 ; intro line 1\nG1 X110 E4 F1000 ; intro line 2\nG1 X140 F600 ; drag filament to decompress bowden tube\nG1 X100 F3200 ; wipe backwards a bit\nG1 X150 F3200 ; back to where there is no plastic: avoid dragging\nG92 E0 ; reset extruder reference\nM82 ; set extruder to absolute mode\n\n; # # # # # # END Header end_gcode = ; # # # # # # START Footer\nG91 ; relative coordinates\n;G1 E-1 F1200 ; retract the filament\nG1 Z+15 X-10 Y-10 E-7 F6000 ; move Z a bit\n; G1 X-10 Y-10 F6000 ; move XY a bit\nG1 E-5.5 F300 ; retract the filament\nG28 X0 Y0 ; move X/Y to min endstops, so the head is out of the way\nM104 S0 ; extruder heater off\nM140 S0 ; heated bed heater off (if you have it)\nM84 ; disable motors\n; # # # # # # END Footer\n From 99861f1b6ec3793025d528f0badb63e837f8c808 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 17 Mar 2022 14:20:35 +0100 Subject: [PATCH 28/40] SPE-1207 - Extensions in Open/Save/Export dialogs - alternative implementation for file_wildcards() --- src/libslic3r/Technologies.hpp | 2 ++ src/slic3r/GUI/GUI_App.cpp | 40 ++++++++++++++++++++++++++++++++++ src/slic3r/GUI/GUI_App.hpp | 4 ++++ src/slic3r/GUI/Plater.cpp | 8 ++++++- 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 635fc49943..2ce7079fe1 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -84,6 +84,8 @@ #define ENABLE_NEW_CAMERA_MOVEMENTS (1 && ENABLE_2_5_0_ALPHA1) // Enable modified rectangle selection #define ENABLE_NEW_RECTANGLE_SELECTION (1 && ENABLE_2_5_0_ALPHA1) +// Enable alternative version of file_wildcards() +#define ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR (1 && ENABLE_2_5_0_ALPHA1) #endif // _prusaslicer_technologies_h_ diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 87913fb812..ee91994252 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -499,6 +499,44 @@ static const FileWildcards file_wildcards_by_type[FT_SIZE] = { /* FT_SL1 */ { "Masked SLA files"sv, { ".sl1"sv, ".sl1s"sv, ".pwmx"sv } }, }; +#if ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR +wxString file_wildcards(FileType file_type) +{ + const FileWildcards& data = file_wildcards_by_type[file_type]; + std::string title; + std::string mask; + + // Generate cumulative first item + for (const std::string_view& ext : data.file_extensions) { + if (title.empty()) { + title = "*"; + title += ext; + mask = title; + } + else { + title += ", *"; + title += ext; + mask += ";*"; + mask += ext; + } + mask += ";*"; + mask += boost::to_upper_copy(std::string(ext)); + } + + wxString ret = GUI::format_wxstr("%s (%s)|%s", data.title, title, mask); + + // Adds an item for each of the extensions + if (data.file_extensions.size() > 1) { + for (const std::string_view& ext : data.file_extensions) { + title = "*"; + title += ext; + ret += GUI::format_wxstr("|%s (%s)|%s", data.title, title, title); + } + } + + return ret; +} +#else // This function produces a Win32 file dialog file template mask to be consumed by wxWidgets on all platforms. // The function accepts a custom extension parameter. If the parameter is provided, the custom extension // will be added as a fist to the list. This is important for a "file save" dialog on OSX, which strips @@ -551,8 +589,10 @@ wxString file_wildcards(FileType file_type, const std::string &custom_extension) mask += ";*"; mask += boost::to_upper_copy(std::string(ext)); } + return GUI::format_wxstr("%s (%s)|%s", data.title, title, mask); } +#endif // ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR static std::string libslic3r_translate_callback(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str().data(); } diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 8b4177a8d7..f93728d2e3 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -71,7 +71,11 @@ enum FileType FT_SIZE, }; +#if ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR +extern wxString file_wildcards(FileType file_type); +#else extern wxString file_wildcards(FileType file_type, const std::string &custom_extension = std::string{}); +#endif // ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR enum ConfigMenuIDs { ConfigMenuWizard, diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index fc8ba23c51..daee3b0533 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -5919,11 +5919,17 @@ void Plater::export_gcode(bool prefer_removable) fs::path output_path; { - std::string ext = default_output_file.extension().string(); +#if !ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR + std::string ext = default_output_file.extension().string(); +#endif // !ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR wxFileDialog dlg(this, (printer_technology() == ptFFF) ? _L("Save G-code file as:") : _L("Save SL1 / SL1S file as:"), start_dir, from_path(default_output_file.filename()), +#if ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR + GUI::file_wildcards((printer_technology() == ptFFF) ? FT_GCODE : FT_SL1), +#else GUI::file_wildcards((printer_technology() == ptFFF) ? FT_GCODE : FT_SL1, ext), +#endif // ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if (dlg.ShowModal() == wxID_OK) { From 8d5dd759ada887ca733f2cb689eccd6df1a6c88c Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 17 Mar 2022 14:31:14 +0100 Subject: [PATCH 29/40] SPE-1208 - Fix for 3mf from another SW is loaded as a project and not as geometry --- src/slic3r/GUI/Plater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index daee3b0533..df593f1300 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -5566,7 +5566,7 @@ bool Plater::load_files(const wxArrayString& filenames) if (!model().objects.empty()) { if ((boost::algorithm::iends_with(filename, ".3mf") && !is_project_3mf(it->string())) || (boost::algorithm::iends_with(filename, ".amf") && !boost::algorithm::iends_with(filename, ".zip.amf"))) - load_type = LoadType::OpenProject; + load_type = LoadType::LoadGeometry; else { if (wxGetApp().app_config->get("show_drop_project_dialog") == "1") { ProjectDropDialog dlg(filename); From fb22612d0d422c6dfe88610a40fa207b7ad3ab1c Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 17 Mar 2022 15:12:03 +0100 Subject: [PATCH 30/40] Tech ENABLE_SPIRAL_VASE_LAYERS set as default --- src/libslic3r/GCode/GCodeProcessor.cpp | 14 -------------- src/libslic3r/GCode/GCodeProcessor.hpp | 4 ---- src/libslic3r/Technologies.hpp | 2 -- src/slic3r/GUI/GCodeViewer.cpp | 2 -- 4 files changed, 22 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 3bf7c4ffd3..0c9d495446 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -737,9 +737,7 @@ void GCodeProcessorResult::reset() { filament_diameters = std::vector(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DIAMETER); filament_densities = std::vector(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DENSITY); custom_gcode_per_print_z = std::vector(); -#if ENABLE_SPIRAL_VASE_LAYERS spiral_vase_layers = std::vector>>(); -#endif // ENABLE_SPIRAL_VASE_LAYERS time = 0; } #else @@ -755,9 +753,7 @@ void GCodeProcessorResult::reset() { filament_diameters = std::vector(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DIAMETER); filament_densities = std::vector(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DENSITY); custom_gcode_per_print_z = std::vector(); -#if ENABLE_SPIRAL_VASE_LAYERS spiral_vase_layers = std::vector>>(); -#endif // ENABLE_SPIRAL_VASE_LAYERS } #endif // ENABLE_GCODE_VIEWER_STATISTICS @@ -905,11 +901,9 @@ void GCodeProcessor::apply_config(const PrintConfig& config) m_result.max_print_height = config.max_print_height; -#if ENABLE_SPIRAL_VASE_LAYERS const ConfigOptionBool* spiral_vase = config.option("spiral_vase"); if (spiral_vase != nullptr) m_spiral_vase_active = spiral_vase->value; -#endif // ENABLE_SPIRAL_VASE_LAYERS #if ENABLE_Z_OFFSET_CORRECTION const ConfigOptionFloat* z_offset = config.option("z_offset"); @@ -1160,11 +1154,9 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config) if (max_print_height != nullptr) m_result.max_print_height = max_print_height->value; -#if ENABLE_SPIRAL_VASE_LAYERS const ConfigOptionBool* spiral_vase = config.option("spiral_vase"); if (spiral_vase != nullptr) m_spiral_vase_active = spiral_vase->value; -#endif // ENABLE_SPIRAL_VASE_LAYERS #if ENABLE_Z_OFFSET_CORRECTION const ConfigOptionFloat* z_offset = config.option("z_offset"); @@ -1238,9 +1230,7 @@ void GCodeProcessor::reset() m_options_z_corrector.reset(); -#if ENABLE_SPIRAL_VASE_LAYERS m_spiral_vase_active = false; -#endif // ENABLE_SPIRAL_VASE_LAYERS #if ENABLE_GCODE_VIEWER_DATA_CHECKING m_mm3_per_mm_compare.reset(); @@ -1950,7 +1940,6 @@ void GCodeProcessor::process_tags(const std::string_view comment, bool producers // layer change tag if (comment == reserved_tag(ETags::Layer_Change)) { ++m_layer_id; -#if ENABLE_SPIRAL_VASE_LAYERS if (m_spiral_vase_active) { if (m_result.moves.empty()) m_result.spiral_vase_layers.push_back({ m_first_layer_height, { 0, 0 } }); @@ -1962,7 +1951,6 @@ void GCodeProcessor::process_tags(const std::string_view comment, bool producers m_result.spiral_vase_layers.push_back({ static_cast(m_end_position[Z]), { move_id, move_id } }); } } -#endif // ENABLE_SPIRAL_VASE_LAYERS return; } @@ -2772,10 +2760,8 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line) m_seams_detector.set_first_vertex(m_result.moves.back().position - m_extruder_offsets[m_extruder_id]); } -#if ENABLE_SPIRAL_VASE_LAYERS if (m_spiral_vase_active && !m_result.spiral_vase_layers.empty() && !m_result.moves.empty()) m_result.spiral_vase_layers.back().second.second = m_result.moves.size() - 1; -#endif // ENABLE_SPIRAL_VASE_LAYERS // store move store_move_vertex(type); diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index 25375f61b6..e04caa6e22 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -131,9 +131,7 @@ namespace Slic3r { std::vector filament_densities; PrintEstimatedStatistics print_statistics; std::vector custom_gcode_per_print_z; -#if ENABLE_SPIRAL_VASE_LAYERS std::vector>> spiral_vase_layers; -#endif // ENABLE_SPIRAL_VASE_LAYERS #if ENABLE_GCODE_VIEWER_STATISTICS int64_t time{ 0 }; @@ -559,9 +557,7 @@ namespace Slic3r { SeamsDetector m_seams_detector; OptionsZCorrector m_options_z_corrector; size_t m_last_default_color_id; -#if ENABLE_SPIRAL_VASE_LAYERS bool m_spiral_vase_active; -#endif // ENABLE_SPIRAL_VASE_LAYERS #if ENABLE_GCODE_VIEWER_STATISTICS std::chrono::time_point m_start_time; #endif // ENABLE_GCODE_VIEWER_STATISTICS diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 2ce7079fe1..de54e65091 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -41,8 +41,6 @@ //================ #define ENABLE_2_4_1_RC 1 -// Enable detection of layers for spiral vase prints -#define ENABLE_SPIRAL_VASE_LAYERS (1 && ENABLE_2_4_1_RC) // Enable correction of toolpaths when z offset is set #define ENABLE_Z_OFFSET_CORRECTION (1 && ENABLE_2_4_1_RC) diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index d33004f494..5372d4565b 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -2313,7 +2313,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) sort_remove_duplicates(m_extruder_ids); m_extruder_ids.shrink_to_fit(); -#if ENABLE_SPIRAL_VASE_LAYERS // replace layers for spiral vase mode if (!gcode_result.spiral_vase_layers.empty()) { m_layers.reset(); @@ -2321,7 +2320,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) m_layers.append(layer.first, { layer.second.first, layer.second.second }); } } -#endif // ENABLE_SPIRAL_VASE_LAYERS // set layers z range if (!m_layers.empty()) From 493050a279038ef5d70273b352131e6eadd90a3d Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 17 Mar 2022 15:29:18 +0100 Subject: [PATCH 31/40] Removed redundant line of code --- src/slic3r/GUI/GUI_Preview.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 2cac5e3566..1488ffb2e5 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -1040,7 +1040,6 @@ void Preview::load_print_as_sla() if (IsShown()) { m_canvas->load_sla_preview(); m_left_sizer->Hide(m_bottom_toolbar_panel); - m_left_sizer->Hide(m_bottom_toolbar_panel); m_left_sizer->Layout(); Refresh(); From 45e4d905043b2321fed005e40e37b7527dd644a3 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 17 Mar 2022 15:44:03 +0100 Subject: [PATCH 32/40] GCodeViewer - Hide bottom toolbar when loading a new gcode file --- src/slic3r/GUI/GUI_Preview.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 1488ffb2e5..3eec8f823e 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -966,6 +966,11 @@ void Preview::load_print_as_fff(bool keep_z_range) Refresh(); zs = m_canvas->get_volumes_print_zs(true); } + else { + m_left_sizer->Hide(m_bottom_toolbar_panel); + m_left_sizer->Layout(); + Refresh(); + } if (!zs.empty() && !m_keep_current_preview_type) { unsigned int number_extruders = wxGetApp().is_editor() ? From b56874e9fe322ffc8a5029644bf889b3ca47a43f Mon Sep 17 00:00:00 2001 From: rtyr <36745189+rtyr@users.noreply.github.com> Date: Thu, 17 Mar 2022 23:07:01 +0100 Subject: [PATCH 33/40] Sync with PrusaSlicer-settings 1.0.2 --- resources/profiles/Ultimaker.idx | 1 + resources/profiles/Ultimaker.ini | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/profiles/Ultimaker.idx b/resources/profiles/Ultimaker.idx index 8e119931c1..605b87e071 100644 --- a/resources/profiles/Ultimaker.idx +++ b/resources/profiles/Ultimaker.idx @@ -1,3 +1,4 @@ min_slic3r_version = 2.4.0-beta0 +1.0.2 Fixed start g-code. 1.0.1 Updated start g-code. 1.0.0 Initial version diff --git a/resources/profiles/Ultimaker.ini b/resources/profiles/Ultimaker.ini index 1aeeab0a15..f3e30db400 100644 --- a/resources/profiles/Ultimaker.ini +++ b/resources/profiles/Ultimaker.ini @@ -9,7 +9,7 @@ name = Ultimaker # Configuration version of this file. Config file will only be installed, if the config_version differs. # This means, the server may force the PrusaSlicer configuration to be downgraded. -config_version = 1.0.1 +config_version = 1.0.2 # Where to get the updates from? config_update_url = https://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/Ultimaker/ @@ -396,5 +396,5 @@ printer_notes = Dont remove the following keywords! These keywords are used in t nozzle_diameter = 0.4 default_print_profile = 0.20mm NORMAL @ULTIMAKER2 default_filament_profile = Generic PLA @ULTIMAKER2 -start_gcode = start_gcode = ; Printer_Settings_ID: [printer_settings_id]\n\n; # # # # # # START Header\nG21 ; metric values\nG90 ; absolute positioning\nM82 ; set extruder to absolute mode\nM107 ; start with the fan off\n\nM140 S[first_layer_bed_temperature] ; start bed heating\n\nG28 X0 Y0 Z0 ; move X/Y/Z to endstops\nG1 X1 Y6 F15000 ; move X/Y to start position\nG1 Z35 F9000 ; move Z to start position\n\n; Wait for bed and nozzle temperatures\nM190 S{first_layer_bed_temperature[0] - 5} ; wait for bed temperature - 5\nM140 S[first_layer_bed_temperature] ; continue bed heating\nM109 S[first_layer_temperature] ; wait for nozzle temperature\n\n; Purge and prime\nM83 ; set extruder to relative mode\nG92 E0 ; reset extrusion distance\nG0 X0 Y1 F10000\nG1 F150 E20 Y10 ; compress the bowden tube\nG1 E-8 F1200\nG0 X30 Y1 F5000 \nG0 F1200 Z{first_layer_height/2} ; Cut the connection to priming blob\nG0 X100 F10000 ; disconnect with the prime blob\nG0 X50 ; Avoid the metal clip holding the Ultimaker glass plate\nG0 Z0.2 F720\nG1 E8 F1200\nG1 X80 E3 F1000 ; intro line 1\nG1 X110 E4 F1000 ; intro line 2\nG1 X140 F600 ; drag filament to decompress bowden tube\nG1 X100 F3200 ; wipe backwards a bit\nG1 X150 F3200 ; back to where there is no plastic: avoid dragging\nG92 E0 ; reset extruder reference\nM82 ; set extruder to absolute mode\n\n; # # # # # # END Header +start_gcode = ; Printer_Settings_ID: [printer_settings_id]\n\n; # # # # # # START Header\nG21 ; metric values\nG90 ; absolute positioning\nM82 ; set extruder to absolute mode\nM107 ; start with the fan off\n\nM140 S[first_layer_bed_temperature] ; start bed heating\n\nG28 X0 Y0 Z0 ; move X/Y/Z to endstops\nG1 X1 Y6 F15000 ; move X/Y to start position\nG1 Z35 F9000 ; move Z to start position\n\n; Wait for bed and nozzle temperatures\nM190 S{first_layer_bed_temperature[0] - 5} ; wait for bed temperature - 5\nM140 S[first_layer_bed_temperature] ; continue bed heating\nM109 S[first_layer_temperature] ; wait for nozzle temperature\n\n; Purge and prime\nM83 ; set extruder to relative mode\nG92 E0 ; reset extrusion distance\nG0 X0 Y1 F10000\nG1 F150 E20 ; compress the bowden tube\nG1 E-8 F1200\nG0 X30 Y1 F5000 \nG0 F1200 Z{first_layer_height/2} ; Cut the connection to priming blob\nG0 X100 F10000 ; disconnect with the prime blob\nG0 X50 ; Avoid the metal clip holding the Ultimaker glass plate\nG0 Z0.2 F720\nG1 E8 F1200\nG1 X80 E3 F1000 ; intro line 1\nG1 X110 E4 F1000 ; intro line 2\nG1 X140 F600 ; drag filament to decompress bowden tube\nG1 X100 F3200 ; wipe backwards a bit\nG1 X150 F3200 ; back to where there is no plastic: avoid dragging\nG92 E0 ; reset extruder reference\nM82 ; set extruder to absolute mode\n\n; # # # # # # END Header end_gcode = ; # # # # # # START Footer\nG91 ; relative coordinates\n;G1 E-1 F1200 ; retract the filament\nG1 Z+15 X-10 Y-10 E-7 F6000 ; move Z a bit\n; G1 X-10 Y-10 F6000 ; move XY a bit\nG1 E-5.5 F300 ; retract the filament\nG28 X0 Y0 ; move X/Y to min endstops, so the head is out of the way\nM104 S0 ; extruder heater off\nM140 S0 ; heated bed heater off (if you have it)\nM84 ; disable motors\n; # # # # # # END Footer\n From a7d466dc7cb4da8cd3c5b6869b560fa8efc54fa8 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Fri, 18 Mar 2022 08:32:35 +0100 Subject: [PATCH 34/40] Tech ENABLE_Z_OFFSET_CORRECTION set as default --- src/libslic3r/GCode/GCodeProcessor.cpp | 14 -------------- src/libslic3r/GCode/GCodeProcessor.hpp | 2 -- src/libslic3r/Technologies.hpp | 9 --------- 3 files changed, 25 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 0c9d495446..43a5f1eb0a 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -905,11 +905,9 @@ void GCodeProcessor::apply_config(const PrintConfig& config) if (spiral_vase != nullptr) m_spiral_vase_active = spiral_vase->value; -#if ENABLE_Z_OFFSET_CORRECTION const ConfigOptionFloat* z_offset = config.option("z_offset"); if (z_offset != nullptr) m_z_offset = z_offset->value; -#endif // ENABLE_Z_OFFSET_CORRECTION } void GCodeProcessor::apply_config(const DynamicPrintConfig& config) @@ -1158,11 +1156,9 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config) if (spiral_vase != nullptr) m_spiral_vase_active = spiral_vase->value; -#if ENABLE_Z_OFFSET_CORRECTION const ConfigOptionFloat* z_offset = config.option("z_offset"); if (z_offset != nullptr) m_z_offset = z_offset->value; -#endif // ENABLE_Z_OFFSET_CORRECTION } void GCodeProcessor::enable_stealth_time_estimator(bool enabled) @@ -1195,9 +1191,7 @@ void GCodeProcessor::reset() m_forced_height = 0.0f; m_mm3_per_mm = 0.0f; m_fan_speed = 0.0f; -#if ENABLE_Z_OFFSET_CORRECTION m_z_offset = 0.0f; -#endif // ENABLE_Z_OFFSET_CORRECTION m_extrusion_role = erNone; m_extruder_id = 0; @@ -2743,11 +2737,7 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line) // the threshold value = 0.0625f == 0.25 * 0.25 is arbitrary, we may find some smarter condition later if ((new_pos - *first_vertex).squaredNorm() < 0.0625f) { -#if ENABLE_Z_OFFSET_CORRECTION set_end_position(0.5f * (new_pos + *first_vertex) + m_z_offset * Vec3f::UnitZ()); -#else - set_end_position(0.5f * (new_pos + *first_vertex)); -#endif // ENABLE_Z_OFFSET_CORRECTION store_move_vertex(EMoveType::Seam); set_end_position(curr_pos); } @@ -3279,11 +3269,7 @@ void GCodeProcessor::store_move_vertex(EMoveType type) m_extrusion_role, m_extruder_id, m_cp_color.current, -#if ENABLE_Z_OFFSET_CORRECTION Vec3f(m_end_position[X], m_end_position[Y], m_processing_start_custom_gcode ? m_first_layer_height : m_end_position[Z] - m_z_offset) + m_extruder_offsets[m_extruder_id], -#else - Vec3f(m_end_position[X], m_end_position[Y], m_processing_start_custom_gcode ? m_first_layer_height : m_end_position[Z]) + m_extruder_offsets[m_extruder_id], -#endif // ENABLE_Z_OFFSET_CORRECTION static_cast(m_end_position[E] - m_start_position[E]), m_feedrate, m_width, diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index e04caa6e22..5ca8f0b026 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -540,9 +540,7 @@ namespace Slic3r { float m_forced_height; // mm float m_mm3_per_mm; float m_fan_speed; // percentage -#if ENABLE_Z_OFFSET_CORRECTION float m_z_offset; // mm -#endif // ENABLE_Z_OFFSET_CORRECTION ExtrusionRole m_extrusion_role; unsigned char m_extruder_id; ExtruderColors m_extruder_colors; diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index de54e65091..8e6a3cb86c 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -36,15 +36,6 @@ #define ENABLE_SMOOTH_NORMALS 0 -//================ -// 2.4.1.rc techs -//================ -#define ENABLE_2_4_1_RC 1 - -// Enable correction of toolpaths when z offset is set -#define ENABLE_Z_OFFSET_CORRECTION (1 && ENABLE_2_4_1_RC) - - //==================== // 2.5.0.alpha1 techs //==================== From f3d92bdeff0cb6f5c1685e9910a26418cef1e45e Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 18 Mar 2022 10:25:00 +0100 Subject: [PATCH 35/40] Fixup of 5de93c8 (incorrectly solved merge conflict) --- src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index e8c2055f63..4007f0cb0b 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -154,7 +154,7 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking) Geometry::Transformation transformation(vol->get_instance_transformation().get_matrix() * vol->get_volume_transformation().get_matrix()); const Transform3d& instance_scaling_matrix_inverse = transformation.get_matrix(true, true, false, true).inverse(); #if ENABLE_GL_SHADERS_ATTRIBUTES - const Transform3d instance_matrix = Geometry::assemble_transform(m_c->selection_info()->get_sla_shift() * Vec3d::UnitZ()) * vol->get_instance_transformation().get_matrix(); + const Transform3d instance_matrix = Geometry::assemble_transform(m_c->selection_info()->get_sla_shift() * Vec3d::UnitZ()) * transformation.get_matrix(); const Camera& camera = wxGetApp().plater()->get_camera(); const Transform3d& view_matrix = camera.get_view_matrix(); const Transform3d& projection_matrix = camera.get_projection_matrix(); From b094ea3c9aca7d91a505d3811c430f1861fe052b Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 18 Mar 2022 12:52:14 +0100 Subject: [PATCH 36/40] Added github issue template form --- .github/ISSUE_TEMPLATE/bug_report_form.yml | 65 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 9 +++ .github/ISSUE_TEMPLATE/feature_request.md | 20 +++++++ 3 files changed, 94 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report_form.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report_form.yml b/.github/ISSUE_TEMPLATE/bug_report_form.yml new file mode 100644 index 0000000000..7cbaddc49f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report_form.yml @@ -0,0 +1,65 @@ +name: Bug Report +description: File a bug report +body: + - type: markdown + attributes: + value: | + Before filing, please check if the issue already exists (either open or closed) by using the search bar on the issues page. If it does, comment there. Even if it's closed, we can reopen it based on your comment. + - type: textarea + id: what-happened + attributes: + label: Description of the bug + description: What happened? Please, enclose a screenshot whenever possible (even when you think the description is clear). What did you expect to happen? In case of 3D rendering issues, please attach the content of menu Help -> System Info dialog. + placeholder: | + What is the problem? + What did you expect? + You paste or drop screenshots here + validations: + required: true + - type: textarea + id: to_reproduce + attributes: + label: Project file & How to reproduce + description: "*Please* upload a ZIP archive containing the project file used when the problem arise. Please export it just before the problem occurs. Even if you did nothing and/or there is no object, export it! (it contains your current configuration)." + placeholder: | + `File`->`Export project as...` then zip it & drop it here + Also, if needed include the steps to reproduce the bug: + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + validations: + required: true + - type: checkboxes + attributes: + label: Checklist of files included above + options: + - label: Project file + - label: Screenshot + validations: + required: true + - type: input + id: version + attributes: + label: Version of PrusaSlicer + description: What version of PrusaSlicer are you running? You can see the full version in `Help` -> `About PrusaSlicer`. + placeholder: e.g. 2.4.1-alpha2-win64 / 2.3.3-linux / 2.4.1-alpha0+61-win64-gcd2459455 ... + validations: + required: true + - type: input + id: os + attributes: + label: Operating system + description: with the version if possible + placeholder: e.g. Windows 7/8/10/11 ... , Ubuntu 22.04/Debian ... , macOS 10.15/11.1 ... + validations: + required: true + - type: input + id: printer + attributes: + label: Printer model + description: Please, fill this in even when it seems irrelevant. + placeholder: voron 2.4 with afterburner + validations: + required: true + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000..d373b69eea --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,9 @@ +contact_links: + - name: PrusaSlicer Manual and Support + url: https://help.prusa3d.com/en/article/customer-support_2287/ + about: If you are not sure that what you are reporting is really a bug, please, consult the manual first. + - name: PrusaPrinters Forum + url: https://forum.prusaprinters.org/forum/prusaslicer/ + about: Please get in touch on our PrusaPrinters Community Forum! (Not an official support channel.) + +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000000..aed1846872 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe how it would work** +Be as descriptive as your skill level allows you. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or paint drawing about the feature request here. From 8ce9241c48605d192f36f3fa22d4b1e98e1ce662 Mon Sep 17 00:00:00 2001 From: Jebtrix Date: Sat, 29 Jan 2022 11:44:25 -0500 Subject: [PATCH 37/40] Set CMAKE_GENERATOR environment variable to ensure MSVC version used --- build_win.bat | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build_win.bat b/build_win.bat index de5030ee50..3dbdb0ad6e 100644 --- a/build_win.bat +++ b/build_win.bat @@ -164,6 +164,9 @@ IF NOT EXIST "%MSVC_DIR%" ( @ECHO ERROR: Compatible Visual Studio installation not found. 1>&2 GOTO :HELP ) +REM Cmake always defaults to latest supported MSVC generator. Let's make sure it uses what we select. +FOR /F "tokens=* USEBACKQ" %%I IN (`^""%VSWHERE%" %MSVC_FILTER% -nologo -property catalog_productLineVersion^"`) DO SET PS_PRODUCT_VERSION=%%I + REM Give the user a chance to cancel if we found something odd. IF "%PS_ASK_TO_CONTINUE%" EQU "" GOTO :BUILD_ENV @ECHO. @@ -183,6 +186,7 @@ SET PS_CURRENT_STEP=environment @ECHO ** Deps path: %PS_DESTDIR% @ECHO ** Using Microsoft Visual Studio installation found at: @ECHO ** %MSVC_DIR% +SET CMAKE_GENERATOR=Visual Studio %PS_VERSION% %PS_PRODUCT_VERSION% CALL "%MSVC_DIR%\Common7\Tools\vsdevcmd.bat" -arch=%PS_ARCH% -host_arch=%PS_ARCH_HOST% -app_platform=Desktop IF %ERRORLEVEL% NEQ 0 GOTO :END REM Need to reset the echo state after vsdevcmd.bat clobbers it. From 8a340a0cf72e6e6367da48be64a52b5ce836909f Mon Sep 17 00:00:00 2001 From: rtyr <36745189+rtyr@users.noreply.github.com> Date: Fri, 18 Mar 2022 15:39:30 +0100 Subject: [PATCH 38/40] Sync with PrusaSlicer-settings --- resources/profiles/Anycubic.idx | 1 + resources/profiles/Anycubic.ini | 101 +------------------------------- 2 files changed, 4 insertions(+), 98 deletions(-) diff --git a/resources/profiles/Anycubic.idx b/resources/profiles/Anycubic.idx index 47bdd8c271..232d534256 100644 --- a/resources/profiles/Anycubic.idx +++ b/resources/profiles/Anycubic.idx @@ -1,4 +1,5 @@ min_slic3r_version = 2.4.1-rc1 +0.1.1 Fixed before layer change g-code for Mega Zero. 0.1.0 Added Anycubic 4Max Pro 2.0 min_slic3r_version = 2.3.2-alpha0 0.0.12 Updated Anycubic i3 MEGA(S) profiles. diff --git a/resources/profiles/Anycubic.ini b/resources/profiles/Anycubic.ini index fd73c063e8..5640560411 100644 --- a/resources/profiles/Anycubic.ini +++ b/resources/profiles/Anycubic.ini @@ -5,7 +5,7 @@ name = Anycubic # Configuration version of this file. Config file will only be installed, if the config_version differs. # This means, the server may force the PrusaSlicer configuration to be downgraded. -config_version = 0.1.0 +config_version = 0.1.1 # Where to get the updates from? config_update_url = https://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/Anycubic/ # changelog_url = https://files.prusa3d.com/?latest=slicer-profiles&lng=%1% @@ -73,13 +73,6 @@ technology = FFF family = PREDATOR default_materials = Generic PLA @PREDATOR; Generic PETG @PREDATOR; Generic ABS @PREDATOR -[printer_model:PHOTON MONO X] -name = Photon Mono X -variants = default -technology = SLA -family = PHOTON MONO -default_materials = Generic Blue Resin @MONO 0.05 - # All presets starting with asterisk, for example *common*, are intermediate and they will # not make it into the user interface. @@ -742,7 +735,7 @@ filament_density = 1.27 [printer:*common_mega0*] printer_technology = FFF bed_shape = 0x0,220x0,220x220,0x220 -before_layer_gcode = ; BEFORE_LAYER_CHANGE [layer_num] @ [layer_z]mm +before_layer_gcode = ; BEFORE_LAYER_CHANGE [layer_num] @ [layer_z]mm\nG92 E0 between_objects_gcode = deretract_speed = 0 extruder_colour = #FFFF00 @@ -2238,92 +2231,4 @@ use_relative_e_distances = 0 use_volumetric_e = 0 variable_layer_height = 1 wipe = 0 -z_offset = 0 - -########## SLA printer presets ########## - -[sla_print:*common print ANYCUBIC SLA*] -compatible_printers_condition = printer_notes=~/.*PHOTONMONOX.*/ -layer_height = 0.05 -output_filename_format = [input_filename_base].pwmx -pad_edge_radius = 0.5 -pad_enable = 0 -pad_max_merge_distance = 50 -pad_wall_height = 0 -pad_wall_thickness = 1 -pad_wall_slope = 45 -faded_layers = 8 -slice_closing_radius = 0.005 -support_base_diameter = 3 -support_base_height = 1 -support_critical_angle = 45 -support_density_at_45 = 250 -support_density_at_horizontal = 500 -support_head_front_diameter = 0.4 -support_head_penetration = 0.4 -support_head_width = 3 -support_max_bridge_length = 10 -support_minimal_z = 0 -support_object_elevation = 5 -support_pillar_diameter = 1 -support_pillar_connection_mode = zigzag -support_pillar_widening_factor = 0 -supports_enable = 1 -support_small_pillar_diameter_percent = 60% - -[sla_print:0.05 Normal @ANYCUBIC] -inherits = *common print ANYCUBIC SLA* -layer_height = 0.05 - -########### Materials - -[sla_material:*common ANYCUBIC SLA*] -compatible_printers_condition = printer_notes=~/.*PHOTONMONOX.*/ -compatible_prints_condition = layer_height == 0.05 -exposure_time = 7 -initial_exposure_time = 40 -initial_layer_height = 0.05 -material_correction = 1,1,1 -material_notes = LIFT_DISTANCE=8.0\nLIFT_SPEED=2.5\nRETRACT_SPEED=3.0\nBOTTOM_LIFT_SPEED=2.0\nBOTTOM_LIFT_DISTANCE=9.0\nDELAY_BEFORE_EXPOSURE=0.5 - -[sla_material:*common 0.05 ANYCUBIC SLA*] -inherits = *common ANYCUBIC SLA* - -[sla_material:Generic Blue Resin @MONO 0.05] -inherits = *common 0.05 ANYCUBIC SLA* -exposure_time = 2.5 -initial_exposure_time = 40 -material_type = Tough -material_vendor = Generic -material_colour = #6080EC -compatible_printers_condition = printer_notes=~/.*PHOTONMONOX.*/ - -########## Printers - -[printer:Anycubic Photon Mono X] -printer_technology = SLA -printer_model = PHOTON MONO X -printer_variant = default -default_sla_material_profile = Generic Blue Resin @MONO 0.05 -default_sla_print_profile = 0.05 Normal @ANYCUBIC -thumbnails = 224x168 -sla_archive_format = pwmx -bed_shape = 1.48x1.02,193.48x1.02,193.48x121.02,1.48x121.02 -display_height = 120 -display_orientation = landscape -display_mirror_x = 1 -display_mirror_y = 0 -display_pixels_x = 3840 -display_pixels_y = 2400 -display_width = 192 -max_print_height = 245 -elefant_foot_compensation = 0.2 -elefant_foot_min_width = 0.2 -min_exposure_time = 1 -max_exposure_time = 120 -min_initial_exposure_time = 1 -max_initial_exposure_time = 300 -printer_correction = 1,1,1 -gamma_correction = 1 -area_fill = 45 -printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.'\nPRINTER_VENDOR_ANYCUBIC\nPRINTER_MODEL_PHOTONMONOX\n +z_offset = 0 \ No newline at end of file From b263ab9a8ea19fb8c965cb4568fdf775212c463d Mon Sep 17 00:00:00 2001 From: rtyr <36745189+rtyr@users.noreply.github.com> Date: Fri, 18 Mar 2022 15:42:15 +0100 Subject: [PATCH 39/40] Readded Photon MONO X --- resources/profiles/Anycubic.ini | 4563 ++++++++++++++++--------------- 1 file changed, 2329 insertions(+), 2234 deletions(-) diff --git a/resources/profiles/Anycubic.ini b/resources/profiles/Anycubic.ini index 5640560411..e8fd89bf4a 100644 --- a/resources/profiles/Anycubic.ini +++ b/resources/profiles/Anycubic.ini @@ -1,2234 +1,2329 @@ -# Print profiles for the Anycubic printers. - -[vendor] -# Vendor name will be shown by the Config Wizard. -name = Anycubic -# Configuration version of this file. Config file will only be installed, if the config_version differs. -# This means, the server may force the PrusaSlicer configuration to be downgraded. -config_version = 0.1.1 -# Where to get the updates from? -config_update_url = https://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/Anycubic/ -# changelog_url = https://files.prusa3d.com/?latest=slicer-profiles&lng=%1% - -# The printer models will be shown by the Configuration Wizard in this order, -# also the first model installed & the first nozzle installed will be activated after install. -# Printer model name will be shown by the installation wizard. - -[printer_model:AKLP] -name = Anycubic Kossel Linear Plus -variants = 0.4 -technology = FFF -family = KOSSEL -bed_model = AKLP_Bed.stl -bed_texture = AK.svg -default_materials = Generic PLA @AKOSSEL; Generic PETG @AKOSSEL; Generic ABS @AKOSSEL - -[printer_model:AK] -name = Anycubic Kossel Pulley (Linear) -variants = 0.4 -technology = FFF -family = KOSSEL -bed_model = AK_Bed.stl -bed_texture = AK.svg -default_materials = Generic PLA @AKOSSEL; Generic PETG @AKOSSEL; Generic ABS @AKOSSEL - -[printer_model:MEGA0] -name = Anycubic Mega Zero -variants = 0.4 -technology = FFF -family = MEGA -bed_model = mega0_bed.stl -bed_texture = mega0.svg -default_materials = Generic PLA @MEGA0; Generic PETG @MEGA0; Anycubic PLA @MEGA0; Prusament PLA @MEGA0; Prusament PETG @MEGA0 - -[printer_model:I3MEGA] -name = Anycubic i3 Mega -variants = 0.4 -technology = FFF -family = MEGA -bed_model = i3megas_bed.stl -bed_texture = i3megas.svg - -[printer_model:I3MEGAS] -name = Anycubic i3 Mega S -variants = 0.4 -technology = FFF -family = MEGA -bed_model = i3megas_bed.stl -bed_texture = i3megas.svg - -[printer_model:4MAXPRO20] -name = Anycubic 4Max Pro 2.0 -variants = 0.4 -technology = FFF -family = 4Max -bed_model = 4MAXPRO20_bed.stl -bed_texture = 4MAXPRO20_texture.svg -default_materials = Generic PLA @4Max Pro 2.0; Generic TPU @4Max Pro 2.0; Generic ABS @4Max Pro 2.0 - -[printer_model:PREDATOR] -name = Anycubic Predator -variants = 0.4; 0.6; 0.8 -technology = FFF -family = PREDATOR -default_materials = Generic PLA @PREDATOR; Generic PETG @PREDATOR; Generic ABS @PREDATOR - -# All presets starting with asterisk, for example *common*, are intermediate and they will -# not make it into the user interface. - -## Anycubic KOSSEL -## Author: https://github.com/tc0fh -## Initial PR: https://github.com/prusa3d/PrusaSlicer/pull/4220 - -# Common print preset -[print:*common_akossel*] -avoid_crossing_perimeters = 0 -bottom_solid_min_thickness = 0.5 -bridge_angle = 0 -bridge_flow_ratio = 0.8 -bridge_speed = 30 -brim_width = 0 -clip_multipart_objects = 1 -compatible_printers = -complete_objects = 0 -dont_support_bridges = 1 -elefant_foot_compensation = 0 -ensure_vertical_shell_thickness = 1 -external_fill_pattern = rectilinear -external_perimeters_first = 0 -external_perimeter_extrusion_width = 0.45 -extra_perimeters = 0 -extruder_clearance_height = 25 -extruder_clearance_radius = 45 -extrusion_width = 0.45 -fill_angle = 45 -fill_density = 20% -fill_pattern = grid -first_layer_extrusion_width = 0.42 -first_layer_height = 0.2 -first_layer_speed = 20 -gap_fill_speed = 40 -gcode_comments = 0 -infill_every_layers = 1 -infill_extruder = 1 -infill_extrusion_width = 0.45 -infill_first = 0 -infill_only_where_needed = 0 -infill_overlap = 25% -interface_shells = 0 -max_print_speed = 200 -max_volumetric_extrusion_rate_slope_negative = 0 -max_volumetric_extrusion_rate_slope_positive = 0 -max_volumetric_speed = 0 -min_skirt_length = 4 -notes = -overhangs = 0 -only_retract_when_crossing_perimeters = 0 -ooze_prevention = 0 -output_filename_format = {input_filename_base}_{layer_height}mm_{filament_type[0]}_{printer_model}_{print_time}.gcode -perimeters = 2 -perimeter_extruder = 1 -perimeter_extrusion_width = 0.45 -perimeter_speed = 45 -post_process = -print_settings_id = -raft_layers = 0 -resolution = 0 -seam_position = nearest -single_extruder_multi_material_priming = 0 -skirts = 2 -skirt_distance = 5 -skirt_height = 1 -small_perimeter_speed = 25 -solid_infill_below_area = 0 -solid_infill_every_layers = 0 -solid_infill_extruder = 1 -solid_infill_extrusion_width = 0.45 -spiral_vase = 0 -standby_temperature_delta = -5 -support_material = 0 -support_material_extruder = 0 -support_material_extrusion_width = 0.38 -support_material_interface_extruder = 0 -support_material_angle = 0 -support_material_buildplate_only = 0 -support_material_enforce_layers = 0 -support_material_contact_distance = 0.15 -support_material_interface_contact_loops = 0 -support_material_interface_layers = 2 -support_material_interface_spacing = 0.2 -support_material_interface_speed = 100% -support_material_pattern = rectilinear -support_material_spacing = 2 -support_material_speed = 50 -support_material_synchronize_layers = 0 -support_material_threshold = 45 -support_material_with_sheath = 0 -support_material_xy_spacing = 60% -thin_walls = 0 -top_infill_extrusion_width = 0.4 -top_solid_infill_speed = 40 -top_solid_min_thickness = 0.6 -travel_speed = 180 -wipe_tower = 1 -wipe_tower_bridging = 10 -wipe_tower_rotation_angle = 0 -wipe_tower_width = 60 -wipe_tower_x = 170 -wipe_tower_y = 140 -xy_size_compensation = 0 -bridge_acceleration = 1000 -default_acceleration = 1500 -first_layer_acceleration = 1000 -infill_acceleration = 1500 -perimeter_acceleration = 800 - -[print:*0.08mm_akossel*] -inherits = *common_akossel* -bottom_solid_layers = 10 -bridge_acceleration = 300 -bridge_flow_ratio = 0.7 -bridge_speed = 20 -external_perimeter_speed = 20 -first_layer_acceleration = 500 -gap_fill_speed = 20 -infill_acceleration = 800 -infill_speed = 40 -layer_height = 0.08 -max_print_speed = 80 -perimeter_acceleration = 300 -perimeter_speed = 30 -perimeters = 3 -small_perimeter_speed = 20 -solid_infill_speed = 40 -support_material_extrusion_width = 0.3 -support_material_spacing = 1.5 -support_material_speed = 40 -top_solid_infill_speed = 30 -top_solid_layers = 12 - -[print:*0.16mm_akossel*] -inherits = *common_akossel* -bottom_solid_layers = 5 -layer_height = 0.16 -top_solid_layers = 6 - -[print:*0.20mm_akossel*] -inherits = *common_akossel* -bottom_solid_layers = 4 -bridge_flow_ratio = 0.95 -layer_height = 0.20 -top_solid_layers = 5 - -[print:*0.24mm_akossel*] -inherits = *common_akossel* -bottom_solid_layers = 4 -bridge_flow_ratio = 0.95 -layer_height = 0.24 -perimeter_speed = 50 -external_perimeter_speed = 35 -top_solid_layers = 4 -infill_speed = 100 -solid_infill_speed = 100 -top_solid_infill_speed = 40 - -[print:*0.30mm_akossel*] -inherits = *common_akossel* -bottom_solid_layers = 3 -bridge_flow_ratio = 0.95 -external_perimeter_extrusion_width = 0.6 -external_perimeter_speed = 35 -extrusion_width = 0.5 -infill_extrusion_width = 0.5 -infill_speed = 70 -layer_height = 0.30 -perimeter_extrusion_width = 0.5 -perimeter_speed = 50 -small_perimeter_speed = 30 -solid_infill_extrusion_width = 0.5 -solid_infill_speed = 70 -support_material_speed = 45 -top_infill_extrusion_width = 0.45 -top_solid_infill_speed = 50 -top_solid_layers = 3 - -[print:0.08mm ULTRADETAIL @AKOSSEL] -inherits = *0.08mm_akossel* -fill_density = 15% -fill_pattern = gyroid -compatible_printers_condition = printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ and nozzle_diameter[0]==0.4 - -[print:0.16mm QUALITY @AKOSSEL] -inherits = *0.16mm_akossel* -external_perimeter_speed = 25 -fill_density = 15% -fill_pattern = gyroid -infill_speed = 80 -compatible_printers_condition = printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ and nozzle_diameter[0]==0.4 - -[print:0.16mm SPEED @AKOSSEL] -inherits = *0.16mm_akossel* -external_perimeter_speed = 35 -infill_speed = 120 -perimeter_speed = 60 -solid_infill_speed = 120 -top_solid_infill_speed = 50 -compatible_printers_condition = printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ and nozzle_diameter[0]==0.4 - -[print:0.20mm QUALITY @AKOSSEL] -inherits = *0.20mm_akossel* -external_perimeter_speed = 25 -fill_density = 15% -fill_pattern = gyroid -infill_speed = 80 -compatible_printers_condition = printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ and nozzle_diameter[0]==0.4 - -[print:0.20mm SPEED @AKOSSEL] -inherits = *0.20mm_akossel* -external_perimeter_speed = 35 -infill_speed = 120 -perimeter_speed = 60 -solid_infill_speed = 120 -top_solid_infill_speed = 50 -compatible_printers_condition = printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ and nozzle_diameter[0]==0.4 - -[print:0.24mm DRAFT @AKOSSEL] -inherits = *0.24mm_akossel* -compatible_printers_condition = printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ and nozzle_diameter[0]==0.4 - -[print:0.30mm FAST @AKOSSEL] -inherits = *0.30mm_akossel* -compatible_printers_condition = printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ and nozzle_diameter[0]==0.4 - -# Common filament preset -[filament:*common_akossel*] -cooling = 0 -compatible_printers = -extrusion_multiplier = 1 -filament_cost = 0 -filament_density = 0 -filament_diameter = 1.75 -filament_notes = "" -filament_settings_id = "" -filament_soluble = 0 -min_print_speed = 15 -slowdown_below_layer_time = 20 -compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_Anycubic.*/ and printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ - -[filament:*PLA_akossel*] -inherits = *common_akossel* -bed_temperature = 60 -fan_below_layer_time = 100 -filament_colour = #FF3232 -filament_max_volumetric_speed = 10 -filament_type = PLA -filament_density = 1.24 -filament_cost = 20 -first_layer_bed_temperature = 60 -first_layer_temperature = 200 -fan_always_on = 1 -cooling = 1 -max_fan_speed = 100 -min_fan_speed = 100 -bridge_fan_speed = 100 -disable_fan_first_layers = 1 -temperature = 200 - -[filament:*PET_akossel*] -inherits = *common_akossel* -bed_temperature = 70 -cooling = 1 -disable_fan_first_layers = 3 -fan_below_layer_time = 20 -filament_colour = #FF8000 -filament_max_volumetric_speed = 8 -filament_type = PETG -filament_density = 1.27 -filament_cost = 30 -first_layer_bed_temperature =70 -first_layer_temperature = 240 -fan_always_on = 1 -max_fan_speed = 50 -min_fan_speed = 20 -bridge_fan_speed = 100 -temperature = 240 - -[filament:*ABS_akossel*] -inherits = *common_akossel* -bed_temperature = 100 -cooling = 0 -disable_fan_first_layers = 3 -fan_below_layer_time = 20 -filament_colour = #3A80CA -filament_max_volumetric_speed = 10 -filament_type = ABS -filament_density = 1.04 -filament_cost = 20 -first_layer_bed_temperature = 100 -first_layer_temperature = 245 -fan_always_on = 0 -max_fan_speed = 0 -min_fan_speed = 0 -bridge_fan_speed = 30 -top_fan_speed = 0 -temperature = 245 - -[filament:Generic PLA @AKOSSEL] -inherits = *PLA_akossel* -filament_vendor = Generic - -[filament:Generic PETG @AKOSSEL] -inherits = *PET_akossel* -filament_vendor = Generic - -[filament:Generic ABS @AKOSSEL] -inherits = *ABS_akossel* -filament_vendor = Generic - -# Common printer preset -[printer:*common_akossel*] -printer_technology = FFF -bed_shape = -before_layer_gcode = ;BEFORE_LAYER_CHANGE\nG92 E0\n;[layer_z] -between_objects_gcode = -deretract_speed = 40 -extruder_colour = #FFFF00 -extruder_offset = 0x0 -gcode_flavor = marlin -silent_mode = 0 -remaining_times = 0 -machine_max_acceleration_e = 3000 -machine_max_acceleration_extruding = 1000 -machine_max_acceleration_retracting = 1000 -machine_max_acceleration_x = 1500 -machine_max_acceleration_y = 1500 -machine_max_acceleration_z = 1500 -machine_max_feedrate_e = 60 -machine_max_feedrate_x = 200 -machine_max_feedrate_y = 200 -machine_max_feedrate_z = 200 -machine_max_jerk_e = 5 -machine_max_jerk_x = 5 -machine_max_jerk_y = 5 -machine_max_jerk_z = 5 -machine_min_extruding_rate = 0 -machine_min_travel_rate = 0 -layer_gcode = ;AFTER_LAYER_CHANGE\n;[layer_z] -max_layer_height = 0.3 -min_layer_height = 0.08 -max_print_height = 300 -nozzle_diameter = 0.4 -printer_notes = -printer_settings_id = -retract_before_travel = 2 -retract_before_wipe = 70% -retract_layer_change = 1 -retract_length = 5 -retract_length_toolchange = 1 -retract_lift = 0 -retract_lift_above = 0 -retract_lift_below = 0 -retract_restart_extra = 0 -retract_restart_extra_toolchange = 0 -retract_speed = 60 -single_extruder_multi_material = 0 -start_gcode = -end_gcode = M104 S0 ; turn off temperature\nM140 S0 ; turn off heatbed\nM107 ; turn off fan\nG28 ; home\nM84 ; disable motors -toolchange_gcode = -use_firmware_retraction = 0 -use_relative_e_distances = 1 -use_volumetric_e = 0 -variable_layer_height = 1 -wipe = 1 -z_offset = 0 -default_print_profile = 0.20mm QUALITY @AKOSSEL -default_filament_profile = Generic PLA @AKOSSEL - -[printer:Anycubic Kossel Linear Plus] -inherits = *common_akossel* -printer_model = AKLP -printer_variant = 0.4 -printer_notes = Do not remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_Anycubic\nPRINTER_MODEL_AKLP\nPRINTER_HAS_BOWDEN\n -bed_shape = 114.562x10.0229,113.253x19.9695,111.081x29.7642,108.065x39.3323,104.225x48.6011,99.5929x57.5,94.2025x65.9613,88.0951x73.9206,81.3173x81.3173,73.9206x88.0951,65.9613x94.2025,57.5x99.5929,48.6011x104.225,39.3323x108.065,29.7642x111.081,19.9695x113.253,10.0229x114.562,7.04172e-15x115,-10.0229x114.562,-19.9695x113.253,-29.7642x111.081,-39.3323x108.065,-48.6011x104.225,-57.5x99.5929,-65.9613x94.2025,-73.9206x88.0951,-81.3173x81.3173,-88.0951x73.9206,-94.2025x65.9613,-99.5929x57.5,-104.225x48.6011,-108.065x39.3323,-111.081x29.7642,-113.253x19.9695,-114.562x10.0229,-115x1.40834e-14,-114.562x-10.0229,-113.253x-19.9695,-111.081x-29.7642,-108.065x-39.3323,-104.225x-48.6011,-99.5929x-57.5,-94.2025x-65.9613,-88.0951x-73.9206,-81.3173x-81.3173,-73.9206x-88.0951,-65.9613x-94.2025,-57.5x-99.5929,-48.6011x-104.225,-39.3323x-108.065,-29.7642x-111.081,-19.9695x-113.253,-10.0229x-114.562,-2.11252e-14x-115,10.0229x-114.562,19.9695x-113.253,29.7642x-111.081,39.3323x-108.065,48.6011x-104.225,57.5x-99.5929,65.9613x-94.2025,73.9206x-88.0951,81.3173x-81.3173,88.0951x-73.9206,94.2025x-65.9613,99.5929x-57.5,104.225x-48.6011,108.065x-39.3323,111.081x-29.7642,113.253x-19.9695,114.562x-10.0229,115x-2.81669e-14 -start_gcode = G90 ; use absolute coordinates\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 ; home\nG1 X-54.672 Y95.203 Z0.3 F9000\nG92 E0.0\nG1 F1000\nG1 X-52.931 Y96.185 E0.300\nG1 X-50.985 Y97.231 E0.331\nG1 X-49.018 Y98.238 E0.331\nG1 X-47.032 Y99.205 E0.331\nG1 X-45.026 Y100.132 E0.331\nG1 X-43.003 Y101.019 E0.331\nG1 X-40.961 Y101.864 E0.331\nG1 X-38.904 Y102.668 E0.331\nG1 X-36.83 Y103.431 E0.331\nG1 X-34.742 Y104.152 E0.331\nG1 X-32.639 Y104.83 E0.331\nG1 X-30.523 Y105.466 E0.331\nG1 X-28.395 Y106.06 E0.331\nG1 X-26.255 Y106.61 E0.331\nG1 X-24.105 Y107.117 E0.331\nG1 X-21.945 Y107.581 E0.331\nG1 X-19.776 Y108.001 E0.331\nG1 X-17.599 Y108.377 E0.331\nG1 X-15.415 Y108.71 E0.331\nG1 X-13.224 Y108.998 E0.331\nG1 X-11.028 Y109.242 E0.331\nG1 X-8.828 Y109.442 E0.331\nG1 X-6.624 Y109.598 E0.331\nG1 X-4.418 Y109.709 E0.331\nG1 X-2.209 Y109.776 E0.332\nG1 X0 Y109.798 E0.331\nG1 X2.209 Y109.776 E0.690\nG1 X4.418 Y109.709 E0.691\nG1 X6.624 Y109.598 E0.690\nG1 X8.828 Y109.442 E0.690\nG1 X11.028 Y109.242 E0.690\nG1 X13.224 Y108.998 E0.690\nG1 X15.415 Y108.71 E0.691\nG1 X17.599 Y108.377 E0.690\nG1 X19.776 Y108.001 E0.690\nG1 X21.945 Y107.581 E0.690\nG1 X24.105 Y107.117 E0.690\nG1 X26.255 Y106.61 E0.690\nG1 X28.395 Y106.06 E0.690\nG1 X30.523 Y105.466 E0.690\nG1 X32.639 Y104.83 E0.690\nG1 X34.742 Y104.152 E0.690\nG1 X36.83 Y103.431 E0.690\nG1 X38.904 Y102.668 E0.691\nG1 X40.961 Y101.864 E0.690\nG1 X43.003 Y101.019 E0.691\nG1 X45.026 Y100.132 E0.690\nG1 X47.032 Y99.205 E0.691\nG1 X49.018 Y98.238 E0.690\nG1 X50.985 Y97.231 E0.691\nG1 X52.931 Y96.185 E0.690\nG1 X54.672 Y95.203 E0.625\nG92 E0.0\nG1 E-5 F3000 ; retract 5mm\nG1 X52.931 Y96.185 F1000 ; wipe\nG1 X50.985 Y97.231 F1000 ; wipe\nG1 X49.018 Y98.238 F1000 ; wipe\nG1 X0 Y109.798 F1000\nG1 E4.8 F1500; de-retract\nG92 E0.0 ; reset extrusion distance\nM221 S{if layer_height<0.075}100{else}95{endif} - -[printer:Anycubic Kossel Pulley (Linear)] -inherits = *common_akossel* -printer_model = AK -printer_variant = 0.4 -printer_notes = Do not remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_Anycubic\nPRINTER_MODEL_AK\nPRINTER_HAS_BOWDEN\n -bed_shape = 89.6575x7.84402,88.6327x15.6283,86.9333x23.2937,84.5723x30.7818,81.5677x38.0356,77.9423x45,73.7237x51.6219,68.944x57.8509,63.6396x63.6396,57.8509x68.944,51.6219x73.7237,45x77.9423,38.0356x81.5677,30.7818x84.5723,23.2937x86.9333,15.6283x88.6327,7.84402x89.6575,5.51091e-15x90,-7.84402x89.6575,-15.6283x88.6327,-23.2937x86.9333,-30.7818x84.5723,-38.0356x81.5677,-45x77.9423,-51.6219x73.7237,-57.8509x68.944,-63.6396x63.6396,-68.944x57.8509,-73.7237x51.6219,-77.9423x45,-81.5677x38.0356,-84.5723x30.7818,-86.9333x23.2937,-88.6327x15.6283,-89.6575x7.84402,-90x1.10218e-14,-89.6575x-7.84402,-88.6327x-15.6283,-86.9333x-23.2937,-84.5723x-30.7818,-81.5677x-38.0356,-77.9423x-45,-73.7237x-51.6219,-68.944x-57.8509,-63.6396x-63.6396,-57.8509x-68.944,-51.6219x-73.7237,-45x-77.9423,-38.0356x-81.5677,-30.7818x-84.5723,-23.2937x-86.9333,-15.6283x-88.6327,-7.84402x-89.6575,-1.65327e-14x-90,7.84402x-89.6575,15.6283x-88.6327,23.2937x-86.9333,30.7818x-84.5723,38.0356x-81.5677,45x-77.9423,51.6219x-73.7237,57.8509x-68.944,63.6396x-63.6396,68.944x-57.8509,73.7237x-51.6219,77.9423x-45,81.5677x-38.0356,84.5723x-30.7818,86.9333x-23.2937,88.6327x-15.6283,89.6575x-7.84402,90x-2.20436e-14 -start_gcode = G90 ; use absolute coordinates\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 ; home\nG1 X-39.672 Y69.712 Z0.3 F9000\nG92 E0.0\nG1 F1000\nG1 X-38.457 Y70.397 E0.209\nG1 X-37.043 Y71.157 E0.241\nG1 X-35.614 Y71.889 E0.241\nG1 X-34.171 Y72.591 E0.241\nG1 X-32.714 Y73.265 E0.241\nG1 X-31.244 Y73.909 E0.241\nG1 X-29.761 Y74.523 E0.241\nG1 X-28.266 Y75.108 E0.241\nG1 X-26.759 Y75.662 E0.241\nG1 X-25.242 Y76.185 E0.241\nG1 X-23.714 Y76.678 E0.241\nG1 X-22.177 Y77.14 E0.241\nG1 X-20.63 Y77.571 E0.241\nG1 X-19.076 Y77.971 E0.241\nG1 X-17.514 Y78.34 E0.241\nG1 X-15.944 Y78.677 E0.241\nG1 X-14.368 Y78.982 E0.241\nG1 X-12.786 Y79.255 E0.241\nG1 X-11.199 Y79.497 E0.241\nG1 X-9.608 Y79.706 E0.241\nG1 X-8.013 Y79.884 E0.241\nG1 X-6.414 Y80.029 E0.241\nG1 X-4.813 Y80.142 E0.241\nG1 X-3.21 Y80.223 E0.241\nG1 X-1.605 Y80.271 E0.241\nG1 X0 Y80.287 E0.241\nG1 X1.605 Y80.271 E0.502\nG1 X3.21 Y80.223 E0.502\nG1 X4.813 Y80.142 E0.502\nG1 X6.414 Y80.029 E0.502\nG1 X8.013 Y79.884 E0.502\nG1 X9.608 Y79.706 E0.502\nG1 X11.199 Y79.497 E0.501\nG1 X12.786 Y79.255 E0.502\nG1 X14.368 Y78.982 E0.502\nG1 X15.944 Y78.677 E0.502\nG1 X17.514 Y78.34 E0.502\nG1 X19.076 Y77.971 E0.502\nG1 X20.63 Y77.571 E0.501\nG1 X22.177 Y77.14 E0.502\nG1 X23.714 Y76.678 E0.502\nG1 X25.242 Y76.185 E0.502\nG1 X26.759 Y75.662 E0.501\nG1 X28.266 Y75.108 E0.502\nG1 X29.761 Y74.523 E0.502\nG1 X31.244 Y73.909 E0.502\nG1 X32.714 Y73.265 E0.502\nG1 X34.171 Y72.591 E0.502\nG1 X35.614 Y71.889 E0.501\nG1 X37.043 Y71.157 E0.502\nG1 X38.457 Y70.397 E0.502\nG1 X39.672 Y69.712 E0.436\nG92 E0.0\nM221 S{if layer_height<0.075}100{else}95{endif} - -## Anycubic MEGA ZERO -## Author: https://github.com/kad -## Initial PR: https://github.com/prusa3d/PrusaSlicer/pull/4057 - -# Common print preset -[print:*common_mega0*] -avoid_crossing_perimeters = 1 -bridge_angle = 0 -bridge_flow_ratio = 0.7 -bridge_speed = 25 -brim_width = 0 -clip_multipart_objects = 1 -compatible_printers = -complete_objects = 0 -dont_support_bridges = 1 -elefant_foot_compensation = 0 -ensure_vertical_shell_thickness = 1 -external_fill_pattern = rectilinear -external_perimeters_first = 0 -external_perimeter_extrusion_width = 0.45 -extra_perimeters = 0 -extruder_clearance_height = 25 -extruder_clearance_radius = 45 -extrusion_width = 0.45 -fill_angle = 45 -fill_density = 20% -fill_pattern = grid -first_layer_extrusion_width = 0.42 -first_layer_height = 0.2 -first_layer_speed = 20 -gap_fill_speed = 30 -gcode_comments = 0 -infill_every_layers = 1 -infill_extruder = 1 -infill_extrusion_width = 0.45 -infill_first = 0 -infill_only_where_needed = 0 -infill_overlap = 25% -interface_shells = 0 -max_print_speed = 100 -max_volumetric_extrusion_rate_slope_negative = 0 -max_volumetric_extrusion_rate_slope_positive = 0 -max_volumetric_speed = 0 -min_skirt_length = 4 -notes = -overhangs = 1 -only_retract_when_crossing_perimeters = 0 -ooze_prevention = 0 -output_filename_format = {input_filename_base}_{layer_height}mm_{filament_type[0]}_{printer_model}_{print_time}.gcode -perimeters = 2 -perimeter_extruder = 1 -perimeter_extrusion_width = 0.45 -post_process = -print_settings_id = -raft_layers = 0 -resolution = 0 -seam_position = nearest -single_extruder_multi_material_priming = 1 -skirts = 2 -skirt_distance = 2 -skirt_height = 2 -small_perimeter_speed = 25 -solid_infill_below_area = 0 -solid_infill_every_layers = 0 -solid_infill_extruder = 1 -solid_infill_extrusion_width = 0.45 -spiral_vase = 0 -standby_temperature_delta = -5 -support_material = 0 -support_material_extruder = 0 -support_material_extrusion_width = 0.4 -support_material_interface_extruder = 0 -support_material_angle = 0 -support_material_buildplate_only = 0 -support_material_enforce_layers = 0 -support_material_contact_distance = 0.15 -support_material_interface_contact_loops = 0 -support_material_interface_layers = 2 -support_material_interface_spacing = 0.2 -support_material_interface_speed = 100% -support_material_pattern = rectilinear -support_material_spacing = 2 -support_material_speed = 40 -support_material_synchronize_layers = 0 -support_material_threshold = 45 -support_material_with_sheath = 0 -support_material_xy_spacing = 60% -thin_walls = 0 -top_infill_extrusion_width = 0.45 -top_solid_infill_speed = 40 -travel_speed = 100 -wipe_tower = 0 -wipe_tower_bridging = 10 -wipe_tower_rotation_angle = 0 -wipe_tower_width = 60 -wipe_tower_x = 170 -wipe_tower_y = 140 -xy_size_compensation = 0 - -[print:*0.10mm_mega0*] -inherits = *common_mega0* -perimeter_speed = 40 -external_perimeter_speed = 25 -infill_speed = 50 -solid_infill_speed = 40 -layer_height = 0.10 -perimeters = 3 -top_infill_extrusion_width = 0.4 -bottom_solid_layers = 6 -top_solid_layers = 7 - -[print:*0.20mm_mega0*] -inherits = *common_mega0* -perimeter_speed = 40 -external_perimeter_speed = 25 -infill_speed = 50 -solid_infill_speed = 40 -layer_height = 0.20 -top_infill_extrusion_width = 0.4 -bottom_solid_layers = 4 -top_solid_layers = 5 - -[print:*0.30mm_mega0*] -inherits = *common_mega0* -perimeter_speed = 40 -external_perimeter_speed = 25 -infill_speed = 50 -solid_infill_speed = 40 -layer_height = 0.24 -top_infill_extrusion_width = 0.45 -bottom_solid_layers = 3 -top_solid_layers = 4 - -[print:0.10mm DETAIL @MEGA0] -inherits = *0.10mm_mega0* -travel_speed = 120 -infill_speed = 50 -solid_infill_speed = 40 -top_solid_infill_speed = 30 -support_material_extrusion_width = 0.38 -compatible_printers_condition = printer_model=="MEGA0" and nozzle_diameter[0]==0.4 - -[print:0.20mm NORMAL @MEGA0] -inherits = *0.20mm_mega0* -travel_speed = 120 -infill_speed = 50 -solid_infill_speed = 40 -top_solid_infill_speed = 30 -support_material_extrusion_width = 0.38 -compatible_printers_condition = printer_model=="MEGA0" and nozzle_diameter[0]==0.4 - -[print:0.30mm DRAFT @MEGA0] -inherits = *0.30mm_mega0* -travel_speed = 120 -infill_speed = 50 -solid_infill_speed = 40 -top_solid_infill_speed = 30 -support_material_extrusion_width = 0.38 -compatible_printers_condition = printer_model=="MEGA0" and nozzle_diameter[0]==0.4 - -# Common filament preset -[filament:*common_mega0*] -cooling = 0 -compatible_printers = -extrusion_multiplier = 1 -filament_cost = 0 -filament_density = 0 -filament_diameter = 1.75 -filament_notes = "" -filament_settings_id = "" -filament_soluble = 0 -min_print_speed = 15 -slowdown_below_layer_time = 20 -compatible_printers_condition = printer_model=="MEGA0" - -[filament:*PLA_mega0*] -inherits = *common_mega0* -bed_temperature = 40 -fan_below_layer_time = 100 -filament_colour = #FF3232 -filament_max_volumetric_speed = 15 -filament_type = PLA -filament_density = 1.24 -filament_cost = 20 -first_layer_bed_temperature = 40 -first_layer_temperature = 215 -fan_always_on = 1 -cooling = 1 -max_fan_speed = 100 -min_fan_speed = 100 -bridge_fan_speed = 100 -disable_fan_first_layers = 1 -temperature = 210 - -[filament:*PET_mega0*] -inherits = *common_mega0* -bed_temperature = 70 -cooling = 1 -disable_fan_first_layers = 3 -fan_below_layer_time = 20 -filament_colour = #FF8000 -filament_max_volumetric_speed = 8 -filament_type = PETG -filament_density = 1.27 -filament_cost = 30 -first_layer_bed_temperature =70 -first_layer_temperature = 240 -fan_always_on = 1 -max_fan_speed = 50 -min_fan_speed = 20 -bridge_fan_speed = 100 -temperature = 240 - -[filament:*ABS_mega0*] -inherits = *common_mega0* -bed_temperature = 100 -cooling = 0 -disable_fan_first_layers = 3 -fan_below_layer_time = 20 -filament_colour = #3A80CA -filament_max_volumetric_speed = 11 -filament_type = ABS -filament_density = 1.04 -filament_cost = 20 -first_layer_bed_temperature = 100 -first_layer_temperature = 245 -fan_always_on = 0 -max_fan_speed = 0 -min_fan_speed = 0 -bridge_fan_speed = 30 -top_fan_speed = 0 -temperature = 245 - -[filament:Generic PLA @MEGA0] -inherits = *PLA_mega0* -filament_vendor = Generic - -[filament:Generic PETG @MEGA0] -inherits = *PET_mega0* -filament_vendor = Generic - -[filament:Generic ABS @MEGA0] -inherits = *ABS_mega0* -filament_vendor = Generic - -[filament:Anycubic PLA @MEGA0] -inherits = *PLA_mega0* -filament_vendor = Anycubic -temperature = 190 -first_layer_temperature = 195 -filament_cost = 24.99 -filament_density = 1.25 - -[filament:Prusament PLA @MEGA0] -inherits = *PLA_mega0* -filament_vendor = Prusa Polymers -temperature = 215 -bed_temperature = 40 -first_layer_temperature = 215 -filament_cost = 24.99 -filament_density = 1.24 - -[filament:Prusament PETG @MEGA0] -inherits = *PET_mega0* -filament_vendor = Prusa Polymers -temperature = 245 -bed_temperature = 70 -first_layer_temperature = 245 -filament_cost = 24.99 -filament_density = 1.27 - -# Common printer preset -[printer:*common_mega0*] -printer_technology = FFF -bed_shape = 0x0,220x0,220x220,0x220 -before_layer_gcode = ; BEFORE_LAYER_CHANGE [layer_num] @ [layer_z]mm\nG92 E0 -between_objects_gcode = -deretract_speed = 0 -extruder_colour = #FFFF00 -extruder_offset = 0x0 -gcode_flavor = marlin -silent_mode = 0 -remaining_times = 0 -machine_max_acceleration_e = 10000 -machine_max_acceleration_extruding = 2000 -machine_max_acceleration_retracting = 1500 -machine_max_acceleration_x = 3000 -machine_max_acceleration_y = 3000 -machine_max_acceleration_z = 500 -machine_max_feedrate_e = 120 -machine_max_feedrate_x = 500 -machine_max_feedrate_y = 500 -machine_max_feedrate_z = 12 -machine_max_jerk_e = 2.5 -machine_max_jerk_x = 20 -machine_max_jerk_y = 20 -machine_max_jerk_z = 0.4 -machine_min_extruding_rate = 0 -machine_min_travel_rate = 0 -layer_gcode = ; AFTER_LAYER_CHANGE [layer_num] @ [layer_z]mm -max_layer_height = 0.3 -min_layer_height = 0.1 -max_print_height = 200 -nozzle_diameter = 0.4 -printer_notes = -printer_settings_id = -retract_before_travel = 1 -retract_before_wipe = 0% -retract_layer_change = 1 -retract_length = 6 -retract_length_toolchange = 1 -retract_lift = 0 -retract_lift_above = 0 -retract_lift_below = 0 -retract_restart_extra = 0 -retract_restart_extra_toolchange = 0 -retract_speed = 30 -single_extruder_multi_material = 0 -start_gcode = G21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nM117 Homing X/Y ...\nG28 X0 Y0 ;move X/Y to min endstops\nM117 Homing Z ...\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F240 ;move the platform down 15mm\nM117 Heating ...\nM104 S[first_layer_temperature]\n ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature]\n ; wait for extruder temp\nM117 Start cleaning ...\nG92 E0 ;zero the extruded length\nG1 F200 E10 ;extrude 10mm of feed stock\nG92 E0 ;zero the extruded length again\nM117 Intro line ...\nG1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed\nG1 X0.1 Y20 Z[first_layer_height] F5000.0 ; Move to start position\nG1 X0.1 Y200.0 Z[first_layer_height] F1500.0 E15 ; Draw the first line\nG1 X0.4 Y200.0 Z[first_layer_height] F5000.0 ; Move to side a little\nG1 X0.4 Y20 Z0.3[first_layer_height] F1500.0 E30 ; Draw the second line\nG92 E0 ; Reset Extruder\nG1 E-1 F500 ; Retract filiment by 1 mm\nG1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed\nG1 X5 Y20 Z0.3 F240 ; Move over to prevent blob squish\nG92 E0 ; Reset Extruder\nM117 Printing...\n -end_gcode = M117 Cooling down...\nM104 S0 ; turn off extruder\nM140 S0 ; turn off heatbed\nM107 ; Fan off\nM84 ; disable motors\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 ;X-20 Y-20 F240 ;move Z up a bit and retract filament even more\nG28 X0 ;move X to min endstops, so the head is out of the way\nG90 ;Absolute positionning\nG1 Y200 F3000 ;Present print\nM84 ;steppers off\nM300 P300 S4000\nM117 Finished.\n -toolchange_gcode = -use_firmware_retraction = 0 -use_relative_e_distances = 1 -use_volumetric_e = 0 -variable_layer_height = 1 -wipe = 1 -z_offset = 0 -printer_model = -default_print_profile = -default_filament_profile = - -[printer:Anycubic Mega Zero] -inherits = *common_mega0* -printer_model = MEGA0 -printer_variant = 0.4 -max_layer_height = 0.3 -min_layer_height = 0.1 -printer_notes = Do not remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_ANYCUBIC\nPRINTER_MODEL_MEGA0 -bed_shape = 0x0,220x0,220x220,0x220 -max_print_height = 250 -machine_max_acceleration_e = 5000 -machine_max_acceleration_extruding = 500 -machine_max_acceleration_retracting = 500 -machine_max_acceleration_x = 500 -machine_max_acceleration_y = 500 -machine_max_acceleration_z = 100 -machine_max_feedrate_e = 25 -machine_max_feedrate_x = 500 -machine_max_feedrate_y = 500 -machine_max_feedrate_z = 5 -machine_max_jerk_e = 5 -machine_max_jerk_x = 10 -machine_max_jerk_y = 10 -machine_max_jerk_z = 0.4 -machine_min_extruding_rate = 0 -machine_min_travel_rate = 0 -nozzle_diameter = 0.4 -retract_before_travel = 2 -retract_layer_change = 0 -retract_length = 7 -retract_speed = 30 -retract_lift = 0.2 -deretract_speed = 30 -retract_before_wipe = 70% -default_print_profile = 0.20mm NORMAL @MEGA0 -default_filament_profile = Anycubic PLA @MEGA0 -start_gcode = G21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nM117 Homing X/Y ...\nG28 X0 Y0 ;move X/Y to min endstops\nM117 Homing Z ...\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F240 ;move the platform down 15mm\nM117 Heating ...\nM104 S[first_layer_temperature]\n ; set extruder temp\nM109 S[first_layer_temperature]\n ; wait for extruder temp\nM117 Start cleaning ...\nG92 E0 ;zero the extruded length\nG1 F200 E10 ;extrude 10mm of feed stock\nG92 E0 ;zero the extruded length again\nM117 Intro line ...\nG1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed\nG1 X0.1 Y20 Z[first_layer_height] F5000.0 ; Move to start position\nG1 X0.1 Y200.0 Z[first_layer_height] F1500.0 E15 ; Draw the first line\nG1 X0.4 Y200.0 Z[first_layer_height] F5000.0 ; Move to side a little\nG1 X0.4 Y20 Z0.3[first_layer_height] F1500.0 E30 ; Draw the second line\nG92 E0 ; Reset Extruder\nG1 E-1 F500 ; Retract filiment by 1 mm\nG1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed\nG1 X5 Y20 Z0.3 F240 ; Move over to prevent blob squish\nG92 E0 ; Reset Extruder\nM117 Printing...\n -end_gcode = M117 Cooling down...\nM104 S0 ; turn off extruder\nM107 ; Fan off\nM84 ; disable motors\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 ;X-20 Y-20 F240 ;move Z up a bit and retract filament even more\nG28 X0 ;move X to min endstops, so the head is out of the way\nG90 ;Absolute positionning\nG1 Y200 F3000 ;Present print\nM84 ;steppers off\nM300 P300 S4000\nM117 Finished.\n - -## Anycubic i3 Mega and i3 Mega S -## Author: https://github.com/Igami -## Initial PR: https://github.com/prusa3d/PrusaSlicer/pull/4619 - -[print:*common_mega*] -bottom_solid_min_thickness = 0.5 -bridge_acceleration = 1000 -bridge_flow_ratio = 0.95 -bridge_speed = 25 -compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_I3_MEGA.*/ and nozzle_diameter[0]==0.4 -default_acceleration = 1000 -ensure_vertical_shell_thickness = 1 -external_perimeter_extrusion_width = 0.45 -external_perimeter_speed = 40 -extruder_clearance_height = 35 -extruder_clearance_radius = 60 -extrusion_width = 0.45 -fill_density = 15% -fill_pattern = gyroid -first_layer_acceleration = 800 -first_layer_extrusion_width = 0.42 -first_layer_height = 0.2 -first_layer_speed = 20 -gap_fill_speed = 40 -gcode_comments = 0 -gcode_label_objects = 1 -infill_acceleration = 1000 -infill_anchor = 2.5 -infill_anchor_max = 12 -infill_extrusion_width = 0.45 -max_print_speed = 100 -min_skirt_length = 4 -only_retract_when_crossing_perimeters = 0 -output_filename_format = {input_filename_base}_{layer_height}mm_{filament_type[0]}_{printer_model}_{print_time}.gcode -perimeter_acceleration = 800 -perimeter_extrusion_width = 0.45 -perimeter_speed = 50 -perimeters = 2 -seam_position = nearest -skirt_distance = 2 -skirt_height = 3 -skirts = 1 -small_perimeter_speed = 25 -solid_infill_below_area = 0 -solid_infill_extrusion_width = 0.45 -solid_infill_speed = 50 -support_material = 0 -support_material_buildplate_only = 0 -support_material_contact_distance = 0.1 -support_material_extrusion_width = 0.35 -support_material_interface_layers = 2 -support_material_interface_spacing = 0.2 -support_material_interface_speed = 80% -support_material_spacing = 2 -support_material_speed = 50 -support_material_threshold = 50 -support_material_xy_spacing = 60% -thin_walls = 0 -top_infill_extrusion_width = 0.4 -top_solid_infill_speed = 40 -top_solid_min_thickness = 0.7 -travel_speed = 180 - -# XXXXXXXXXXXXXXXXXXXX -# XXX--- 0.15mm ---XXX -# XXXXXXXXXXXXXXXXXXXX - -[print:*0.15mm_mega*] -inherits = *common_mega* -bottom_solid_layers = 5 -bridge_flow_ratio = 1 -infill_speed = 60 -layer_height = 0.15 -top_solid_layers = 7 - -[print:0.15mm QUALITY @MEGA] -inherits = *0.15mm_mega* - -# XXXXXXXXXXXXXXXXXXXX -# XXX--- 0.20mm ---XXX -# XXXXXXXXXXXXXXXXXXXX - -[print:*0.20mm_mega*] -inherits = *common_mega* -bottom_solid_layers = 4 -infill_speed = 60 -layer_height = 0.2 -top_solid_layers = 5 - -[print:0.20mm QUALITY @MEGA] -inherits = *0.20mm_mega* - -# XXXXXXXXXXXXXXXXXXXX -# XXX--- 0.30mm ---XXX -# XXXXXXXXXXXXXXXXXXXX - -[print:*0.30mm_mega*] -inherits = *common_mega* -bottom_solid_layers = 4 -external_perimeter_extrusion_width = 0.6 -external_perimeter_speed = 35 -extrusion_width = 0.5 -fill_pattern = cubic -infill_extrusion_width = 0.5 -infill_speed = 85 -layer_height = 0.3 -perimeter_extrusion_width = 0.5 -small_perimeter_speed = 30 -solid_infill_extrusion_width = 0.5 -support_material_extrusion_width = 0.38 -support_material_speed = 45 -top_solid_layers = 4 - -[print:0.30mm DRAFT @MEGA] -inherits = *0.30mm_mega* - -# XXXXXXXXXXXXXXXXXXXXXX -# XXX--- filament ---XXX -# XXXXXXXXXXXXXXXXXXXXXX - -[filament:*common_mega*] -compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_I3_MEGA.*/ -end_filament_gcode = "; Filament-specific end gcode" -fan_always_on = 1 -fan_below_layer_time = 100 -filament_vendor = Generic -min_print_speed = 15 -slowdown_below_layer_time = 20 - -[filament:*ABS_mega*] - inherits = *common_mega* - bed_temperature = 110 - bridge_fan_speed = 25 - cooling = 0 - fan_always_on = 0 - fan_below_layer_time = 20 - filament_colour = #3A80CA - filament_cost = 27.82 - filament_density = 1.04 - filament_max_volumetric_speed = 11 - filament_ramming_parameters = "120 100 5.70968 6.03226 7 8.25806 9 9.19355 9.3871 9.77419 10.129 10.3226 10.4516 10.5161| 0.05 5.69677 0.45 6.15484 0.95 8.76774 1.45 9.20323 1.95 9.95806 2.45 10.3871 2.95 10.5677 3.45 7.6 3.95 7.6 4.45 7.6 4.95 7.6" - filament_type = ABS - first_layer_bed_temperature = 105 - first_layer_temperature = 255 - max_fan_speed = 30 - min_fan_speed = 20 - temperature = 255 - -[filament:Generic ABS @MEGA] -inherits = *ABS_mega* - -[filament:*FLEX_mega*] -inherits = *common_mega* -bed_temperature = 50 -bridge_fan_speed = 80 -cooling = 0 -extrusion_multiplier = 1.15 -fan_always_on = 0 -filament_colour = #008000 -filament_cost = 82.00 -filament_density = 1.22 -filament_deretract_speed = 25 -filament_max_volumetric_speed = 1.2 -filament_retract_length = 0.8 -filament_type = FLEX -first_layer_bed_temperature = 55 -first_layer_temperature = 240 -max_fan_speed = 90 -min_fan_speed = 70 -temperature = 240 - -[filament:Generic FLEX @MEGA] -inherits = *FLEX_mega* - -[filament:SainSmart TPU @MEGA] -inherits = *FLEX_mega* -filament_vendor = SainSmart -bed_temperature = 50 -bridge_fan_speed = 100 -cooling = 1 -disable_fan_first_layers = 4 -filament_cost = 39.99 -filament_density = 1.21 -filament_deretract_speed = 15 -filament_max_volumetric_speed = 1.8 -filament_notes = "SainSmart TPU gains popularity among 3D Printing community for its balance of rigidity and flexibility. In addition, with a 95A Shore Hardness and improved bed adhesion, it is easier to print even with a stock elementary 3D Printer like the Creality Ender 3. SainSmart TPU will not disappoint if you are looking for flexible filament. From drone parts, phone cases, to small toys, all can be printed with ease.\n\nhttps://www.sainsmart.com/collections/tpu-filament/products/all-colors-tpu-flexible-filament-1-75mm-0-8kg-1-76lb" -filament_retract_before_travel = 5 -filament_retract_length = 4 -filament_retract_speed = 40 -filament_unloading_speed = 90 -first_layer_bed_temperature = 55 -first_layer_temperature = 235 -full_fan_speed_layer = 6 -max_fan_speed = 80 -min_fan_speed = 80 -slowdown_below_layer_time = 10 -temperature = 235 - -[filament:*PETG_mega*] -inherits = *common_mega* -bed_temperature = 90 -bridge_fan_speed = 50 -fan_below_layer_time = 20 -filament_colour = #FF8000 -filament_cost = 27.82 -filament_density = 1.27 -filament_max_volumetric_speed = 8 -filament_type = PETG -first_layer_bed_temperature = 90 -first_layer_temperature = 230 -max_fan_speed = 50 -min_fan_speed = 30 -temperature = 240 - -[filament:Generic PETG @MEGA] -inherits = *PETG_mega* - -[filament:ColorFabb XT-CF20 @MEGA] -inherits = *PETG_mega* -compatible_printers_condition = nozzle_diameter[0]>=0.4 and printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_I3_MEGA.*/ -extrusion_multiplier = 1.05 -filament_colour = #804040 -filament_cost = 66.60 -filament_density = 1.35 -filament_deretract_speed = 25 -filament_max_volumetric_speed = 2 -filament_notes = "Based on colorFabb_XT, XT-CF20 is a carbon fiber composite material. Loaded with no less than 20% specially sourced carbon fibers we have developed a very stiff and tough 3D printing filament made for functional parts. It is truly a professional printers go-to material, especially for users looking for high melt strength, high melt viscosity and good dimensional accuracy and stability.\n\nhttps://colorfabb.com/xt-cf20" -filament_retract_before_travel = 1 -filament_retract_length = 1.4 -filament_retract_speed = 40 -filament_spool_weight = 236 -filament_vendor = ColorFabb -first_layer_temperature = 260 -full_fan_speed_layer = 5 -slowdown_below_layer_time = 15 -temperature = 260 - -[filament:ERYONE PETG @MEGA] -inherits = *PETG_mega* -filament_vendor = ERYONE -filament_cost = 20.99 -filament_notes = "https://eryone.com/petg/show/10.html" - -[filament:FormFutura HDglass @MEGA] -inherits = *PETG_mega* -filament_vendor = FormFutura -filament_cost = 46.65 -filament_notes = "HDglass is a high performance PETG type of 3D printer with unsurpassed 3D printing properties and improved mechanical strength, flexibility, toughness and heat resistance.\n\nhttps://www.formfutura.com/shop/product/hdglass-2812" - -[filament:FormFutura ReForm rPET @MEGA] -inherits = *PETG_mega* -filament_vendor = FormFutura -filament_cost = 26.65 -filament_notes = "ReForm rPET is a recycled PETG type of 3D printer filament that is made from post-industrial waste streams of a nearby located plastic bottle manufacturer.\n\nhttps://www.formfutura.com/shop/product/reform-rpet-2836" -filament_spool_weight = 176 - -[filament:Janbex transparent PETG @MEGA] -inherits = *PETG_mega* -filament_vendor = Janbex -filament_cost = 31.99 -filament_spool_weight = 222 -first_layer_temperature = 215 -min_fan_speed = 100 -temperature = 210 - -[filament:DAS FILAMENT PETG @MEGA] -inherits = *PETG_mega* -filament_vendor = DAS FILAMENT -bed_temperature = 75 -first_layer_bed_temperature = 75 -first_layer_temperature = 220 -temperature = 225 - -[filament:*PLA_mega*] -inherits = *common_mega* -bed_temperature = 60 -disable_fan_first_layers = 1 -filament_colour = #FF3232 -filament_cost = 25.40 -filament_density = 1.24 -filament_max_volumetric_speed = 10 -first_layer_bed_temperature = 65 -first_layer_temperature = 215 -min_fan_speed = 100 -temperature = 210 - -[filament:Generic PLA @MEGA] -inherits = *PLA_mega* - -[filament:3Dmensionals PLA @MEGA] -inherits = *PLA_mega* -filament_vendor = 3Dmensionals -filament_cost = 22.90 -filament_notes = "Das 3DFilaments - PLA von 3Dmensionals ist ein sehr leicht zu druckendes 3D-Drucker Filament. Dabei handelt es sich um ein etwas härteres PLA mit einer exzellenten thermischen Stabilität. Das Filament zeichnet sich vor allem durch verzugfreies 3D-Drucken aus und weist minimale bis keine Verformung nach dem Abkühlen auf. Daher ist es besonders gut für den Druck größerer Objekte geeignet. Zudem bietet 3DFilaments - PLA über die gesamte Fadenläge eine hervorragende Durchmesser- und Rundheitstoleranz.\n\nhttps://www.3dmensionals.de/3dfilaments?number=PSU3DM001V" - -[filament:3D Warhorse PLA @MEGA] -inherits = *PLA_mega* -filament_vendor = 3D Warhorse -filament_cost = 19.99 - -[filament:AMOLEN wood PLA] -inherits = *PLA_mega* -filament_vendor = AMOLEN -compatible_printers_condition = nozzle_diameter[0]>0.35 and printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_I3_MEGA.*/ -extrusion_multiplier = 1.1 -filament_colour = #DFC287 -filament_cost = 33.99 -filament_density = 1.23 -filament_max_volumetric_speed = 9 -filament_notes = "https://amolen.com/collections/wood/products/amolen-pla-filament-1-75mm-wood-color-3d-printer-filament-1kg2-2lb" - -[filament:FormFutura EasyFil PLA @MEGA] -inherits = *PLA_mega* -filament_vendor = FormFutura -filament_cost = 39.93 -filament_notes = "EasyFil PLA is an easy to print PLA type of 3D printer filament that is available in a wide variety of colors. Its improved flowing behavior make 3D printed layers flow more into each other.\n\nhttps://www.formfutura.com/shop/product/easyfil-pla-2801" - -[filament:FormFutura ReForm rPLA @MEGA] -inherits = *PLA_mega* -filament_vendor = FormFutura -filament_cost = 26.65 -filament_notes = "ReForm is a sustainable initiative within Formfutura to efficiently manage residual extrusion waste streams and re-use them into high-end upcycled filaments. The ideology behind ReForm is to a make 3D printing more sustainable – without having to make compromises on material properties – and yet keep it affordable.\n\nhttps://www.formfutura.com/shop/product/reform-rpla-2838" - -[filament:GIANTARM PLA @MEGA] -inherits = *PLA_mega* -filament_vendor = GIANTARM -filament_cost = 24.99 - -[filament:Prusament PLA @MEGA] -inherits = *PLA_mega* -filament_vendor = Prusa Polymers -filament_cost = 30.24 -filament_notes = "Affordable filament for everyday printing in premium quality manufactured in-house by Josef Prusa" -filament_spool_weight = 201 -temperature = 215 - -[filament:Verbatim PLA @MEGA] -inherits = *PLA_mega* -filament_vendor = Verbatim -filament_cost = 23.88 - -[printer:*common_mega*] -printer_technology = FFF -bed_shape = 0x0,210x0,210x210,0x210 -before_layer_gcode = ;BEFORE_LAYER_CHANGE\nG92 E0.0\n;[layer_z] -default_filament_profile = Generic PLA @MEGA -default_print_profile = 0.15mm QUALITY @MEGA -deretract_speed = 50 -end_gcode = G1 E-1.0 F2100 ; retract\nG92 E0.0\nG1{if max_layer_z < max_print_height} Z{z_offset+min(max_layer_z+30, max_print_height)}{endif} E-34.0 F720 ; move print head up & retract filament\nG4 ; wait\nM104 S0 ; turn off temperature\nM140 S0 ; turn off heatbed\nM107 ; turn off fan\nG1 X0 Y105 F3000 ; park print head\nM84 ; disable motors -extruder_colour = #808080 -gcode_flavor = marlin -layer_gcode = ;AFTER_LAYER_CHANGE\n;[layer_z] -max_layer_height = 0.36 -max_print_height = 205 -remaining_times = 1 -retract_before_travel = 1.5 -retract_before_wipe = 60% -retract_layer_change = 1 -retract_length = 6 -retract_lift = 0.075 -retract_lift_below = 204 -retract_speed = 40 -silent_mode = 0 -start_gcode = G90 ; use absolute coordinates\nM83 ; extruder relative mode\nM204 S[machine_max_acceleration_extruding] T[machine_max_acceleration_retracting]\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nG28 ; home all\nG1 Y1.0 Z0.3 F1000 ; move print head up\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG92 E0.0\n; initial load\nG1 X205.0 E19 F1000\nG1 Y1.6\nG1 X5.0 E19 F1000\nG92 E0.0\n; intro line\nG1 Y2.0 Z0.2 F1000\nG1 X65.0 E9.0 F1000\nG1 X105.0 E12.5 F1000\nG92 E0.0 -thumbnails = 16x16,220x124 -use_relative_e_distances = 1 -wipe = 1 -machine_max_acceleration_e = 10000 -machine_max_acceleration_extruding = 1250 -machine_max_acceleration_retracting = 1250 -machine_max_acceleration_x = 3000 -machine_max_acceleration_y = 2000 -machine_max_acceleration_z = 60 -machine_max_feedrate_e = 60 -machine_max_feedrate_x = 500 -machine_max_feedrate_y = 500 -machine_max_feedrate_z = 6 -machine_max_jerk_e = 5 -machine_max_jerk_x = 10 -machine_max_jerk_y = 10 -machine_max_jerk_z = 0.4 - -[printer:Anycubic i3 Mega] -inherits = *common_mega* -printer_model = I3MEGA -printer_variant = 0.4 -printer_notes = Do not remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_ANYCUBIC\nPRINTER_MODEL_I3_MEGA\nPRINTER_HAS_BOWDEN - -[printer:Anycubic i3 Mega S] -inherits = *common_mega* -printer_model = I3MEGAS -printer_variant = 0.4 -printer_notes = Do not remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_ANYCUBIC\nPRINTER_MODEL_I3_MEGA_S\nPRINTER_HAS_BOWDEN -machine_max_feedrate_e = 30 -machine_max_feedrate_z = 8 - - -## Anycubic PREDATOR -## Author: https://github.com/tillverka3d -## Initial PR: https://github.com/prusa3d/PrusaSlicer/pull/4960 - -######################################### -###### begin common print presets ####### -######################################### - -# Common print preset -[print:*common predator*] -spiral_vase = 0 -top_solid_min_thickness = 0.8 -bottom_solid_min_thickness = 0.6 -extra_perimeters = 0 -ensure_vertical_shell_thickness = 1 -avoid_crossing_perimeters = 0 -thin_walls = 0 -overhangs = 1 -seam_position = nearest -external_perimeters_first = 0 -fill_density = 20% -external_fill_pattern = rectilinear -infill_every_layers = 1 -infill_only_where_needed = 0 -solid_infill_every_layers = 0 -fill_angle = 45 -solid_infill_below_area = 20 -bridge_angle = 0 -only_retract_when_crossing_perimeters = 0 -infill_first = 0 -skirts = 1 -skirt_distance = 4 -skirt_height = 1 -min_skirt_length = 8 -brim_width = 0 -support_material = 0 -support_material_auto = 1 -support_material_threshold = 50 -support_material_enforce_layers = 0 -raft_layers = 0 -support_material_contact_distance = 0.1 -support_material_pattern = rectilinear -support_material_with_sheath = 0 -support_material_spacing = 2 -support_material_angle = 0 -support_material_interface_layers = 2 -support_material_interface_spacing = 0.2 -support_material_interface_contact_loops = 0 -support_material_buildplate_only = 0 -support_material_xy_spacing = 60% -dont_support_bridges = 1 -support_material_synchronize_layers = 0 -travel_speed = 94 -first_layer_speed = 15 -perimeter_acceleration = 0 -infill_acceleration = 0 -bridge_acceleration = 0 -first_layer_acceleration = 0 -default_acceleration = 0 -max_volumetric_speed = 15 -perimeter_extruder = 1 -infill_extruder = 1 -solid_infill_extruder = 1 -support_material_extruder = 0 -support_material_interface_extruder = 0 -ooze_prevention = 0 -standby_temperature_delta = -5 -wipe_tower = 0 -wipe_tower_x = 170 -wipe_tower_y = 140 -wipe_tower_width = 60 -wipe_tower_rotation_angle = 0 -wipe_tower_bridging = 10 -interface_shells = 0 -bridge_flow_ratio = 0.8 -resolution = 0 -xy_size_compensation = 0 -elefant_foot_compensation = 0.2 -clip_multipart_objects = 1 -complete_objects = 0 -extruder_clearance_radius = 45 -extruder_clearance_height = 25 -gcode_comments = 0 -output_filename_format = {input_filename_base}.gcode -post_process = -notes = -max_volumetric_extrusion_rate_slope_negative = 0 -max_volumetric_extrusion_rate_slope_positive = 0 -print_settings_id = - -# Common print preset -[print:*common predator 0.4 nozzle*] -inherits = *common predator* -first_layer_height = 0.16 -infill_overlap = 25% -compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_PREDATOR.*/ and printer_notes=~/.*PRINTER_HAS_BOWDEN.*/ and nozzle_diameter[0]==0.4 - -# Common print preset -[print:*common predator 0.6 nozzle*] -inherits = *common predator* -first_layer_height = 0.24 -infill_overlap = 27% -compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_PREDATOR.*/ and printer_notes=~/.*PRINTER_HAS_BOWDEN.*/ and nozzle_diameter[0]==0.6 - -# Common print preset -[print:*common predator 0.8 nozzle*] -inherits = *common predator* -first_layer_height = 0.32 -infill_overlap = 30% -compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_PREDATOR.*/ and printer_notes=~/.*PRINTER_HAS_BOWDEN.*/ and nozzle_diameter[0]==0.8 - -# Common print preset -[print:*common predator quality*] -perimeter_speed = 50 -small_perimeter_speed = 15 -external_perimeter_speed = 70% -infill_speed = 65 -solid_infill_speed = 85% -top_solid_infill_speed = 85% -support_material_speed = 30 -support_material_interface_speed = 85% -bridge_speed = 30 -gap_fill_speed = 40 -ironing_speed = 15 - -# Common print preset -[print:*common predator speed*] -perimeter_speed = 70 -small_perimeter_speed = 15 -external_perimeter_speed = 70% -infill_speed = 85 -solid_infill_speed = 85% -top_solid_infill_speed = 85% -support_material_speed = 30 -support_material_interface_speed = 85% -bridge_speed = 30 -gap_fill_speed = 40 -ironing_speed = 15 - -# Common print preset -[print:*common predator 0.4 nozzle detailed*] -inherits = *common predator 0.4 nozzle* -extrusion_width = 0.42 -first_layer_extrusion_width = 0.41 -perimeter_extrusion_width = 0.42 -external_perimeter_extrusion_width = 0.42 -infill_extrusion_width = 0.4 -solid_infill_extrusion_width = 0.4 -top_infill_extrusion_width = 0.4 -support_material_extrusion_width = 0.38 - -# Common print preset -[print:*common predator 0.4 nozzle coarse*] -inherits = *common predator 0.4 nozzle* -extrusion_width = 0.44 -first_layer_extrusion_width = 0.42 -perimeter_extrusion_width = 0.5 -external_perimeter_extrusion_width = 0.5 -infill_extrusion_width = 0.5 -solid_infill_extrusion_width = 0.5 -top_infill_extrusion_width = 0.4 -support_material_extrusion_width = 0.38 - -# Common print preset -[print:*common predator 0.6 nozzle detailed*] -inherits = *common predator 0.6 nozzle* -extrusion_width = 0.64 -first_layer_extrusion_width = 0.62 -perimeter_extrusion_width = 0.64 -external_perimeter_extrusion_width = 0.64 -infill_extrusion_width = 0.6 -solid_infill_extrusion_width = 0.6 -top_infill_extrusion_width = 0.6 -support_material_extrusion_width = 0.56 - -# Common print preset -[print:*common predator 0.6 nozzle coarse*] -inherits = *common predator 0.6 nozzle* -extrusion_width = 0.67 -first_layer_extrusion_width = 0.64 -perimeter_extrusion_width = 0.7 -external_perimeter_extrusion_width = 0.7 -infill_extrusion_width = 0.7 -solid_infill_extrusion_width = 0.7 -top_infill_extrusion_width = 0.6 -support_material_extrusion_width = 0.56 - -# Common print preset -[print:*common predator 0.8 nozzle detailed*] -inherits = *common predator 0.8 nozzle* -extrusion_width = 0.84 -first_layer_extrusion_width = 0.82 -perimeter_extrusion_width = 0.84 -external_perimeter_extrusion_width = 0.84 -infill_extrusion_width = 0.8 -solid_infill_extrusion_width = 0.8 -top_infill_extrusion_width = 0.8 -support_material_extrusion_width = 0.72 - -# Common print preset -[print:*common predator 0.8 nozzle coarse*] -inherits = *common predator 0.8 nozzle* -extrusion_width = 0.87 -first_layer_extrusion_width = 0.84 -perimeter_extrusion_width = 0.9 -external_perimeter_extrusion_width = 0.9 -infill_extrusion_width = 0.9 -solid_infill_extrusion_width = 0.9 -top_infill_extrusion_width = 0.8 -support_material_extrusion_width = 0.72 - -######################################### -####### end common print presets ######## -######################################### - -######################################### -########## begin print presets ########## -######################################### - -[print:0.08mm 0.4 nozzle DETAILED QUALITY @PREDATOR] -inherits = *common predator 0.4 nozzle detailed*; *common predator quality* -layer_height = 0.08 -max_print_speed = 50 -perimeters = 3 -fill_pattern = grid - -[print:0.16mm 0.4 nozzle DETAILED QUALITY @PREDATOR] -inherits = *common predator 0.4 nozzle detailed*; *common predator quality* -layer_height = 0.16 -max_print_speed = 60 -perimeters = 3 -fill_pattern = grid - -[print:0.16mm 0.4 nozzle COARSE QUALITY @PREDATOR] -inherits = *common predator 0.4 nozzle coarse*; *common predator quality* -layer_height = 0.16 -max_print_speed = 60 -perimeters = 3 -fill_pattern = grid - -[print:0.24mm 0.4 nozzle DETAILED QUALITY @PREDATOR] -inherits = *common predator 0.4 nozzle detailed*; *common predator quality* -layer_height = 0.24 -max_print_speed = 70 -perimeters = 3 -fill_pattern = grid - -[print:0.24mm 0.4 nozzle COARSE QUALITY @PREDATOR] -inherits = *common predator 0.4 nozzle coarse*; *common predator quality* -layer_height = 0.24 -max_print_speed = 70 -perimeters = 3 -fill_pattern = grid - -[print:0.32mm 0.4 nozzle DETAILED QUALITY @PREDATOR] -inherits = *common predator 0.4 nozzle detailed*; *common predator quality* -layer_height = 0.32 -max_print_speed = 70 -perimeters = 3 -fill_pattern = grid - -[print:0.32mm 0.4 nozzle COARSE QUALITY @PREDATOR] -inherits = *common predator 0.4 nozzle coarse*; *common predator quality* -layer_height = 0.32 -max_print_speed = 70 -perimeters = 3 -fill_pattern = grid - -[print:0.16mm 0.6 nozzle DETAILED QUALITY @PREDATOR] -inherits = *common predator 0.6 nozzle detailed*; *common predator quality* -layer_height = 0.16 -max_print_speed = 70 -perimeters = 2 -fill_pattern = gyroid - -[print:0.16mm 0.6 nozzle DETAILED SPEED @PREDATOR] -inherits = *common predator 0.6 nozzle detailed*; *common predator speed* -layer_height = 0.16 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.16mm 0.6 nozzle COARSE QUALITY @PREDATOR] -inherits = *common predator 0.6 nozzle coarse*; *common predator quality* -layer_height = 0.16 -max_print_speed = 70 -perimeters = 2 -fill_pattern = gyroid - -[print:0.16mm 0.6 nozzle COARSE SPEED @PREDATOR] -inherits = *common predator 0.6 nozzle coarse*; *common predator speed* -layer_height = 0.16 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.24mm 0.6 nozzle DETAILED QUALITY @PREDATOR] -inherits = *common predator 0.6 nozzle detailed*; *common predator quality* -layer_height = 0.24 -max_print_speed = 70 -perimeters = 2 -fill_pattern = gyroid - -[print:0.24mm 0.6 nozzle DETAILED SPEED @PREDATOR] -inherits = *common predator 0.6 nozzle detailed*; *common predator speed* -layer_height = 0.24 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.24mm 0.6 nozzle COARSE QUALITY @PREDATOR] -inherits = *common predator 0.6 nozzle coarse*; *common predator quality* -layer_height = 0.24 -max_print_speed = 70 -perimeters = 2 -fill_pattern = gyroid - -[print:0.24mm 0.6 nozzle COARSE SPEED @PREDATOR] -inherits = *common predator 0.6 nozzle coarse*; *common predator speed* -layer_height = 0.24 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.32mm 0.6 nozzle DETAILED QUALITY @PREDATOR] -inherits = *common predator 0.6 nozzle detailed*; *common predator quality* -layer_height = 0.32 -max_print_speed = 70 -perimeters = 2 -fill_pattern = gyroid - -[print:0.32mm 0.6 nozzle DETAILED SPEED @PREDATOR] -inherits = *common predator 0.6 nozzle detailed*; *common predator speed* -layer_height = 0.32 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.32mm 0.6 nozzle COARSE QUALITY @PREDATOR] -inherits = *common predator 0.6 nozzle coarse*; *common predator quality* -layer_height = 0.32 -max_print_speed = 70 -perimeters = 2 -fill_pattern = gyroid - -[print:0.32mm 0.6 nozzle COARSE SPEED @PREDATOR] -inherits = *common predator 0.6 nozzle coarse*; *common predator speed* -layer_height = 0.32 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.4mm 0.6 nozzle DETAILED QUALITY @PREDATOR] -inherits = *common predator 0.6 nozzle detailed*; *common predator quality* -layer_height = 0.4 -max_print_speed = 70 -perimeters = 2 -fill_pattern = gyroid - -[print:0.4mm 0.6 nozzle DETAILED SPEED @PREDATOR] -inherits = *common predator 0.6 nozzle detailed*; *common predator speed* -layer_height = 0.4 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.4mm 0.6 nozzle COARSE QUALITY @PREDATOR] -inherits = *common predator 0.6 nozzle coarse*; *common predator quality* -layer_height = 0.4 -max_print_speed = 70 -perimeters = 2 -fill_pattern = gyroid - -[print:0.4mm 0.6 nozzle COARSE SPEED @PREDATOR] -inherits = *common predator 0.6 nozzle coarse*; *common predator speed* -layer_height = 0.4 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.24mm 0.8 nozzle DETAILED QUALITY @PREDATOR] -inherits = *common predator 0.8 nozzle detailed*; *common predator quality* -layer_height = 0.24 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.24mm 0.8 nozzle DETAILED SPEED @PREDATOR] -inherits = *common predator 0.8 nozzle detailed*; *common predator speed* -layer_height = 0.24 -max_print_speed = 90 -perimeters = 2 -fill_pattern = gyroid - -[print:0.24mm 0.8 nozzle COARSE QUALITY @PREDATOR] -inherits = *common predator 0.8 nozzle coarse*; *common predator quality* -layer_height = 0.24 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.24mm 0.8 nozzle COARSE SPEED @PREDATOR] -inherits = *common predator 0.8 nozzle coarse*; *common predator speed* -layer_height = 0.24 -max_print_speed = 90 -perimeters = 2 -fill_pattern = gyroid - -[print:0.32mm 0.8 nozzle DETAILED QUALITY @PREDATOR] -inherits = *common predator 0.8 nozzle detailed*; *common predator quality* -layer_height = 0.32 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.32mm 0.8 nozzle DETAILED SPEED @PREDATOR] -inherits = *common predator 0.8 nozzle detailed*; *common predator speed* -layer_height = 0.32 -max_print_speed = 90 -perimeters = 2 -fill_pattern = gyroid - -[print:0.32mm 0.8 nozzle COARSE QUALITY @PREDATOR] -inherits = *common predator 0.8 nozzle coarse*; *common predator quality* -layer_height = 0.32 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.32mm 0.8 nozzle COARSE SPEED @PREDATOR] -inherits = *common predator 0.8 nozzle coarse*; *common predator speed* -layer_height = 0.32 -max_print_speed = 90 -perimeters = 2 -fill_pattern = gyroid - -[print:0.4mm 0.8 nozzle DETAILED QUALITY @PREDATOR] -inherits = *common predator 0.8 nozzle detailed*; *common predator quality* -layer_height = 0.4 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.4mm 0.8 nozzle DETAILED SPEED @PREDATOR] -inherits = *common predator 0.8 nozzle detailed*; *common predator speed* -layer_height = 0.4 -max_print_speed = 90 -perimeters = 2 -fill_pattern = gyroid - -[print:0.4mm 0.8 nozzle COARSE QUALITY @PREDATOR] -inherits = *common predator 0.8 nozzle coarse*; *common predator quality* -layer_height = 0.4 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.4mm 0.8 nozzle COARSE SPEED @PREDATOR] -inherits = *common predator 0.8 nozzle coarse*; *common predator speed* -layer_height = 0.4 -max_print_speed = 90 -perimeters = 2 -fill_pattern = gyroid - -[print:0.48mm 0.8 nozzle DETAILED QUALITY @PREDATOR] -inherits = *common predator 0.8 nozzle detailed*; *common predator quality* -layer_height = 0.48 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.48mm 0.8 nozzle DETAILED SPEED @PREDATOR] -inherits = *common predator 0.8 nozzle detailed*; *common predator speed* -layer_height = 0.48 -max_print_speed = 90 -perimeters = 2 -fill_pattern = gyroid - -[print:0.48mm 0.8 nozzle COARSE QUALITY @PREDATOR] -inherits = *common predator 0.8 nozzle coarse*; *common predator quality* -layer_height = 0.48 -max_print_speed = 80 -perimeters = 2 -fill_pattern = gyroid - -[print:0.48mm 0.8 nozzle COARSE SPEED @PREDATOR] -inherits = *common predator 0.8 nozzle coarse*; *common predator speed* -layer_height = 0.48 -max_print_speed = 90 -perimeters = 2 -fill_pattern = gyroid - -######################################### -########### end print presets ########### -######################################### - -######################################### -######## begin filament presets ######### -######################################### - -# Common filament preset -[filament:*common predator*] -cooling = 0 -compatible_printers = -extrusion_multiplier = 1 -filament_cost = 0 -filament_density = 0 -filament_diameter = 1.75 -filament_notes = "" -filament_settings_id = "" -filament_soluble = 0 -min_print_speed = 15 -slowdown_below_layer_time = 20 -compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_PREDATOR.*/ - -[filament:*PLA predator*] -inherits = *common predator* -bed_temperature = 60 -fan_below_layer_time = 100 -filament_colour = #FF3232 -filament_max_volumetric_speed = 10 -filament_type = PLA -filament_density = 1.24 -filament_cost = 20 -first_layer_bed_temperature = 60 -first_layer_temperature = 200 -fan_always_on = 1 -cooling = 1 -max_fan_speed = 100 -min_fan_speed = 100 -bridge_fan_speed = 100 -disable_fan_first_layers = 1 -temperature = 200 - -[filament:*PET predator*] -inherits = *common predator* -bed_temperature = 70 -cooling = 1 -disable_fan_first_layers = 3 -fan_below_layer_time = 20 -filament_colour = #FF8000 -filament_max_volumetric_speed = 8 -filament_type = PETG -filament_density = 1.27 -filament_cost = 30 -first_layer_bed_temperature =70 -first_layer_temperature = 240 -fan_always_on = 1 -max_fan_speed = 50 -min_fan_speed = 20 -bridge_fan_speed = 100 -temperature = 240 - -[filament:*ABS predator*] -inherits = *common predator* -bed_temperature = 100 -cooling = 0 -disable_fan_first_layers = 3 -fan_below_layer_time = 20 -filament_colour = #3A80CA -filament_max_volumetric_speed = 10 -filament_type = ABS -filament_density = 1.04 -filament_cost = 20 -first_layer_bed_temperature = 100 -first_layer_temperature = 245 -fan_always_on = 0 -max_fan_speed = 0 -min_fan_speed = 0 -bridge_fan_speed = 30 -top_fan_speed = 0 -temperature = 245 - -[filament:Generic PLA @PREDATOR] -inherits = *PLA predator* -filament_vendor = Generic - -[filament:Generic PETG @PREDATOR] -inherits = *PET predator* -filament_vendor = Generic - -[filament:Generic ABS @PREDATOR] -inherits = *ABS predator* -filament_vendor = Generic - -######################################### -######### end filament presets ########## -######################################### - -######################################### -######### begin printer presets ######### -######################################### - -# Anycubic predator common printer preset -[printer:*common predator*] -printer_vendor = Anycubic -printer_model = Predator -printer_technology = FFF -printer_variant = 0.4 -thumbnails = 16x16,220x124 -bed_shape = 188.779x16.516,186.621x32.9063,183.043x49.0462,178.072x64.8128,171.745x80.0862,164.112x94.75,155.229x108.693,145.165x121.808,133.997x133.997,121.808x145.165,108.693x155.229,94.75x164.112,80.0862x171.745,64.8128x178.072,49.0462x183.043,32.9063x186.621,16.516x188.779,1.16035e-14x189.5,-16.516x188.779,-32.9063x186.621,-49.0462x183.043,-64.8128x178.072,-80.0862x171.745,-94.75x164.112,-108.693x155.229,-121.808x145.165,-133.997x133.997,-145.165x121.808,-155.229x108.693,-164.112x94.75,-171.745x80.0862,-178.072x64.8128,-183.043x49.0462,-186.621x32.9063,-188.779x16.516,-189.5x2.32071e-14,-188.779x-16.516,-186.621x-32.9063,-183.043x-49.0462,-178.072x-64.8128,-171.745x-80.0862,-164.112x-94.75,-155.229x-108.693,-145.165x-121.808,-133.997x-133.997,-121.808x-145.165,-108.693x-155.229,-94.75x-164.112,-80.0862x-171.745,-64.8128x-178.072,-49.0462x-183.043,-32.9063x-186.621,-16.516x-188.779,-3.48106e-14x-189.5,16.516x-188.779,32.9063x-186.621,49.0462x-183.043,64.8128x-178.072,80.0862x-171.745,94.75x-164.112,108.693x-155.229,121.808x-145.165,133.997x-133.997,145.165x-121.808,155.229x-108.693,164.112x-94.75,171.745x-80.0862,178.072x-64.8128,183.043x-49.0462,186.621x-32.9063,188.779x-16.516,189.5x-4.64141e-14 -max_print_height = 445 -z_offset = 0 -single_extruder_multi_material = 0 -gcode_flavor = reprap -silent_mode = 0 -remaining_times = 0 -use_relative_e_distances = 0 -use_firmware_retraction = 0 -use_volumetric_e = 0 -variable_layer_height = 1 -start_gcode = ; start_gcode | start\n\n; v11 2020-11-14_11-27 tillverka\n\n; set metric values\n\nG21\n\n; use absolute positioning\n\nG90\n\n; set extruder to absolute mode\n\nM82\n\n; start with fan off\n\nM107\n\n; set temps\n\nM104 S[first_layer_temperature]\nM140 S[first_layer_bed_temperature]\n\n; home xy\n\nG28 X0 Y0\n\n; home z\n\nG28 Z0\n\n; move the head down to Z 94mm\n\nG1 Z94.0 F2394\n\n; set and wait for temps\n\nM109 S[first_layer_temperature]\nM190 S[first_layer_bed_temperature]\n\n; zero the extruded length\n\nG92 E0\n\n; extrude 3mm of feed stock\n\nG1 F200 E3\n\n; zero the extruded length again\n\nG92 E0\n\n; set speed\n\nG1 F{travel_speed}\n\n; print preskirt\n\nG92 E0\nG1 E3.94000 F2520.00000\n\nG1 X125.464 Y-139.310\nG1 Z0.329 F3994.000\n\nG1 F994.000\n\nG1 X125.464 Y-139.310 E4.19679\nG1 X130.218 Y-134.876 E4.70359\nG1 X132.569 Y-132.567 E4.96053\nG1 X137.099 Y-127.877 E5.46890\nG1 X139.325 Y-125.447 E5.72585\nG1 X141.507 Y-122.981 E5.98254\nG1 X145.685 Y-118.002 E6.48934\nG1 X149.741 Y-112.810 E7.00296\nG1 X153.561 Y-107.552 E7.50975\nG1 X155.440 Y-104.819 E7.76827\nG1 X158.980 Y-99.367 E8.27506\nG1 X160.702 Y-96.558 E8.53201\nG1 X163.962 Y-90.911 E9.04038\nG1 X165.535 Y-88.015 E9.29732\nG1 X168.496 Y-82.205 E9.80570\nG1 X169.915 Y-79.231 E10.06264\nG1 X171.280 Y-76.235 E10.31934\nG1 X173.819 Y-70.251 E10.82613\nG1 X176.180 Y-64.101 E11.33975\nG1 X178.297 Y-57.955 E11.84654\nG1 X179.294 Y-54.793 E12.10507\nG1 X181.085 Y-48.544 E12.61186\nG1 X181.911 Y-45.354 E12.86880\nG1 X183.378 Y-39.001 E13.37718\nG1 X184.035 Y-35.771 E13.63412\nG1 X185.168 Y-29.350 E14.14250\nG1 X185.655 Y-26.091 E14.39944\nG1 X186.084 Y-22.826 E14.65614\nG1 X186.764 Y-16.362 E15.16293\nG1 X187.223 Y-9.790 E15.67655\nG1 X187.450 Y-3.294 E16.18334\nG1 X187.479 Y0.002 E16.44028\nG1 X187.450 Y3.294 E16.69698\nG1 X187.223 Y9.810 E17.20529\nG1 X187.021 Y13.100 E17.46229\nG1 X186.454 Y19.575 E17.96909\nG1 X186.079 Y22.870 E18.22761\nG1 X185.174 Y29.307 E18.73440\nG1 X184.031 Y35.794 E19.24802\nG1 X182.679 Y42.152 E19.75481\nG1 X181.910 Y45.357 E20.01176\nG1 X180.223 Y51.655 E20.52013\nG1 X179.287 Y54.815 E20.77708\nG1 X177.272 Y61.017 E21.28545\nG1 X176.172 Y64.123 E21.54239\nG1 X175.019 Y67.207 E21.79909\nG1 X172.584 Y73.234 E22.30588\nG1 X169.905 Y79.252 E22.81950\nG1 X167.055 Y85.094 E23.32629\nG1 X165.524 Y88.035 E23.58482\nG1 X162.373 Y93.721 E24.09161\nG1 X160.700 Y96.560 E24.34855\nG1 X157.245 Y102.090 E24.85693\nG1 X155.427 Y104.838 E25.11387\nG1 X151.687 Y110.180 E25.62225\nG1 X149.727 Y112.829 E25.87919\nG1 X147.722 Y115.441 E26.13588\nG1 X143.631 Y120.493 E26.64268\nG1 X139.310 Y125.464 E27.15629\nG1 X134.876 Y130.218 E27.66309\nG1 X132.567 Y132.569 E27.92003\nG1 X127.877 Y137.099 E28.42840\nG1 X125.447 Y139.325 E28.68535\nG1 X122.981 Y141.507 E28.94204\nG1 X118.002 Y145.685 E29.44883\nG1 X112.810 Y149.741 E29.96245\nG1 X107.552 Y153.561 E30.46924\nG1 X104.819 Y155.440 E30.72777\nG1 X99.367 Y158.980 E31.23456\nG1 X96.558 Y160.702 E31.49151\nG1 X90.911 Y163.962 E31.99988\nG1 X88.015 Y165.535 E32.25682\nG1 X82.205 Y168.496 E32.76520\nG1 X79.231 Y169.915 E33.02214\nG1 X76.235 Y171.280 E33.27884\nG1 X70.251 Y173.819 E33.78563\nG1 X64.101 Y176.180 E34.29925\nG1 X57.955 Y178.297 E34.80604\nG1 X54.793 Y179.294 E35.06457\nG1 X48.544 Y181.085 E35.57136\nG1 X45.354 Y181.911 E35.82830\nG1 X39.001 Y183.378 E36.33668\nG1 X35.771 Y184.035 E36.59362\nG1 X29.350 Y185.168 E37.10200\nG1 X26.091 Y185.655 E37.35894\nG1 X22.826 Y186.084 E37.61563\nG1 X16.362 Y186.764 E38.12242\nG1 X9.790 Y187.223 E38.63605\nG1 X3.294 Y187.450 E39.14283\nG1 X-0.002 Y187.479 E39.39978\nG1 X-3.294 Y187.450 E39.65648\nG1 X-9.810 Y187.223 E40.16479\nG1 X-13.100 Y187.021 E40.42179\nG1 X-19.575 Y186.454 E40.92858\nG1 X-22.870 Y186.079 E41.18711\nG1 X-29.307 Y185.174 E41.69390\nG1 X-35.794 Y184.031 E42.20752\nG1 X-42.152 Y182.679 E42.71431\nG1 X-45.357 Y181.910 E42.97126\nG1 X-51.655 Y180.223 E43.47963\nG1 X-54.815 Y179.287 E43.73657\nG1 X-61.017 Y177.272 E44.24495\nG1 X-64.123 Y176.172 E44.50189\nG1 X-67.207 Y175.019 E44.75859\nG1 X-73.234 Y172.584 E45.26538\nG1 X-79.252 Y169.905 E45.77900\nG1 X-85.094 Y167.055 E46.28579\nG1 X-88.035 Y165.524 E46.54432\nG1 X-93.721 Y162.373 E47.05111\nG1 X-96.560 Y160.700 E47.30805\nG1 X-102.090 Y157.245 E47.81643\nG1 X-104.838 Y155.427 E48.07337\nG1 X-110.180 Y151.687 E48.58174\nG1 X-112.829 Y149.727 E48.83869\nG1 X-115.441 Y147.722 E49.09538\nG1 X-120.493 Y143.631 E49.60218\nG1 X-125.464 Y139.310 E50.11579\nG1 X-130.218 Y134.876 E50.62259\nG1 X-132.569 Y132.567 E50.87953\nG1 X-137.099 Y127.877 E51.38790\nG1 X-139.325 Y125.447 E51.64485\nG1 X-141.507 Y122.981 E51.90154\nG1 X-145.685 Y118.002 E52.40833\nG1 X-149.741 Y112.810 E52.92195\nG1 X-153.561 Y107.552 E53.42874\nG1 X-155.440 Y104.819 E53.68727\nG1 X-158.980 Y99.367 E54.19406\nG1 X-160.702 Y96.558 E54.45101\nG1 X-163.962 Y90.911 E54.95938\nG1 X-165.535 Y88.015 E55.21632\nG1 X-168.496 Y82.205 E55.72470\nG1 X-169.915 Y79.231 E55.98164\nG1 X-171.280 Y76.235 E56.23834\nG1 X-173.819 Y70.251 E56.74513\nG1 X-176.180 Y64.101 E57.25875\nG1 X-178.297 Y57.955 E57.76554\nG1 X-179.294 Y54.793 E58.02407\nG1 X-181.085 Y48.544 E58.53086\nG1 X-181.911 Y45.354 E58.78780\nG1 X-183.378 Y39.001 E59.29618\nG1 X-184.035 Y35.771 E59.55312\nG1 X-185.168 Y29.350 E60.06149\nG1 X-185.655 Y26.091 E60.31844\nG1 X-186.084 Y22.826 E60.57513\nG1 X-186.764 Y16.362 E61.08192\nG1 X-187.223 Y9.790 E61.59554\nG1 X-187.450 Y3.294 E62.10233\nG1 X-187.479 Y-0.002 E62.35928\nG1 X-187.450 Y-3.294 E62.61598\nG1 X-187.223 Y-9.810 E63.12429\nG1 X-187.021 Y-13.100 E63.38129\nG1 X-186.454 Y-19.575 E63.88808\nG1 X-186.079 Y-22.870 E64.14661\nG1 X-185.174 Y-29.307 E64.65340\nG1 X-184.031 Y-35.794 E65.16702\nG1 X-182.679 Y-42.152 E65.67381\nG1 X-181.910 Y-45.357 E65.93076\nG1 X-180.223 Y-51.655 E66.43913\nG1 X-179.287 Y-54.815 E66.69607\nG1 X-177.272 Y-61.017 E67.20445\nG1 X-176.172 Y-64.123 E67.46139\nG1 X-175.019 Y-67.207 E67.71809\nG1 X-172.584 Y-73.234 E68.22488\nG1 X-169.905 Y-79.252 E68.73850\nG1 X-167.055 Y-85.094 E69.24529\nG1 X-165.524 Y-88.035 E69.50382\nG1 X-162.373 Y-93.721 E70.01061\nG1 X-160.700 Y-96.560 E70.26755\nG1 X-157.245 Y-102.090 E70.77593\nG1 X-155.427 Y-104.838 E71.03287\nG1 X-151.687 Y-110.180 E71.54124\nG1 X-149.727 Y-112.829 E71.79819\nG1 X-147.722 Y-115.441 E72.05488\nG1 X-143.631 Y-120.493 E72.56167\nG1 X-139.310 Y-125.464 E73.07529\nG1 X-134.876 Y-130.218 E73.58209\nG1 X-132.567 Y-132.569 E73.83903\nG1 X-127.877 Y-137.099 E74.34740\nG1 X-125.447 Y-139.325 E74.60435\nG1 X-122.981 Y-141.507 E74.86104\nG1 X-118.002 Y-145.685 E75.36783\nG1 X-112.810 Y-149.741 E75.88145\nG1 X-107.552 Y-153.561 E76.38824\nG1 X-104.819 Y-155.440 E76.64677\nG1 X-99.367 Y-158.980 E77.15356\nG1 X-96.558 Y-160.702 E77.41051\nG1 X-90.911 Y-163.962 E77.91888\nG1 X-88.015 Y-165.535 E78.17582\nG1 X-82.205 Y-168.496 E78.68420\nG1 X-79.231 Y-169.915 E78.94114\nG1 X-76.235 Y-171.280 E79.19784\nG1 X-70.251 Y-173.819 E79.70463\nG1 X-64.101 Y-176.180 E80.21825\nG1 X-57.955 Y-178.297 E80.72504\nG1 X-54.793 Y-179.294 E80.98356\nG1 X-48.544 Y-181.085 E81.49036\nG1 X-45.354 Y-181.911 E81.74730\nG1 X-39.001 Y-183.378 E82.25568\nG1 X-35.771 Y-184.035 E82.51262\nG1 X-29.350 Y-185.168 E83.02099\nG1 X-26.091 Y-185.655 E83.27794\nG1 X-22.826 Y-186.084 E83.53463\nG1 X-16.362 Y-186.764 E84.04142\nG1 X-9.790 Y-187.223 E84.55504\nG1 X-3.294 Y-187.450 E85.06183\nG1 X0.006 Y-187.479 E85.31908\nG1 X6.521 Y-187.366 E85.82715\nG1 X9.810 Y-187.223 E86.08379\nG1 X13.100 Y-187.021 E86.34079\nG1 X19.575 Y-186.454 E86.84758\nG1 X22.870 Y-186.079 E87.10611\nG1 X29.307 Y-185.174 E87.61290\nG1 X35.794 Y-184.031 E88.12652\nG1 X42.152 Y-182.679 E88.63331\nG1 X45.357 Y-181.910 E88.89025\nG1 X51.655 Y-180.223 E89.39863\nG1 X54.815 Y-179.287 E89.65557\nG1 X61.017 Y-177.272 E90.16395\nG1 X64.123 Y-176.172 E90.42089\nG1 X67.207 Y-175.019 E90.67759\nG1 X73.234 Y-172.584 E91.18438\nG1 X79.252 Y-169.905 E91.69800\nG1 X85.094 Y-167.055 E92.20479\nG1 X88.035 Y-165.524 E92.46332\nG1 X93.721 Y-162.373 E92.97011\nG1 X96.560 Y-160.700 E93.22705\nG1 X102.090 Y-157.245 E93.73543\nG1 X104.838 Y-155.427 E93.99237\nG1 X110.180 Y-151.687 E94.50074\nG1 X112.829 Y-149.727 E94.75768\nG1 X115.441 Y-147.722 E95.01438\nG1 X120.493 Y-143.631 E95.52117\nG1 X122.911 Y-141.529 E95.77098\n\n; end preskirt\n; start_gcode | end -end_gcode = ; end_gcode | start\n\n; v11 2020-11-14_11-27 tillverka\n\n; use relative positioning\n\nG91\n\n; retract the filament a bit before lifting the nozzle to release some of the pressure\n\nG1 E-1 F300\n\n; home\n\nG28\n\n; use absolute positioning\n\nG90\n\n; cooldown\n\nM104 S0\nM140 S0\n\n; end_gcode | end\n -before_layer_gcode = -layer_gcode = -toolchange_gcode = -between_objects_gcode = -retract_length = 4 -retract_lift = 0.3 -retract_lift_above = 0 -retract_lift_below = 449 -retract_speed = 30 -deretract_speed = 0 -retract_restart_extra = 0 -retract_before_travel = 2 -retract_layer_change = 1 -wipe = 1 -retract_before_wipe = 70% -retract_length_toolchange = 10 -retract_restart_extra_toolchange = 0 -extruder_colour = #1193FF -machine_max_acceleration_e = 3000 -machine_max_acceleration_extruding = 1000 -machine_max_acceleration_retracting = 1000 -machine_max_acceleration_x = 1500 -machine_max_acceleration_y = 1500 -machine_max_acceleration_z = 1500 -machine_max_feedrate_e = 60 -machine_max_feedrate_x = 200 -machine_max_feedrate_y = 200 -machine_max_feedrate_z = 200 -machine_max_jerk_e = 5 -machine_max_jerk_x = 5 -machine_max_jerk_y = 5 -machine_max_jerk_z = 5 -machine_min_extruding_rate = 0 -machine_min_travel_rate = 0 -printer_settings_id = -printer_notes = Do not remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_ANYCUBIC\nPRINTER_MODEL_PREDATOR\nPRINTER_HAS_BOWDEN\n -default_filament_profile = Generic PLA @PREDATOR - -[printer:Anycubic Predator 0.4 nozzle] -inherits = *common predator* -printer_model = PREDATOR -printer_variant = 0.4 -nozzle_diameter = 0.4 -min_layer_height = 0.08 -max_layer_height = 0.32 -default_print_profile = 0.16mm 0.4 nozzle DETAILED QUALITY @PREDATOR - -[printer:Anycubic Predator 0.6 nozzle] -inherits = *common predator* -printer_model = PREDATOR -printer_variant = 0.6 -nozzle_diameter = 0.6 -min_layer_height = 0.12 -max_layer_height = 0.4 -default_print_profile = 0.24mm 0.8 nozzle DETAILED QUALITY @PREDATOR - -[printer:Anycubic Predator 0.8 nozzle] -inherits = *common predator* -printer_model = PREDATOR -printer_variant = 0.8 -nozzle_diameter = 0.8 -min_layer_height = 0.16 -max_layer_height = 0.48 -default_print_profile = 0.24mm 0.8 nozzle DETAILED QUALITY @PREDATOR - -## Anycubic 4MAX Pro 2.0 -## based on https://hartrusion.com/en/prusaslicer-config-for-anycubic-4max-pro-2-0/ - -[print:*common_4max*] -avoid_crossing_perimeters = 0 -avoid_crossing_perimeters_max_detour = 0 -bottom_fill_pattern = monotonic -bottom_solid_layers = 4 -bridge_acceleration = 300 -bridge_angle = 0 -bridge_flow_ratio = 0.65 -bridge_speed = 30 -brim_separation = 0 -brim_type = outer_only -brim_width = 0 -clip_multipart_objects = 1 -compatible_printers_condition = printer_model=="4MAXPRO20" and nozzle_diameter[0]==0.4 -complete_objects = 0 -default_acceleration = 900 -dont_support_bridges = 1 -draft_shield = disabled -elefant_foot_compensation = 0.2 -ensure_vertical_shell_thickness = 1 -external_perimeter_extrusion_width = 0 -external_perimeter_speed = 35 -external_perimeters_first = 0 -extra_perimeters = 0 -extruder_clearance_height = 20 -extruder_clearance_radius = 20 -extrusion_width = 0.45 -fill_angle = 45 -fill_density = 20% -fill_pattern = gyroid -first_layer_acceleration = 300 -first_layer_acceleration_over_raft = 0 -first_layer_extrusion_width = 0.65 -first_layer_height = 0.3 -first_layer_speed = 20 -first_layer_speed_over_raft = 30 -fuzzy_skin = none -fuzzy_skin_point_dist = 0.8 -fuzzy_skin_thickness = 0.3 -gap_fill_enabled = 1 -gap_fill_speed = 40 -gcode_comments = 0 -gcode_label_objects = 0 -gcode_resolution = 0.0125 -infill_acceleration = 600 -infill_anchor = 400% -infill_anchor_max = 50 -infill_every_layers = 1 -infill_extruder = 1 -infill_extrusion_width = 0 -infill_first = 0 -infill_only_where_needed = 0 -infill_overlap = 23% -infill_speed = 45 -inherits = -interface_shells = 0 -ironing = 0 -ironing_flowrate = 15% -ironing_spacing = 0.1 -ironing_speed = 15 -ironing_type = top -layer_height = 0.2 -max_print_speed = 50 -max_volumetric_speed = 0 -min_skirt_length = 0 -only_retract_when_crossing_perimeters = 0 -ooze_prevention = 0 -output_filename_format = {input_filename_base}_{layer_height}mm_{filament_type[0]}_{print_time}.gcode -overhangs = 1 -perimeter_acceleration = 500 -perimeter_extruder = 1 -perimeter_extrusion_width = 0 -perimeter_speed = 45 -perimeters = 3 -post_process = -print_settings_id = -raft_contact_distance = 0.1 -raft_expansion = 1.5 -raft_first_layer_density = 90% -raft_first_layer_expansion = 3 -raft_layers = 0 -resolution = 0 -seam_position = aligned -single_extruder_multi_material_priming = 1 -skirt_distance = 5 -skirt_height = 1 -skirts = 2 -slicing_mode = regular -small_perimeter_speed = 20 -solid_infill_below_area = 0 -solid_infill_every_layers = 0 -solid_infill_extruder = 1 -solid_infill_extrusion_width = 0 -solid_infill_speed = 45 -spiral_vase = 0 -standby_temperature_delta = -5 -support_material = 0 -support_material_angle = 0 -support_material_auto = 1 -support_material_bottom_contact_distance = 0 -support_material_bottom_interface_layers = -1 -support_material_buildplate_only = 1 -support_material_closing_radius = 2 -support_material_contact_distance = 0.2 -support_material_enforce_layers = 0 -support_material_extruder = 1 -support_material_extrusion_width = 0.4 -support_material_interface_contact_loops = 0 -support_material_interface_extruder = 1 -support_material_interface_layers = 2 -support_material_interface_pattern = rectilinear -support_material_interface_spacing = 0.2 -support_material_interface_speed = 30 -support_material_pattern = rectilinear-grid -support_material_spacing = 2.5 -support_material_speed = 45 -support_material_style = grid -support_material_synchronize_layers = 0 -support_material_threshold = 45 -support_material_with_sheath = 1 -support_material_xy_spacing = 60% -thick_bridges = 1 -thin_walls = 0 -top_fill_pattern = monotonic -top_infill_extrusion_width = 0.4 -top_solid_infill_speed = 30 -top_solid_layers = 5 -travel_speed = 60 -travel_speed_z = 0 -wipe_tower = 0 -wipe_tower_bridging = 10 -wipe_tower_brim_width = 2 -wipe_tower_no_sparse_layers = 0 -wipe_tower_rotation_angle = 0 -wipe_tower_width = 60 -wipe_tower_x = 180 -wipe_tower_y = 140 -xy_size_compensation = 0 - -[print:0.15mm Detail @4Max Pro 2.0] -inherits = *common_4max* -layer_height = 0.15 -bottom_solid_layers = 5 -top_solid_layers = 7 -perimeter_speed = 40 -external_perimeter_speed = 25 - -[print:0.20mm Quality @4Max Pro 2.0] -inherits = *common_4max* -external_perimeter_speed = 25 - -[print:0.30mm Draft @4Max Pro 2.0] -inherits = *common_4max* -layer_height = 0.3 -bottom_solid_layers = 3 -top_solid_layers = 3 - -[filament:*common_4max*] -bed_temperature = 60 -bridge_fan_speed = 100 -compatible_printers_condition = printer_model=="4MAXPRO20" -cooling = 1 -disable_fan_first_layers = 1 -extrusion_multiplier = 1 -fan_always_on = 1 -fan_below_layer_time = 30 -filament_density = 1.24 -filament_diameter = 1.75 -filament_max_volumetric_speed = 0 -filament_type = PLA -first_layer_bed_temperature = 60 -first_layer_temperature = 210 -full_fan_speed_layer = 5 -max_fan_speed = 100 -min_fan_speed = 80 -min_print_speed = 10 -slowdown_below_layer_time = 15 -temperature = 205 - -[filament:*PLA_4max*] -inherits = *common_4max* - -[filament:Generic PLA @4Max Pro 2.0] -inherits = *PLA_4max* -filament_vendor = Generic - -[filament:Anycubic PLA @4Max Pro 2.0] -inherits = *PLA_4max* -first_layer_temperature = 215 -temperature = 207 -filament_vendor = Anycubic - -[filament:Generic ABS @4Max Pro 2.0] -filament_vendor = Generic -compatible_printers_condition = printer_model=="4MAXPRO20" -bed_temperature = 100 -first_layer_bed_temperature = 100 -temperature = 245 -first_layer_temperature = 245 -bridge_fan_speed = 15 -cooling = 1 -disable_fan_first_layers = 3 -extrusion_multiplier = 1 -fan_always_on = 0 -fan_below_layer_time = 60 -filament_colour = #800000 -filament_density = 1.04 -filament_diameter = 1.75 -filament_type = ABS -full_fan_speed_layer = 0 -max_fan_speed = 0 -min_fan_speed = 0 -min_print_speed = 10 -slowdown_below_layer_time = 25 - -[filament:Generic TPU @4Max Pro 2.0] -filament_vendor = Generic -bed_temperature = 60 -bridge_fan_speed = 0 -compatible_printers_condition = printer_model=="4MAXPRO20" -cooling = 1 -disable_fan_first_layers = 3 -extrusion_multiplier = 1 -fan_always_on = 0 -fan_below_layer_time = 60 -filament_colour = #211AB5 -filament_density = 1.19 -filament_deretract_speed = 20 -filament_diameter = 1.75 -filament_retract_speed = 30 -filament_type = FLEX -filament_max_volumetric_speed = 1.65 -first_layer_bed_temperature = 60 -first_layer_temperature = 215 -full_fan_speed_layer = 0 -max_fan_speed = 0 -min_fan_speed = 0 -min_print_speed = 10 -slowdown_below_layer_time = 20 -temperature = 215 - -[filament:Polymaker PolyFlex TPU95 @4Max Pro 2.0] -filament_vendor = Polymaker -bed_temperature = 45 -bridge_fan_speed = 80 -compatible_printers_condition = printer_model=="4MAXPRO20" -cooling = 1 -disable_fan_first_layers = 5 -extrusion_multiplier = 1.04 -fan_always_on = 1 -fan_below_layer_time = 45 -filament_colour = #FD7D2F -filament_density = 1.22 -filament_deretract_speed = 25 -filament_diameter = 1.75 -filament_max_volumetric_speed = 1.65 -filament_retract_length = 4 -filament_retract_restart_extra = 0.1 -filament_retract_speed = 60 -filament_type = FLEX -first_layer_bed_temperature = 55 -first_layer_temperature = 215 -full_fan_speed_layer = 8 -max_fan_speed = 50 -min_fan_speed = 25 -min_print_speed = 10 -slowdown_below_layer_time = 10 -temperature = 217 - -[printer:Anycubic 4Max Pro 2.0] -printer_model = 4MAXPRO20 -printer_variant = 0.4 -printer_technology = FFF -bed_shape = 0x0,270x0,270x210,0x210 -color_change_gcode = M600 -default_filament_profile = Generic PLA @4Max Pro 2.0 -default_print_profile = 0.20mm Quality @4Max Pro 2.0 -deretract_speed = 25 -end_gcode = M104 S0 ; turn off extruder heating\nM140 S0 ; turn off bed heating\nM107 ; turn off fans\nG91 ; relative positioning\nG0 Z+0.5 ; move Z up a tiny bit\nG90 ; absolute positioning\nG0 X135 Y105 F{machine_max_feedrate_x[0]*60} ; move extruder to center position\nG0 Z190.5 F{machine_max_feedrate_z[0]*60} ; lower the plattform to Z min\nM84 ; steppers off\nG90 ; absolute positioning\n -extruder_offset = 0x0 -gcode_flavor = marlin -machine_limits_usage = time_estimate_only -machine_max_acceleration_e = 5000 -machine_max_acceleration_extruding = 1250 -machine_max_acceleration_retracting = 1250 -machine_max_acceleration_travel = 1500 -machine_max_acceleration_x = 900 -machine_max_acceleration_y = 900 -machine_max_acceleration_z = 100 -machine_max_feedrate_e = 120 -machine_max_feedrate_x = 200 -machine_max_feedrate_y = 200 -machine_max_feedrate_z = 16 -machine_max_jerk_e = 5 -machine_max_jerk_x = 6 -machine_max_jerk_y = 6 -machine_max_jerk_z = 0.2 -machine_min_extruding_rate = 0 -machine_min_travel_rate = 0 -max_layer_height = 0.3 -max_print_height = 190 -min_layer_height = 0.07 -nozzle_diameter = 0.4 -pause_print_gcode = M601 -remaining_times = 0 -retract_before_travel = 2 -retract_before_wipe = 0% -retract_layer_change = 1 -retract_length = 2.5 -retract_length_toolchange = 10 -retract_lift = 0 -retract_lift_above = 0 -retract_lift_below = 0 -retract_restart_extra = 0 -retract_restart_extra_toolchange = 0 -retract_speed = 35 -silent_mode = 0 -single_extruder_multi_material = 0 -start_gcode = G21 ; metric values\nG90 ; absolute positioning\nM82 ; set extruder to absolute mode\nM140 S[first_layer_bed_temperature] ; set bed temp\nG28 X0 Y0 ; home X and Y\nG28 Z0 ; home Z\nG1 Z30 F{machine_max_feedrate_z[0]*60} ; move Z a bit down to not blow on the bed edge while heating\nG1 X10 F3900 ; let some space on x to prevent the filament cooling exhaust from beeing blocked by the servo motor\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM104 S[first_layer_temperature] ; set extruder temp\nM106 S80 ; turn on fan to prevent air nozzle melt while heating up\nM109 S[first_layer_temperature] ; wait for extruder temp\nM107 ; start with the fan off\nG28 X0 ; goto X home again\nG92 E0 ; zero the extruded length\nG1 Z0.2 F360 ; move plattform upwards\n; extrude material next to the plattform (comment or remove following lines to disable)\nG1 F180 E20 ; extrude some material next to the plattform\nG92 E0 ; zero the extruded length\nG1 E-[retract_length] F{retract_speed[0]*60} ; do a filament retract\nG92 E0 ; zero the extruded length again\nG1 X5 F3900 ; move sideways to get rid of that string\nG1 E[retract_length] F{retract_speed[0]*60} ; do a filament deretract with retract parameters\nG92 E0 ; zero the extruded length again\n; draw intro line (comment or remove following lines to disable)\nG1 X30 E5 F700 ; draw intro line\nG92 E0 ; zero the extruded length\nG1 E-[retract_length] F{retract_speed[0]*60} ; do a filament retract\nG1 X40 Z2.0 ; move away from the introline\nG92 E0 ; zero the extruded length again\nG1 E[retract_length] F{retract_speed[0]*60} ; do a filament deretract with retract parameters\n; end of intro line code\nM117 Printing...\nG5 -use_firmware_retraction = 0 -use_relative_e_distances = 0 -use_volumetric_e = 0 -variable_layer_height = 1 -wipe = 0 -z_offset = 0 \ No newline at end of file +# Print profiles for the Anycubic printers. + +[vendor] +# Vendor name will be shown by the Config Wizard. +name = Anycubic +# Configuration version of this file. Config file will only be installed, if the config_version differs. +# This means, the server may force the PrusaSlicer configuration to be downgraded. +config_version = 0.1.1 +# Where to get the updates from? +config_update_url = https://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/Anycubic/ +# changelog_url = https://files.prusa3d.com/?latest=slicer-profiles&lng=%1% + +# The printer models will be shown by the Configuration Wizard in this order, +# also the first model installed & the first nozzle installed will be activated after install. +# Printer model name will be shown by the installation wizard. + +[printer_model:AKLP] +name = Anycubic Kossel Linear Plus +variants = 0.4 +technology = FFF +family = KOSSEL +bed_model = AKLP_Bed.stl +bed_texture = AK.svg +default_materials = Generic PLA @AKOSSEL; Generic PETG @AKOSSEL; Generic ABS @AKOSSEL + +[printer_model:AK] +name = Anycubic Kossel Pulley (Linear) +variants = 0.4 +technology = FFF +family = KOSSEL +bed_model = AK_Bed.stl +bed_texture = AK.svg +default_materials = Generic PLA @AKOSSEL; Generic PETG @AKOSSEL; Generic ABS @AKOSSEL + +[printer_model:MEGA0] +name = Anycubic Mega Zero +variants = 0.4 +technology = FFF +family = MEGA +bed_model = mega0_bed.stl +bed_texture = mega0.svg +default_materials = Generic PLA @MEGA0; Generic PETG @MEGA0; Anycubic PLA @MEGA0; Prusament PLA @MEGA0; Prusament PETG @MEGA0 + +[printer_model:I3MEGA] +name = Anycubic i3 Mega +variants = 0.4 +technology = FFF +family = MEGA +bed_model = i3megas_bed.stl +bed_texture = i3megas.svg + +[printer_model:I3MEGAS] +name = Anycubic i3 Mega S +variants = 0.4 +technology = FFF +family = MEGA +bed_model = i3megas_bed.stl +bed_texture = i3megas.svg + +[printer_model:4MAXPRO20] +name = Anycubic 4Max Pro 2.0 +variants = 0.4 +technology = FFF +family = 4Max +bed_model = 4MAXPRO20_bed.stl +bed_texture = 4MAXPRO20_texture.svg +default_materials = Generic PLA @4Max Pro 2.0; Generic TPU @4Max Pro 2.0; Generic ABS @4Max Pro 2.0 + +[printer_model:PREDATOR] +name = Anycubic Predator +variants = 0.4; 0.6; 0.8 +technology = FFF +family = PREDATOR +default_materials = Generic PLA @PREDATOR; Generic PETG @PREDATOR; Generic ABS @PREDATOR + +[printer_model:PHOTON MONO X] +name = Photon Mono X +variants = default +technology = SLA +family = PHOTON MONO +default_materials = Generic Blue Resin @MONO 0.05 + +# All presets starting with asterisk, for example *common*, are intermediate and they will +# not make it into the user interface. + +## Anycubic KOSSEL +## Author: https://github.com/tc0fh +## Initial PR: https://github.com/prusa3d/PrusaSlicer/pull/4220 + +# Common print preset +[print:*common_akossel*] +avoid_crossing_perimeters = 0 +bottom_solid_min_thickness = 0.5 +bridge_angle = 0 +bridge_flow_ratio = 0.8 +bridge_speed = 30 +brim_width = 0 +clip_multipart_objects = 1 +compatible_printers = +complete_objects = 0 +dont_support_bridges = 1 +elefant_foot_compensation = 0 +ensure_vertical_shell_thickness = 1 +external_fill_pattern = rectilinear +external_perimeters_first = 0 +external_perimeter_extrusion_width = 0.45 +extra_perimeters = 0 +extruder_clearance_height = 25 +extruder_clearance_radius = 45 +extrusion_width = 0.45 +fill_angle = 45 +fill_density = 20% +fill_pattern = grid +first_layer_extrusion_width = 0.42 +first_layer_height = 0.2 +first_layer_speed = 20 +gap_fill_speed = 40 +gcode_comments = 0 +infill_every_layers = 1 +infill_extruder = 1 +infill_extrusion_width = 0.45 +infill_first = 0 +infill_only_where_needed = 0 +infill_overlap = 25% +interface_shells = 0 +max_print_speed = 200 +max_volumetric_extrusion_rate_slope_negative = 0 +max_volumetric_extrusion_rate_slope_positive = 0 +max_volumetric_speed = 0 +min_skirt_length = 4 +notes = +overhangs = 0 +only_retract_when_crossing_perimeters = 0 +ooze_prevention = 0 +output_filename_format = {input_filename_base}_{layer_height}mm_{filament_type[0]}_{printer_model}_{print_time}.gcode +perimeters = 2 +perimeter_extruder = 1 +perimeter_extrusion_width = 0.45 +perimeter_speed = 45 +post_process = +print_settings_id = +raft_layers = 0 +resolution = 0 +seam_position = nearest +single_extruder_multi_material_priming = 0 +skirts = 2 +skirt_distance = 5 +skirt_height = 1 +small_perimeter_speed = 25 +solid_infill_below_area = 0 +solid_infill_every_layers = 0 +solid_infill_extruder = 1 +solid_infill_extrusion_width = 0.45 +spiral_vase = 0 +standby_temperature_delta = -5 +support_material = 0 +support_material_extruder = 0 +support_material_extrusion_width = 0.38 +support_material_interface_extruder = 0 +support_material_angle = 0 +support_material_buildplate_only = 0 +support_material_enforce_layers = 0 +support_material_contact_distance = 0.15 +support_material_interface_contact_loops = 0 +support_material_interface_layers = 2 +support_material_interface_spacing = 0.2 +support_material_interface_speed = 100% +support_material_pattern = rectilinear +support_material_spacing = 2 +support_material_speed = 50 +support_material_synchronize_layers = 0 +support_material_threshold = 45 +support_material_with_sheath = 0 +support_material_xy_spacing = 60% +thin_walls = 0 +top_infill_extrusion_width = 0.4 +top_solid_infill_speed = 40 +top_solid_min_thickness = 0.6 +travel_speed = 180 +wipe_tower = 1 +wipe_tower_bridging = 10 +wipe_tower_rotation_angle = 0 +wipe_tower_width = 60 +wipe_tower_x = 170 +wipe_tower_y = 140 +xy_size_compensation = 0 +bridge_acceleration = 1000 +default_acceleration = 1500 +first_layer_acceleration = 1000 +infill_acceleration = 1500 +perimeter_acceleration = 800 + +[print:*0.08mm_akossel*] +inherits = *common_akossel* +bottom_solid_layers = 10 +bridge_acceleration = 300 +bridge_flow_ratio = 0.7 +bridge_speed = 20 +external_perimeter_speed = 20 +first_layer_acceleration = 500 +gap_fill_speed = 20 +infill_acceleration = 800 +infill_speed = 40 +layer_height = 0.08 +max_print_speed = 80 +perimeter_acceleration = 300 +perimeter_speed = 30 +perimeters = 3 +small_perimeter_speed = 20 +solid_infill_speed = 40 +support_material_extrusion_width = 0.3 +support_material_spacing = 1.5 +support_material_speed = 40 +top_solid_infill_speed = 30 +top_solid_layers = 12 + +[print:*0.16mm_akossel*] +inherits = *common_akossel* +bottom_solid_layers = 5 +layer_height = 0.16 +top_solid_layers = 6 + +[print:*0.20mm_akossel*] +inherits = *common_akossel* +bottom_solid_layers = 4 +bridge_flow_ratio = 0.95 +layer_height = 0.20 +top_solid_layers = 5 + +[print:*0.24mm_akossel*] +inherits = *common_akossel* +bottom_solid_layers = 4 +bridge_flow_ratio = 0.95 +layer_height = 0.24 +perimeter_speed = 50 +external_perimeter_speed = 35 +top_solid_layers = 4 +infill_speed = 100 +solid_infill_speed = 100 +top_solid_infill_speed = 40 + +[print:*0.30mm_akossel*] +inherits = *common_akossel* +bottom_solid_layers = 3 +bridge_flow_ratio = 0.95 +external_perimeter_extrusion_width = 0.6 +external_perimeter_speed = 35 +extrusion_width = 0.5 +infill_extrusion_width = 0.5 +infill_speed = 70 +layer_height = 0.30 +perimeter_extrusion_width = 0.5 +perimeter_speed = 50 +small_perimeter_speed = 30 +solid_infill_extrusion_width = 0.5 +solid_infill_speed = 70 +support_material_speed = 45 +top_infill_extrusion_width = 0.45 +top_solid_infill_speed = 50 +top_solid_layers = 3 + +[print:0.08mm ULTRADETAIL @AKOSSEL] +inherits = *0.08mm_akossel* +fill_density = 15% +fill_pattern = gyroid +compatible_printers_condition = printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ and nozzle_diameter[0]==0.4 + +[print:0.16mm QUALITY @AKOSSEL] +inherits = *0.16mm_akossel* +external_perimeter_speed = 25 +fill_density = 15% +fill_pattern = gyroid +infill_speed = 80 +compatible_printers_condition = printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ and nozzle_diameter[0]==0.4 + +[print:0.16mm SPEED @AKOSSEL] +inherits = *0.16mm_akossel* +external_perimeter_speed = 35 +infill_speed = 120 +perimeter_speed = 60 +solid_infill_speed = 120 +top_solid_infill_speed = 50 +compatible_printers_condition = printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ and nozzle_diameter[0]==0.4 + +[print:0.20mm QUALITY @AKOSSEL] +inherits = *0.20mm_akossel* +external_perimeter_speed = 25 +fill_density = 15% +fill_pattern = gyroid +infill_speed = 80 +compatible_printers_condition = printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ and nozzle_diameter[0]==0.4 + +[print:0.20mm SPEED @AKOSSEL] +inherits = *0.20mm_akossel* +external_perimeter_speed = 35 +infill_speed = 120 +perimeter_speed = 60 +solid_infill_speed = 120 +top_solid_infill_speed = 50 +compatible_printers_condition = printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ and nozzle_diameter[0]==0.4 + +[print:0.24mm DRAFT @AKOSSEL] +inherits = *0.24mm_akossel* +compatible_printers_condition = printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ and nozzle_diameter[0]==0.4 + +[print:0.30mm FAST @AKOSSEL] +inherits = *0.30mm_akossel* +compatible_printers_condition = printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ and nozzle_diameter[0]==0.4 + +# Common filament preset +[filament:*common_akossel*] +cooling = 0 +compatible_printers = +extrusion_multiplier = 1 +filament_cost = 0 +filament_density = 0 +filament_diameter = 1.75 +filament_notes = "" +filament_settings_id = "" +filament_soluble = 0 +min_print_speed = 15 +slowdown_below_layer_time = 20 +compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_Anycubic.*/ and printer_notes=~/.*PRINTER_MODEL_AK(|LP).*/ + +[filament:*PLA_akossel*] +inherits = *common_akossel* +bed_temperature = 60 +fan_below_layer_time = 100 +filament_colour = #FF3232 +filament_max_volumetric_speed = 10 +filament_type = PLA +filament_density = 1.24 +filament_cost = 20 +first_layer_bed_temperature = 60 +first_layer_temperature = 200 +fan_always_on = 1 +cooling = 1 +max_fan_speed = 100 +min_fan_speed = 100 +bridge_fan_speed = 100 +disable_fan_first_layers = 1 +temperature = 200 + +[filament:*PET_akossel*] +inherits = *common_akossel* +bed_temperature = 70 +cooling = 1 +disable_fan_first_layers = 3 +fan_below_layer_time = 20 +filament_colour = #FF8000 +filament_max_volumetric_speed = 8 +filament_type = PETG +filament_density = 1.27 +filament_cost = 30 +first_layer_bed_temperature =70 +first_layer_temperature = 240 +fan_always_on = 1 +max_fan_speed = 50 +min_fan_speed = 20 +bridge_fan_speed = 100 +temperature = 240 + +[filament:*ABS_akossel*] +inherits = *common_akossel* +bed_temperature = 100 +cooling = 0 +disable_fan_first_layers = 3 +fan_below_layer_time = 20 +filament_colour = #3A80CA +filament_max_volumetric_speed = 10 +filament_type = ABS +filament_density = 1.04 +filament_cost = 20 +first_layer_bed_temperature = 100 +first_layer_temperature = 245 +fan_always_on = 0 +max_fan_speed = 0 +min_fan_speed = 0 +bridge_fan_speed = 30 +top_fan_speed = 0 +temperature = 245 + +[filament:Generic PLA @AKOSSEL] +inherits = *PLA_akossel* +filament_vendor = Generic + +[filament:Generic PETG @AKOSSEL] +inherits = *PET_akossel* +filament_vendor = Generic + +[filament:Generic ABS @AKOSSEL] +inherits = *ABS_akossel* +filament_vendor = Generic + +# Common printer preset +[printer:*common_akossel*] +printer_technology = FFF +bed_shape = +before_layer_gcode = ;BEFORE_LAYER_CHANGE\nG92 E0\n;[layer_z] +between_objects_gcode = +deretract_speed = 40 +extruder_colour = #FFFF00 +extruder_offset = 0x0 +gcode_flavor = marlin +silent_mode = 0 +remaining_times = 0 +machine_max_acceleration_e = 3000 +machine_max_acceleration_extruding = 1000 +machine_max_acceleration_retracting = 1000 +machine_max_acceleration_x = 1500 +machine_max_acceleration_y = 1500 +machine_max_acceleration_z = 1500 +machine_max_feedrate_e = 60 +machine_max_feedrate_x = 200 +machine_max_feedrate_y = 200 +machine_max_feedrate_z = 200 +machine_max_jerk_e = 5 +machine_max_jerk_x = 5 +machine_max_jerk_y = 5 +machine_max_jerk_z = 5 +machine_min_extruding_rate = 0 +machine_min_travel_rate = 0 +layer_gcode = ;AFTER_LAYER_CHANGE\n;[layer_z] +max_layer_height = 0.3 +min_layer_height = 0.08 +max_print_height = 300 +nozzle_diameter = 0.4 +printer_notes = +printer_settings_id = +retract_before_travel = 2 +retract_before_wipe = 70% +retract_layer_change = 1 +retract_length = 5 +retract_length_toolchange = 1 +retract_lift = 0 +retract_lift_above = 0 +retract_lift_below = 0 +retract_restart_extra = 0 +retract_restart_extra_toolchange = 0 +retract_speed = 60 +single_extruder_multi_material = 0 +start_gcode = +end_gcode = M104 S0 ; turn off temperature\nM140 S0 ; turn off heatbed\nM107 ; turn off fan\nG28 ; home\nM84 ; disable motors +toolchange_gcode = +use_firmware_retraction = 0 +use_relative_e_distances = 1 +use_volumetric_e = 0 +variable_layer_height = 1 +wipe = 1 +z_offset = 0 +default_print_profile = 0.20mm QUALITY @AKOSSEL +default_filament_profile = Generic PLA @AKOSSEL + +[printer:Anycubic Kossel Linear Plus] +inherits = *common_akossel* +printer_model = AKLP +printer_variant = 0.4 +printer_notes = Do not remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_Anycubic\nPRINTER_MODEL_AKLP\nPRINTER_HAS_BOWDEN\n +bed_shape = 114.562x10.0229,113.253x19.9695,111.081x29.7642,108.065x39.3323,104.225x48.6011,99.5929x57.5,94.2025x65.9613,88.0951x73.9206,81.3173x81.3173,73.9206x88.0951,65.9613x94.2025,57.5x99.5929,48.6011x104.225,39.3323x108.065,29.7642x111.081,19.9695x113.253,10.0229x114.562,7.04172e-15x115,-10.0229x114.562,-19.9695x113.253,-29.7642x111.081,-39.3323x108.065,-48.6011x104.225,-57.5x99.5929,-65.9613x94.2025,-73.9206x88.0951,-81.3173x81.3173,-88.0951x73.9206,-94.2025x65.9613,-99.5929x57.5,-104.225x48.6011,-108.065x39.3323,-111.081x29.7642,-113.253x19.9695,-114.562x10.0229,-115x1.40834e-14,-114.562x-10.0229,-113.253x-19.9695,-111.081x-29.7642,-108.065x-39.3323,-104.225x-48.6011,-99.5929x-57.5,-94.2025x-65.9613,-88.0951x-73.9206,-81.3173x-81.3173,-73.9206x-88.0951,-65.9613x-94.2025,-57.5x-99.5929,-48.6011x-104.225,-39.3323x-108.065,-29.7642x-111.081,-19.9695x-113.253,-10.0229x-114.562,-2.11252e-14x-115,10.0229x-114.562,19.9695x-113.253,29.7642x-111.081,39.3323x-108.065,48.6011x-104.225,57.5x-99.5929,65.9613x-94.2025,73.9206x-88.0951,81.3173x-81.3173,88.0951x-73.9206,94.2025x-65.9613,99.5929x-57.5,104.225x-48.6011,108.065x-39.3323,111.081x-29.7642,113.253x-19.9695,114.562x-10.0229,115x-2.81669e-14 +start_gcode = G90 ; use absolute coordinates\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 ; home\nG1 X-54.672 Y95.203 Z0.3 F9000\nG92 E0.0\nG1 F1000\nG1 X-52.931 Y96.185 E0.300\nG1 X-50.985 Y97.231 E0.331\nG1 X-49.018 Y98.238 E0.331\nG1 X-47.032 Y99.205 E0.331\nG1 X-45.026 Y100.132 E0.331\nG1 X-43.003 Y101.019 E0.331\nG1 X-40.961 Y101.864 E0.331\nG1 X-38.904 Y102.668 E0.331\nG1 X-36.83 Y103.431 E0.331\nG1 X-34.742 Y104.152 E0.331\nG1 X-32.639 Y104.83 E0.331\nG1 X-30.523 Y105.466 E0.331\nG1 X-28.395 Y106.06 E0.331\nG1 X-26.255 Y106.61 E0.331\nG1 X-24.105 Y107.117 E0.331\nG1 X-21.945 Y107.581 E0.331\nG1 X-19.776 Y108.001 E0.331\nG1 X-17.599 Y108.377 E0.331\nG1 X-15.415 Y108.71 E0.331\nG1 X-13.224 Y108.998 E0.331\nG1 X-11.028 Y109.242 E0.331\nG1 X-8.828 Y109.442 E0.331\nG1 X-6.624 Y109.598 E0.331\nG1 X-4.418 Y109.709 E0.331\nG1 X-2.209 Y109.776 E0.332\nG1 X0 Y109.798 E0.331\nG1 X2.209 Y109.776 E0.690\nG1 X4.418 Y109.709 E0.691\nG1 X6.624 Y109.598 E0.690\nG1 X8.828 Y109.442 E0.690\nG1 X11.028 Y109.242 E0.690\nG1 X13.224 Y108.998 E0.690\nG1 X15.415 Y108.71 E0.691\nG1 X17.599 Y108.377 E0.690\nG1 X19.776 Y108.001 E0.690\nG1 X21.945 Y107.581 E0.690\nG1 X24.105 Y107.117 E0.690\nG1 X26.255 Y106.61 E0.690\nG1 X28.395 Y106.06 E0.690\nG1 X30.523 Y105.466 E0.690\nG1 X32.639 Y104.83 E0.690\nG1 X34.742 Y104.152 E0.690\nG1 X36.83 Y103.431 E0.690\nG1 X38.904 Y102.668 E0.691\nG1 X40.961 Y101.864 E0.690\nG1 X43.003 Y101.019 E0.691\nG1 X45.026 Y100.132 E0.690\nG1 X47.032 Y99.205 E0.691\nG1 X49.018 Y98.238 E0.690\nG1 X50.985 Y97.231 E0.691\nG1 X52.931 Y96.185 E0.690\nG1 X54.672 Y95.203 E0.625\nG92 E0.0\nG1 E-5 F3000 ; retract 5mm\nG1 X52.931 Y96.185 F1000 ; wipe\nG1 X50.985 Y97.231 F1000 ; wipe\nG1 X49.018 Y98.238 F1000 ; wipe\nG1 X0 Y109.798 F1000\nG1 E4.8 F1500; de-retract\nG92 E0.0 ; reset extrusion distance\nM221 S{if layer_height<0.075}100{else}95{endif} + +[printer:Anycubic Kossel Pulley (Linear)] +inherits = *common_akossel* +printer_model = AK +printer_variant = 0.4 +printer_notes = Do not remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_Anycubic\nPRINTER_MODEL_AK\nPRINTER_HAS_BOWDEN\n +bed_shape = 89.6575x7.84402,88.6327x15.6283,86.9333x23.2937,84.5723x30.7818,81.5677x38.0356,77.9423x45,73.7237x51.6219,68.944x57.8509,63.6396x63.6396,57.8509x68.944,51.6219x73.7237,45x77.9423,38.0356x81.5677,30.7818x84.5723,23.2937x86.9333,15.6283x88.6327,7.84402x89.6575,5.51091e-15x90,-7.84402x89.6575,-15.6283x88.6327,-23.2937x86.9333,-30.7818x84.5723,-38.0356x81.5677,-45x77.9423,-51.6219x73.7237,-57.8509x68.944,-63.6396x63.6396,-68.944x57.8509,-73.7237x51.6219,-77.9423x45,-81.5677x38.0356,-84.5723x30.7818,-86.9333x23.2937,-88.6327x15.6283,-89.6575x7.84402,-90x1.10218e-14,-89.6575x-7.84402,-88.6327x-15.6283,-86.9333x-23.2937,-84.5723x-30.7818,-81.5677x-38.0356,-77.9423x-45,-73.7237x-51.6219,-68.944x-57.8509,-63.6396x-63.6396,-57.8509x-68.944,-51.6219x-73.7237,-45x-77.9423,-38.0356x-81.5677,-30.7818x-84.5723,-23.2937x-86.9333,-15.6283x-88.6327,-7.84402x-89.6575,-1.65327e-14x-90,7.84402x-89.6575,15.6283x-88.6327,23.2937x-86.9333,30.7818x-84.5723,38.0356x-81.5677,45x-77.9423,51.6219x-73.7237,57.8509x-68.944,63.6396x-63.6396,68.944x-57.8509,73.7237x-51.6219,77.9423x-45,81.5677x-38.0356,84.5723x-30.7818,86.9333x-23.2937,88.6327x-15.6283,89.6575x-7.84402,90x-2.20436e-14 +start_gcode = G90 ; use absolute coordinates\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 ; home\nG1 X-39.672 Y69.712 Z0.3 F9000\nG92 E0.0\nG1 F1000\nG1 X-38.457 Y70.397 E0.209\nG1 X-37.043 Y71.157 E0.241\nG1 X-35.614 Y71.889 E0.241\nG1 X-34.171 Y72.591 E0.241\nG1 X-32.714 Y73.265 E0.241\nG1 X-31.244 Y73.909 E0.241\nG1 X-29.761 Y74.523 E0.241\nG1 X-28.266 Y75.108 E0.241\nG1 X-26.759 Y75.662 E0.241\nG1 X-25.242 Y76.185 E0.241\nG1 X-23.714 Y76.678 E0.241\nG1 X-22.177 Y77.14 E0.241\nG1 X-20.63 Y77.571 E0.241\nG1 X-19.076 Y77.971 E0.241\nG1 X-17.514 Y78.34 E0.241\nG1 X-15.944 Y78.677 E0.241\nG1 X-14.368 Y78.982 E0.241\nG1 X-12.786 Y79.255 E0.241\nG1 X-11.199 Y79.497 E0.241\nG1 X-9.608 Y79.706 E0.241\nG1 X-8.013 Y79.884 E0.241\nG1 X-6.414 Y80.029 E0.241\nG1 X-4.813 Y80.142 E0.241\nG1 X-3.21 Y80.223 E0.241\nG1 X-1.605 Y80.271 E0.241\nG1 X0 Y80.287 E0.241\nG1 X1.605 Y80.271 E0.502\nG1 X3.21 Y80.223 E0.502\nG1 X4.813 Y80.142 E0.502\nG1 X6.414 Y80.029 E0.502\nG1 X8.013 Y79.884 E0.502\nG1 X9.608 Y79.706 E0.502\nG1 X11.199 Y79.497 E0.501\nG1 X12.786 Y79.255 E0.502\nG1 X14.368 Y78.982 E0.502\nG1 X15.944 Y78.677 E0.502\nG1 X17.514 Y78.34 E0.502\nG1 X19.076 Y77.971 E0.502\nG1 X20.63 Y77.571 E0.501\nG1 X22.177 Y77.14 E0.502\nG1 X23.714 Y76.678 E0.502\nG1 X25.242 Y76.185 E0.502\nG1 X26.759 Y75.662 E0.501\nG1 X28.266 Y75.108 E0.502\nG1 X29.761 Y74.523 E0.502\nG1 X31.244 Y73.909 E0.502\nG1 X32.714 Y73.265 E0.502\nG1 X34.171 Y72.591 E0.502\nG1 X35.614 Y71.889 E0.501\nG1 X37.043 Y71.157 E0.502\nG1 X38.457 Y70.397 E0.502\nG1 X39.672 Y69.712 E0.436\nG92 E0.0\nM221 S{if layer_height<0.075}100{else}95{endif} + +## Anycubic MEGA ZERO +## Author: https://github.com/kad +## Initial PR: https://github.com/prusa3d/PrusaSlicer/pull/4057 + +# Common print preset +[print:*common_mega0*] +avoid_crossing_perimeters = 1 +bridge_angle = 0 +bridge_flow_ratio = 0.7 +bridge_speed = 25 +brim_width = 0 +clip_multipart_objects = 1 +compatible_printers = +complete_objects = 0 +dont_support_bridges = 1 +elefant_foot_compensation = 0 +ensure_vertical_shell_thickness = 1 +external_fill_pattern = rectilinear +external_perimeters_first = 0 +external_perimeter_extrusion_width = 0.45 +extra_perimeters = 0 +extruder_clearance_height = 25 +extruder_clearance_radius = 45 +extrusion_width = 0.45 +fill_angle = 45 +fill_density = 20% +fill_pattern = grid +first_layer_extrusion_width = 0.42 +first_layer_height = 0.2 +first_layer_speed = 20 +gap_fill_speed = 30 +gcode_comments = 0 +infill_every_layers = 1 +infill_extruder = 1 +infill_extrusion_width = 0.45 +infill_first = 0 +infill_only_where_needed = 0 +infill_overlap = 25% +interface_shells = 0 +max_print_speed = 100 +max_volumetric_extrusion_rate_slope_negative = 0 +max_volumetric_extrusion_rate_slope_positive = 0 +max_volumetric_speed = 0 +min_skirt_length = 4 +notes = +overhangs = 1 +only_retract_when_crossing_perimeters = 0 +ooze_prevention = 0 +output_filename_format = {input_filename_base}_{layer_height}mm_{filament_type[0]}_{printer_model}_{print_time}.gcode +perimeters = 2 +perimeter_extruder = 1 +perimeter_extrusion_width = 0.45 +post_process = +print_settings_id = +raft_layers = 0 +resolution = 0 +seam_position = nearest +single_extruder_multi_material_priming = 1 +skirts = 2 +skirt_distance = 2 +skirt_height = 2 +small_perimeter_speed = 25 +solid_infill_below_area = 0 +solid_infill_every_layers = 0 +solid_infill_extruder = 1 +solid_infill_extrusion_width = 0.45 +spiral_vase = 0 +standby_temperature_delta = -5 +support_material = 0 +support_material_extruder = 0 +support_material_extrusion_width = 0.4 +support_material_interface_extruder = 0 +support_material_angle = 0 +support_material_buildplate_only = 0 +support_material_enforce_layers = 0 +support_material_contact_distance = 0.15 +support_material_interface_contact_loops = 0 +support_material_interface_layers = 2 +support_material_interface_spacing = 0.2 +support_material_interface_speed = 100% +support_material_pattern = rectilinear +support_material_spacing = 2 +support_material_speed = 40 +support_material_synchronize_layers = 0 +support_material_threshold = 45 +support_material_with_sheath = 0 +support_material_xy_spacing = 60% +thin_walls = 0 +top_infill_extrusion_width = 0.45 +top_solid_infill_speed = 40 +travel_speed = 100 +wipe_tower = 0 +wipe_tower_bridging = 10 +wipe_tower_rotation_angle = 0 +wipe_tower_width = 60 +wipe_tower_x = 170 +wipe_tower_y = 140 +xy_size_compensation = 0 + +[print:*0.10mm_mega0*] +inherits = *common_mega0* +perimeter_speed = 40 +external_perimeter_speed = 25 +infill_speed = 50 +solid_infill_speed = 40 +layer_height = 0.10 +perimeters = 3 +top_infill_extrusion_width = 0.4 +bottom_solid_layers = 6 +top_solid_layers = 7 + +[print:*0.20mm_mega0*] +inherits = *common_mega0* +perimeter_speed = 40 +external_perimeter_speed = 25 +infill_speed = 50 +solid_infill_speed = 40 +layer_height = 0.20 +top_infill_extrusion_width = 0.4 +bottom_solid_layers = 4 +top_solid_layers = 5 + +[print:*0.30mm_mega0*] +inherits = *common_mega0* +perimeter_speed = 40 +external_perimeter_speed = 25 +infill_speed = 50 +solid_infill_speed = 40 +layer_height = 0.24 +top_infill_extrusion_width = 0.45 +bottom_solid_layers = 3 +top_solid_layers = 4 + +[print:0.10mm DETAIL @MEGA0] +inherits = *0.10mm_mega0* +travel_speed = 120 +infill_speed = 50 +solid_infill_speed = 40 +top_solid_infill_speed = 30 +support_material_extrusion_width = 0.38 +compatible_printers_condition = printer_model=="MEGA0" and nozzle_diameter[0]==0.4 + +[print:0.20mm NORMAL @MEGA0] +inherits = *0.20mm_mega0* +travel_speed = 120 +infill_speed = 50 +solid_infill_speed = 40 +top_solid_infill_speed = 30 +support_material_extrusion_width = 0.38 +compatible_printers_condition = printer_model=="MEGA0" and nozzle_diameter[0]==0.4 + +[print:0.30mm DRAFT @MEGA0] +inherits = *0.30mm_mega0* +travel_speed = 120 +infill_speed = 50 +solid_infill_speed = 40 +top_solid_infill_speed = 30 +support_material_extrusion_width = 0.38 +compatible_printers_condition = printer_model=="MEGA0" and nozzle_diameter[0]==0.4 + +# Common filament preset +[filament:*common_mega0*] +cooling = 0 +compatible_printers = +extrusion_multiplier = 1 +filament_cost = 0 +filament_density = 0 +filament_diameter = 1.75 +filament_notes = "" +filament_settings_id = "" +filament_soluble = 0 +min_print_speed = 15 +slowdown_below_layer_time = 20 +compatible_printers_condition = printer_model=="MEGA0" + +[filament:*PLA_mega0*] +inherits = *common_mega0* +bed_temperature = 40 +fan_below_layer_time = 100 +filament_colour = #FF3232 +filament_max_volumetric_speed = 15 +filament_type = PLA +filament_density = 1.24 +filament_cost = 20 +first_layer_bed_temperature = 40 +first_layer_temperature = 215 +fan_always_on = 1 +cooling = 1 +max_fan_speed = 100 +min_fan_speed = 100 +bridge_fan_speed = 100 +disable_fan_first_layers = 1 +temperature = 210 + +[filament:*PET_mega0*] +inherits = *common_mega0* +bed_temperature = 70 +cooling = 1 +disable_fan_first_layers = 3 +fan_below_layer_time = 20 +filament_colour = #FF8000 +filament_max_volumetric_speed = 8 +filament_type = PETG +filament_density = 1.27 +filament_cost = 30 +first_layer_bed_temperature =70 +first_layer_temperature = 240 +fan_always_on = 1 +max_fan_speed = 50 +min_fan_speed = 20 +bridge_fan_speed = 100 +temperature = 240 + +[filament:*ABS_mega0*] +inherits = *common_mega0* +bed_temperature = 100 +cooling = 0 +disable_fan_first_layers = 3 +fan_below_layer_time = 20 +filament_colour = #3A80CA +filament_max_volumetric_speed = 11 +filament_type = ABS +filament_density = 1.04 +filament_cost = 20 +first_layer_bed_temperature = 100 +first_layer_temperature = 245 +fan_always_on = 0 +max_fan_speed = 0 +min_fan_speed = 0 +bridge_fan_speed = 30 +top_fan_speed = 0 +temperature = 245 + +[filament:Generic PLA @MEGA0] +inherits = *PLA_mega0* +filament_vendor = Generic + +[filament:Generic PETG @MEGA0] +inherits = *PET_mega0* +filament_vendor = Generic + +[filament:Generic ABS @MEGA0] +inherits = *ABS_mega0* +filament_vendor = Generic + +[filament:Anycubic PLA @MEGA0] +inherits = *PLA_mega0* +filament_vendor = Anycubic +temperature = 190 +first_layer_temperature = 195 +filament_cost = 24.99 +filament_density = 1.25 + +[filament:Prusament PLA @MEGA0] +inherits = *PLA_mega0* +filament_vendor = Prusa Polymers +temperature = 215 +bed_temperature = 40 +first_layer_temperature = 215 +filament_cost = 24.99 +filament_density = 1.24 + +[filament:Prusament PETG @MEGA0] +inherits = *PET_mega0* +filament_vendor = Prusa Polymers +temperature = 245 +bed_temperature = 70 +first_layer_temperature = 245 +filament_cost = 24.99 +filament_density = 1.27 + +# Common printer preset +[printer:*common_mega0*] +printer_technology = FFF +bed_shape = 0x0,220x0,220x220,0x220 +before_layer_gcode = ; BEFORE_LAYER_CHANGE [layer_num] @ [layer_z]mm\nG92 E0 +between_objects_gcode = +deretract_speed = 0 +extruder_colour = #FFFF00 +extruder_offset = 0x0 +gcode_flavor = marlin +silent_mode = 0 +remaining_times = 0 +machine_max_acceleration_e = 10000 +machine_max_acceleration_extruding = 2000 +machine_max_acceleration_retracting = 1500 +machine_max_acceleration_x = 3000 +machine_max_acceleration_y = 3000 +machine_max_acceleration_z = 500 +machine_max_feedrate_e = 120 +machine_max_feedrate_x = 500 +machine_max_feedrate_y = 500 +machine_max_feedrate_z = 12 +machine_max_jerk_e = 2.5 +machine_max_jerk_x = 20 +machine_max_jerk_y = 20 +machine_max_jerk_z = 0.4 +machine_min_extruding_rate = 0 +machine_min_travel_rate = 0 +layer_gcode = ; AFTER_LAYER_CHANGE [layer_num] @ [layer_z]mm +max_layer_height = 0.3 +min_layer_height = 0.1 +max_print_height = 200 +nozzle_diameter = 0.4 +printer_notes = +printer_settings_id = +retract_before_travel = 1 +retract_before_wipe = 0% +retract_layer_change = 1 +retract_length = 6 +retract_length_toolchange = 1 +retract_lift = 0 +retract_lift_above = 0 +retract_lift_below = 0 +retract_restart_extra = 0 +retract_restart_extra_toolchange = 0 +retract_speed = 30 +single_extruder_multi_material = 0 +start_gcode = G21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nM117 Homing X/Y ...\nG28 X0 Y0 ;move X/Y to min endstops\nM117 Homing Z ...\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F240 ;move the platform down 15mm\nM117 Heating ...\nM104 S[first_layer_temperature]\n ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature]\n ; wait for extruder temp\nM117 Start cleaning ...\nG92 E0 ;zero the extruded length\nG1 F200 E10 ;extrude 10mm of feed stock\nG92 E0 ;zero the extruded length again\nM117 Intro line ...\nG1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed\nG1 X0.1 Y20 Z[first_layer_height] F5000.0 ; Move to start position\nG1 X0.1 Y200.0 Z[first_layer_height] F1500.0 E15 ; Draw the first line\nG1 X0.4 Y200.0 Z[first_layer_height] F5000.0 ; Move to side a little\nG1 X0.4 Y20 Z0.3[first_layer_height] F1500.0 E30 ; Draw the second line\nG92 E0 ; Reset Extruder\nG1 E-1 F500 ; Retract filiment by 1 mm\nG1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed\nG1 X5 Y20 Z0.3 F240 ; Move over to prevent blob squish\nG92 E0 ; Reset Extruder\nM117 Printing...\n +end_gcode = M117 Cooling down...\nM104 S0 ; turn off extruder\nM140 S0 ; turn off heatbed\nM107 ; Fan off\nM84 ; disable motors\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 ;X-20 Y-20 F240 ;move Z up a bit and retract filament even more\nG28 X0 ;move X to min endstops, so the head is out of the way\nG90 ;Absolute positionning\nG1 Y200 F3000 ;Present print\nM84 ;steppers off\nM300 P300 S4000\nM117 Finished.\n +toolchange_gcode = +use_firmware_retraction = 0 +use_relative_e_distances = 1 +use_volumetric_e = 0 +variable_layer_height = 1 +wipe = 1 +z_offset = 0 +printer_model = +default_print_profile = +default_filament_profile = + +[printer:Anycubic Mega Zero] +inherits = *common_mega0* +printer_model = MEGA0 +printer_variant = 0.4 +max_layer_height = 0.3 +min_layer_height = 0.1 +printer_notes = Do not remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_ANYCUBIC\nPRINTER_MODEL_MEGA0 +bed_shape = 0x0,220x0,220x220,0x220 +max_print_height = 250 +machine_max_acceleration_e = 5000 +machine_max_acceleration_extruding = 500 +machine_max_acceleration_retracting = 500 +machine_max_acceleration_x = 500 +machine_max_acceleration_y = 500 +machine_max_acceleration_z = 100 +machine_max_feedrate_e = 25 +machine_max_feedrate_x = 500 +machine_max_feedrate_y = 500 +machine_max_feedrate_z = 5 +machine_max_jerk_e = 5 +machine_max_jerk_x = 10 +machine_max_jerk_y = 10 +machine_max_jerk_z = 0.4 +machine_min_extruding_rate = 0 +machine_min_travel_rate = 0 +nozzle_diameter = 0.4 +retract_before_travel = 2 +retract_layer_change = 0 +retract_length = 7 +retract_speed = 30 +retract_lift = 0.2 +deretract_speed = 30 +retract_before_wipe = 70% +default_print_profile = 0.20mm NORMAL @MEGA0 +default_filament_profile = Anycubic PLA @MEGA0 +start_gcode = G21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nM117 Homing X/Y ...\nG28 X0 Y0 ;move X/Y to min endstops\nM117 Homing Z ...\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F240 ;move the platform down 15mm\nM117 Heating ...\nM104 S[first_layer_temperature]\n ; set extruder temp\nM109 S[first_layer_temperature]\n ; wait for extruder temp\nM117 Start cleaning ...\nG92 E0 ;zero the extruded length\nG1 F200 E10 ;extrude 10mm of feed stock\nG92 E0 ;zero the extruded length again\nM117 Intro line ...\nG1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed\nG1 X0.1 Y20 Z[first_layer_height] F5000.0 ; Move to start position\nG1 X0.1 Y200.0 Z[first_layer_height] F1500.0 E15 ; Draw the first line\nG1 X0.4 Y200.0 Z[first_layer_height] F5000.0 ; Move to side a little\nG1 X0.4 Y20 Z0.3[first_layer_height] F1500.0 E30 ; Draw the second line\nG92 E0 ; Reset Extruder\nG1 E-1 F500 ; Retract filiment by 1 mm\nG1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed\nG1 X5 Y20 Z0.3 F240 ; Move over to prevent blob squish\nG92 E0 ; Reset Extruder\nM117 Printing...\n +end_gcode = M117 Cooling down...\nM104 S0 ; turn off extruder\nM107 ; Fan off\nM84 ; disable motors\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 ;X-20 Y-20 F240 ;move Z up a bit and retract filament even more\nG28 X0 ;move X to min endstops, so the head is out of the way\nG90 ;Absolute positionning\nG1 Y200 F3000 ;Present print\nM84 ;steppers off\nM300 P300 S4000\nM117 Finished.\n + +## Anycubic i3 Mega and i3 Mega S +## Author: https://github.com/Igami +## Initial PR: https://github.com/prusa3d/PrusaSlicer/pull/4619 + +[print:*common_mega*] +bottom_solid_min_thickness = 0.5 +bridge_acceleration = 1000 +bridge_flow_ratio = 0.95 +bridge_speed = 25 +compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_I3_MEGA.*/ and nozzle_diameter[0]==0.4 +default_acceleration = 1000 +ensure_vertical_shell_thickness = 1 +external_perimeter_extrusion_width = 0.45 +external_perimeter_speed = 40 +extruder_clearance_height = 35 +extruder_clearance_radius = 60 +extrusion_width = 0.45 +fill_density = 15% +fill_pattern = gyroid +first_layer_acceleration = 800 +first_layer_extrusion_width = 0.42 +first_layer_height = 0.2 +first_layer_speed = 20 +gap_fill_speed = 40 +gcode_comments = 0 +gcode_label_objects = 1 +infill_acceleration = 1000 +infill_anchor = 2.5 +infill_anchor_max = 12 +infill_extrusion_width = 0.45 +max_print_speed = 100 +min_skirt_length = 4 +only_retract_when_crossing_perimeters = 0 +output_filename_format = {input_filename_base}_{layer_height}mm_{filament_type[0]}_{printer_model}_{print_time}.gcode +perimeter_acceleration = 800 +perimeter_extrusion_width = 0.45 +perimeter_speed = 50 +perimeters = 2 +seam_position = nearest +skirt_distance = 2 +skirt_height = 3 +skirts = 1 +small_perimeter_speed = 25 +solid_infill_below_area = 0 +solid_infill_extrusion_width = 0.45 +solid_infill_speed = 50 +support_material = 0 +support_material_buildplate_only = 0 +support_material_contact_distance = 0.1 +support_material_extrusion_width = 0.35 +support_material_interface_layers = 2 +support_material_interface_spacing = 0.2 +support_material_interface_speed = 80% +support_material_spacing = 2 +support_material_speed = 50 +support_material_threshold = 50 +support_material_xy_spacing = 60% +thin_walls = 0 +top_infill_extrusion_width = 0.4 +top_solid_infill_speed = 40 +top_solid_min_thickness = 0.7 +travel_speed = 180 + +# XXXXXXXXXXXXXXXXXXXX +# XXX--- 0.15mm ---XXX +# XXXXXXXXXXXXXXXXXXXX + +[print:*0.15mm_mega*] +inherits = *common_mega* +bottom_solid_layers = 5 +bridge_flow_ratio = 1 +infill_speed = 60 +layer_height = 0.15 +top_solid_layers = 7 + +[print:0.15mm QUALITY @MEGA] +inherits = *0.15mm_mega* + +# XXXXXXXXXXXXXXXXXXXX +# XXX--- 0.20mm ---XXX +# XXXXXXXXXXXXXXXXXXXX + +[print:*0.20mm_mega*] +inherits = *common_mega* +bottom_solid_layers = 4 +infill_speed = 60 +layer_height = 0.2 +top_solid_layers = 5 + +[print:0.20mm QUALITY @MEGA] +inherits = *0.20mm_mega* + +# XXXXXXXXXXXXXXXXXXXX +# XXX--- 0.30mm ---XXX +# XXXXXXXXXXXXXXXXXXXX + +[print:*0.30mm_mega*] +inherits = *common_mega* +bottom_solid_layers = 4 +external_perimeter_extrusion_width = 0.6 +external_perimeter_speed = 35 +extrusion_width = 0.5 +fill_pattern = cubic +infill_extrusion_width = 0.5 +infill_speed = 85 +layer_height = 0.3 +perimeter_extrusion_width = 0.5 +small_perimeter_speed = 30 +solid_infill_extrusion_width = 0.5 +support_material_extrusion_width = 0.38 +support_material_speed = 45 +top_solid_layers = 4 + +[print:0.30mm DRAFT @MEGA] +inherits = *0.30mm_mega* + +# XXXXXXXXXXXXXXXXXXXXXX +# XXX--- filament ---XXX +# XXXXXXXXXXXXXXXXXXXXXX + +[filament:*common_mega*] +compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_I3_MEGA.*/ +end_filament_gcode = "; Filament-specific end gcode" +fan_always_on = 1 +fan_below_layer_time = 100 +filament_vendor = Generic +min_print_speed = 15 +slowdown_below_layer_time = 20 + +[filament:*ABS_mega*] + inherits = *common_mega* + bed_temperature = 110 + bridge_fan_speed = 25 + cooling = 0 + fan_always_on = 0 + fan_below_layer_time = 20 + filament_colour = #3A80CA + filament_cost = 27.82 + filament_density = 1.04 + filament_max_volumetric_speed = 11 + filament_ramming_parameters = "120 100 5.70968 6.03226 7 8.25806 9 9.19355 9.3871 9.77419 10.129 10.3226 10.4516 10.5161| 0.05 5.69677 0.45 6.15484 0.95 8.76774 1.45 9.20323 1.95 9.95806 2.45 10.3871 2.95 10.5677 3.45 7.6 3.95 7.6 4.45 7.6 4.95 7.6" + filament_type = ABS + first_layer_bed_temperature = 105 + first_layer_temperature = 255 + max_fan_speed = 30 + min_fan_speed = 20 + temperature = 255 + +[filament:Generic ABS @MEGA] +inherits = *ABS_mega* + +[filament:*FLEX_mega*] +inherits = *common_mega* +bed_temperature = 50 +bridge_fan_speed = 80 +cooling = 0 +extrusion_multiplier = 1.15 +fan_always_on = 0 +filament_colour = #008000 +filament_cost = 82.00 +filament_density = 1.22 +filament_deretract_speed = 25 +filament_max_volumetric_speed = 1.2 +filament_retract_length = 0.8 +filament_type = FLEX +first_layer_bed_temperature = 55 +first_layer_temperature = 240 +max_fan_speed = 90 +min_fan_speed = 70 +temperature = 240 + +[filament:Generic FLEX @MEGA] +inherits = *FLEX_mega* + +[filament:SainSmart TPU @MEGA] +inherits = *FLEX_mega* +filament_vendor = SainSmart +bed_temperature = 50 +bridge_fan_speed = 100 +cooling = 1 +disable_fan_first_layers = 4 +filament_cost = 39.99 +filament_density = 1.21 +filament_deretract_speed = 15 +filament_max_volumetric_speed = 1.8 +filament_notes = "SainSmart TPU gains popularity among 3D Printing community for its balance of rigidity and flexibility. In addition, with a 95A Shore Hardness and improved bed adhesion, it is easier to print even with a stock elementary 3D Printer like the Creality Ender 3. SainSmart TPU will not disappoint if you are looking for flexible filament. From drone parts, phone cases, to small toys, all can be printed with ease.\n\nhttps://www.sainsmart.com/collections/tpu-filament/products/all-colors-tpu-flexible-filament-1-75mm-0-8kg-1-76lb" +filament_retract_before_travel = 5 +filament_retract_length = 4 +filament_retract_speed = 40 +filament_unloading_speed = 90 +first_layer_bed_temperature = 55 +first_layer_temperature = 235 +full_fan_speed_layer = 6 +max_fan_speed = 80 +min_fan_speed = 80 +slowdown_below_layer_time = 10 +temperature = 235 + +[filament:*PETG_mega*] +inherits = *common_mega* +bed_temperature = 90 +bridge_fan_speed = 50 +fan_below_layer_time = 20 +filament_colour = #FF8000 +filament_cost = 27.82 +filament_density = 1.27 +filament_max_volumetric_speed = 8 +filament_type = PETG +first_layer_bed_temperature = 90 +first_layer_temperature = 230 +max_fan_speed = 50 +min_fan_speed = 30 +temperature = 240 + +[filament:Generic PETG @MEGA] +inherits = *PETG_mega* + +[filament:ColorFabb XT-CF20 @MEGA] +inherits = *PETG_mega* +compatible_printers_condition = nozzle_diameter[0]>=0.4 and printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_I3_MEGA.*/ +extrusion_multiplier = 1.05 +filament_colour = #804040 +filament_cost = 66.60 +filament_density = 1.35 +filament_deretract_speed = 25 +filament_max_volumetric_speed = 2 +filament_notes = "Based on colorFabb_XT, XT-CF20 is a carbon fiber composite material. Loaded with no less than 20% specially sourced carbon fibers we have developed a very stiff and tough 3D printing filament made for functional parts. It is truly a professional printers go-to material, especially for users looking for high melt strength, high melt viscosity and good dimensional accuracy and stability.\n\nhttps://colorfabb.com/xt-cf20" +filament_retract_before_travel = 1 +filament_retract_length = 1.4 +filament_retract_speed = 40 +filament_spool_weight = 236 +filament_vendor = ColorFabb +first_layer_temperature = 260 +full_fan_speed_layer = 5 +slowdown_below_layer_time = 15 +temperature = 260 + +[filament:ERYONE PETG @MEGA] +inherits = *PETG_mega* +filament_vendor = ERYONE +filament_cost = 20.99 +filament_notes = "https://eryone.com/petg/show/10.html" + +[filament:FormFutura HDglass @MEGA] +inherits = *PETG_mega* +filament_vendor = FormFutura +filament_cost = 46.65 +filament_notes = "HDglass is a high performance PETG type of 3D printer with unsurpassed 3D printing properties and improved mechanical strength, flexibility, toughness and heat resistance.\n\nhttps://www.formfutura.com/shop/product/hdglass-2812" + +[filament:FormFutura ReForm rPET @MEGA] +inherits = *PETG_mega* +filament_vendor = FormFutura +filament_cost = 26.65 +filament_notes = "ReForm rPET is a recycled PETG type of 3D printer filament that is made from post-industrial waste streams of a nearby located plastic bottle manufacturer.\n\nhttps://www.formfutura.com/shop/product/reform-rpet-2836" +filament_spool_weight = 176 + +[filament:Janbex transparent PETG @MEGA] +inherits = *PETG_mega* +filament_vendor = Janbex +filament_cost = 31.99 +filament_spool_weight = 222 +first_layer_temperature = 215 +min_fan_speed = 100 +temperature = 210 + +[filament:DAS FILAMENT PETG @MEGA] +inherits = *PETG_mega* +filament_vendor = DAS FILAMENT +bed_temperature = 75 +first_layer_bed_temperature = 75 +first_layer_temperature = 220 +temperature = 225 + +[filament:*PLA_mega*] +inherits = *common_mega* +bed_temperature = 60 +disable_fan_first_layers = 1 +filament_colour = #FF3232 +filament_cost = 25.40 +filament_density = 1.24 +filament_max_volumetric_speed = 10 +first_layer_bed_temperature = 65 +first_layer_temperature = 215 +min_fan_speed = 100 +temperature = 210 + +[filament:Generic PLA @MEGA] +inherits = *PLA_mega* + +[filament:3Dmensionals PLA @MEGA] +inherits = *PLA_mega* +filament_vendor = 3Dmensionals +filament_cost = 22.90 +filament_notes = "Das 3DFilaments - PLA von 3Dmensionals ist ein sehr leicht zu druckendes 3D-Drucker Filament. Dabei handelt es sich um ein etwas härteres PLA mit einer exzellenten thermischen Stabilität. Das Filament zeichnet sich vor allem durch verzugfreies 3D-Drucken aus und weist minimale bis keine Verformung nach dem Abkühlen auf. Daher ist es besonders gut für den Druck größerer Objekte geeignet. Zudem bietet 3DFilaments - PLA über die gesamte Fadenläge eine hervorragende Durchmesser- und Rundheitstoleranz.\n\nhttps://www.3dmensionals.de/3dfilaments?number=PSU3DM001V" + +[filament:3D Warhorse PLA @MEGA] +inherits = *PLA_mega* +filament_vendor = 3D Warhorse +filament_cost = 19.99 + +[filament:AMOLEN wood PLA] +inherits = *PLA_mega* +filament_vendor = AMOLEN +compatible_printers_condition = nozzle_diameter[0]>0.35 and printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_I3_MEGA.*/ +extrusion_multiplier = 1.1 +filament_colour = #DFC287 +filament_cost = 33.99 +filament_density = 1.23 +filament_max_volumetric_speed = 9 +filament_notes = "https://amolen.com/collections/wood/products/amolen-pla-filament-1-75mm-wood-color-3d-printer-filament-1kg2-2lb" + +[filament:FormFutura EasyFil PLA @MEGA] +inherits = *PLA_mega* +filament_vendor = FormFutura +filament_cost = 39.93 +filament_notes = "EasyFil PLA is an easy to print PLA type of 3D printer filament that is available in a wide variety of colors. Its improved flowing behavior make 3D printed layers flow more into each other.\n\nhttps://www.formfutura.com/shop/product/easyfil-pla-2801" + +[filament:FormFutura ReForm rPLA @MEGA] +inherits = *PLA_mega* +filament_vendor = FormFutura +filament_cost = 26.65 +filament_notes = "ReForm is a sustainable initiative within Formfutura to efficiently manage residual extrusion waste streams and re-use them into high-end upcycled filaments. The ideology behind ReForm is to a make 3D printing more sustainable – without having to make compromises on material properties – and yet keep it affordable.\n\nhttps://www.formfutura.com/shop/product/reform-rpla-2838" + +[filament:GIANTARM PLA @MEGA] +inherits = *PLA_mega* +filament_vendor = GIANTARM +filament_cost = 24.99 + +[filament:Prusament PLA @MEGA] +inherits = *PLA_mega* +filament_vendor = Prusa Polymers +filament_cost = 30.24 +filament_notes = "Affordable filament for everyday printing in premium quality manufactured in-house by Josef Prusa" +filament_spool_weight = 201 +temperature = 215 + +[filament:Verbatim PLA @MEGA] +inherits = *PLA_mega* +filament_vendor = Verbatim +filament_cost = 23.88 + +[printer:*common_mega*] +printer_technology = FFF +bed_shape = 0x0,210x0,210x210,0x210 +before_layer_gcode = ;BEFORE_LAYER_CHANGE\nG92 E0.0\n;[layer_z] +default_filament_profile = Generic PLA @MEGA +default_print_profile = 0.15mm QUALITY @MEGA +deretract_speed = 50 +end_gcode = G1 E-1.0 F2100 ; retract\nG92 E0.0\nG1{if max_layer_z < max_print_height} Z{z_offset+min(max_layer_z+30, max_print_height)}{endif} E-34.0 F720 ; move print head up & retract filament\nG4 ; wait\nM104 S0 ; turn off temperature\nM140 S0 ; turn off heatbed\nM107 ; turn off fan\nG1 X0 Y105 F3000 ; park print head\nM84 ; disable motors +extruder_colour = #808080 +gcode_flavor = marlin +layer_gcode = ;AFTER_LAYER_CHANGE\n;[layer_z] +max_layer_height = 0.36 +max_print_height = 205 +remaining_times = 1 +retract_before_travel = 1.5 +retract_before_wipe = 60% +retract_layer_change = 1 +retract_length = 6 +retract_lift = 0.075 +retract_lift_below = 204 +retract_speed = 40 +silent_mode = 0 +start_gcode = G90 ; use absolute coordinates\nM83 ; extruder relative mode\nM204 S[machine_max_acceleration_extruding] T[machine_max_acceleration_retracting]\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nG28 ; home all\nG1 Y1.0 Z0.3 F1000 ; move print head up\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG92 E0.0\n; initial load\nG1 X205.0 E19 F1000\nG1 Y1.6\nG1 X5.0 E19 F1000\nG92 E0.0\n; intro line\nG1 Y2.0 Z0.2 F1000\nG1 X65.0 E9.0 F1000\nG1 X105.0 E12.5 F1000\nG92 E0.0 +thumbnails = 16x16,220x124 +use_relative_e_distances = 1 +wipe = 1 +machine_max_acceleration_e = 10000 +machine_max_acceleration_extruding = 1250 +machine_max_acceleration_retracting = 1250 +machine_max_acceleration_x = 3000 +machine_max_acceleration_y = 2000 +machine_max_acceleration_z = 60 +machine_max_feedrate_e = 60 +machine_max_feedrate_x = 500 +machine_max_feedrate_y = 500 +machine_max_feedrate_z = 6 +machine_max_jerk_e = 5 +machine_max_jerk_x = 10 +machine_max_jerk_y = 10 +machine_max_jerk_z = 0.4 + +[printer:Anycubic i3 Mega] +inherits = *common_mega* +printer_model = I3MEGA +printer_variant = 0.4 +printer_notes = Do not remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_ANYCUBIC\nPRINTER_MODEL_I3_MEGA\nPRINTER_HAS_BOWDEN + +[printer:Anycubic i3 Mega S] +inherits = *common_mega* +printer_model = I3MEGAS +printer_variant = 0.4 +printer_notes = Do not remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_ANYCUBIC\nPRINTER_MODEL_I3_MEGA_S\nPRINTER_HAS_BOWDEN +machine_max_feedrate_e = 30 +machine_max_feedrate_z = 8 + + +## Anycubic PREDATOR +## Author: https://github.com/tillverka3d +## Initial PR: https://github.com/prusa3d/PrusaSlicer/pull/4960 + +######################################### +###### begin common print presets ####### +######################################### + +# Common print preset +[print:*common predator*] +spiral_vase = 0 +top_solid_min_thickness = 0.8 +bottom_solid_min_thickness = 0.6 +extra_perimeters = 0 +ensure_vertical_shell_thickness = 1 +avoid_crossing_perimeters = 0 +thin_walls = 0 +overhangs = 1 +seam_position = nearest +external_perimeters_first = 0 +fill_density = 20% +external_fill_pattern = rectilinear +infill_every_layers = 1 +infill_only_where_needed = 0 +solid_infill_every_layers = 0 +fill_angle = 45 +solid_infill_below_area = 20 +bridge_angle = 0 +only_retract_when_crossing_perimeters = 0 +infill_first = 0 +skirts = 1 +skirt_distance = 4 +skirt_height = 1 +min_skirt_length = 8 +brim_width = 0 +support_material = 0 +support_material_auto = 1 +support_material_threshold = 50 +support_material_enforce_layers = 0 +raft_layers = 0 +support_material_contact_distance = 0.1 +support_material_pattern = rectilinear +support_material_with_sheath = 0 +support_material_spacing = 2 +support_material_angle = 0 +support_material_interface_layers = 2 +support_material_interface_spacing = 0.2 +support_material_interface_contact_loops = 0 +support_material_buildplate_only = 0 +support_material_xy_spacing = 60% +dont_support_bridges = 1 +support_material_synchronize_layers = 0 +travel_speed = 94 +first_layer_speed = 15 +perimeter_acceleration = 0 +infill_acceleration = 0 +bridge_acceleration = 0 +first_layer_acceleration = 0 +default_acceleration = 0 +max_volumetric_speed = 15 +perimeter_extruder = 1 +infill_extruder = 1 +solid_infill_extruder = 1 +support_material_extruder = 0 +support_material_interface_extruder = 0 +ooze_prevention = 0 +standby_temperature_delta = -5 +wipe_tower = 0 +wipe_tower_x = 170 +wipe_tower_y = 140 +wipe_tower_width = 60 +wipe_tower_rotation_angle = 0 +wipe_tower_bridging = 10 +interface_shells = 0 +bridge_flow_ratio = 0.8 +resolution = 0 +xy_size_compensation = 0 +elefant_foot_compensation = 0.2 +clip_multipart_objects = 1 +complete_objects = 0 +extruder_clearance_radius = 45 +extruder_clearance_height = 25 +gcode_comments = 0 +output_filename_format = {input_filename_base}.gcode +post_process = +notes = +max_volumetric_extrusion_rate_slope_negative = 0 +max_volumetric_extrusion_rate_slope_positive = 0 +print_settings_id = + +# Common print preset +[print:*common predator 0.4 nozzle*] +inherits = *common predator* +first_layer_height = 0.16 +infill_overlap = 25% +compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_PREDATOR.*/ and printer_notes=~/.*PRINTER_HAS_BOWDEN.*/ and nozzle_diameter[0]==0.4 + +# Common print preset +[print:*common predator 0.6 nozzle*] +inherits = *common predator* +first_layer_height = 0.24 +infill_overlap = 27% +compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_PREDATOR.*/ and printer_notes=~/.*PRINTER_HAS_BOWDEN.*/ and nozzle_diameter[0]==0.6 + +# Common print preset +[print:*common predator 0.8 nozzle*] +inherits = *common predator* +first_layer_height = 0.32 +infill_overlap = 30% +compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_PREDATOR.*/ and printer_notes=~/.*PRINTER_HAS_BOWDEN.*/ and nozzle_diameter[0]==0.8 + +# Common print preset +[print:*common predator quality*] +perimeter_speed = 50 +small_perimeter_speed = 15 +external_perimeter_speed = 70% +infill_speed = 65 +solid_infill_speed = 85% +top_solid_infill_speed = 85% +support_material_speed = 30 +support_material_interface_speed = 85% +bridge_speed = 30 +gap_fill_speed = 40 +ironing_speed = 15 + +# Common print preset +[print:*common predator speed*] +perimeter_speed = 70 +small_perimeter_speed = 15 +external_perimeter_speed = 70% +infill_speed = 85 +solid_infill_speed = 85% +top_solid_infill_speed = 85% +support_material_speed = 30 +support_material_interface_speed = 85% +bridge_speed = 30 +gap_fill_speed = 40 +ironing_speed = 15 + +# Common print preset +[print:*common predator 0.4 nozzle detailed*] +inherits = *common predator 0.4 nozzle* +extrusion_width = 0.42 +first_layer_extrusion_width = 0.41 +perimeter_extrusion_width = 0.42 +external_perimeter_extrusion_width = 0.42 +infill_extrusion_width = 0.4 +solid_infill_extrusion_width = 0.4 +top_infill_extrusion_width = 0.4 +support_material_extrusion_width = 0.38 + +# Common print preset +[print:*common predator 0.4 nozzle coarse*] +inherits = *common predator 0.4 nozzle* +extrusion_width = 0.44 +first_layer_extrusion_width = 0.42 +perimeter_extrusion_width = 0.5 +external_perimeter_extrusion_width = 0.5 +infill_extrusion_width = 0.5 +solid_infill_extrusion_width = 0.5 +top_infill_extrusion_width = 0.4 +support_material_extrusion_width = 0.38 + +# Common print preset +[print:*common predator 0.6 nozzle detailed*] +inherits = *common predator 0.6 nozzle* +extrusion_width = 0.64 +first_layer_extrusion_width = 0.62 +perimeter_extrusion_width = 0.64 +external_perimeter_extrusion_width = 0.64 +infill_extrusion_width = 0.6 +solid_infill_extrusion_width = 0.6 +top_infill_extrusion_width = 0.6 +support_material_extrusion_width = 0.56 + +# Common print preset +[print:*common predator 0.6 nozzle coarse*] +inherits = *common predator 0.6 nozzle* +extrusion_width = 0.67 +first_layer_extrusion_width = 0.64 +perimeter_extrusion_width = 0.7 +external_perimeter_extrusion_width = 0.7 +infill_extrusion_width = 0.7 +solid_infill_extrusion_width = 0.7 +top_infill_extrusion_width = 0.6 +support_material_extrusion_width = 0.56 + +# Common print preset +[print:*common predator 0.8 nozzle detailed*] +inherits = *common predator 0.8 nozzle* +extrusion_width = 0.84 +first_layer_extrusion_width = 0.82 +perimeter_extrusion_width = 0.84 +external_perimeter_extrusion_width = 0.84 +infill_extrusion_width = 0.8 +solid_infill_extrusion_width = 0.8 +top_infill_extrusion_width = 0.8 +support_material_extrusion_width = 0.72 + +# Common print preset +[print:*common predator 0.8 nozzle coarse*] +inherits = *common predator 0.8 nozzle* +extrusion_width = 0.87 +first_layer_extrusion_width = 0.84 +perimeter_extrusion_width = 0.9 +external_perimeter_extrusion_width = 0.9 +infill_extrusion_width = 0.9 +solid_infill_extrusion_width = 0.9 +top_infill_extrusion_width = 0.8 +support_material_extrusion_width = 0.72 + +######################################### +####### end common print presets ######## +######################################### + +######################################### +########## begin print presets ########## +######################################### + +[print:0.08mm 0.4 nozzle DETAILED QUALITY @PREDATOR] +inherits = *common predator 0.4 nozzle detailed*; *common predator quality* +layer_height = 0.08 +max_print_speed = 50 +perimeters = 3 +fill_pattern = grid + +[print:0.16mm 0.4 nozzle DETAILED QUALITY @PREDATOR] +inherits = *common predator 0.4 nozzle detailed*; *common predator quality* +layer_height = 0.16 +max_print_speed = 60 +perimeters = 3 +fill_pattern = grid + +[print:0.16mm 0.4 nozzle COARSE QUALITY @PREDATOR] +inherits = *common predator 0.4 nozzle coarse*; *common predator quality* +layer_height = 0.16 +max_print_speed = 60 +perimeters = 3 +fill_pattern = grid + +[print:0.24mm 0.4 nozzle DETAILED QUALITY @PREDATOR] +inherits = *common predator 0.4 nozzle detailed*; *common predator quality* +layer_height = 0.24 +max_print_speed = 70 +perimeters = 3 +fill_pattern = grid + +[print:0.24mm 0.4 nozzle COARSE QUALITY @PREDATOR] +inherits = *common predator 0.4 nozzle coarse*; *common predator quality* +layer_height = 0.24 +max_print_speed = 70 +perimeters = 3 +fill_pattern = grid + +[print:0.32mm 0.4 nozzle DETAILED QUALITY @PREDATOR] +inherits = *common predator 0.4 nozzle detailed*; *common predator quality* +layer_height = 0.32 +max_print_speed = 70 +perimeters = 3 +fill_pattern = grid + +[print:0.32mm 0.4 nozzle COARSE QUALITY @PREDATOR] +inherits = *common predator 0.4 nozzle coarse*; *common predator quality* +layer_height = 0.32 +max_print_speed = 70 +perimeters = 3 +fill_pattern = grid + +[print:0.16mm 0.6 nozzle DETAILED QUALITY @PREDATOR] +inherits = *common predator 0.6 nozzle detailed*; *common predator quality* +layer_height = 0.16 +max_print_speed = 70 +perimeters = 2 +fill_pattern = gyroid + +[print:0.16mm 0.6 nozzle DETAILED SPEED @PREDATOR] +inherits = *common predator 0.6 nozzle detailed*; *common predator speed* +layer_height = 0.16 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.16mm 0.6 nozzle COARSE QUALITY @PREDATOR] +inherits = *common predator 0.6 nozzle coarse*; *common predator quality* +layer_height = 0.16 +max_print_speed = 70 +perimeters = 2 +fill_pattern = gyroid + +[print:0.16mm 0.6 nozzle COARSE SPEED @PREDATOR] +inherits = *common predator 0.6 nozzle coarse*; *common predator speed* +layer_height = 0.16 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.24mm 0.6 nozzle DETAILED QUALITY @PREDATOR] +inherits = *common predator 0.6 nozzle detailed*; *common predator quality* +layer_height = 0.24 +max_print_speed = 70 +perimeters = 2 +fill_pattern = gyroid + +[print:0.24mm 0.6 nozzle DETAILED SPEED @PREDATOR] +inherits = *common predator 0.6 nozzle detailed*; *common predator speed* +layer_height = 0.24 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.24mm 0.6 nozzle COARSE QUALITY @PREDATOR] +inherits = *common predator 0.6 nozzle coarse*; *common predator quality* +layer_height = 0.24 +max_print_speed = 70 +perimeters = 2 +fill_pattern = gyroid + +[print:0.24mm 0.6 nozzle COARSE SPEED @PREDATOR] +inherits = *common predator 0.6 nozzle coarse*; *common predator speed* +layer_height = 0.24 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.32mm 0.6 nozzle DETAILED QUALITY @PREDATOR] +inherits = *common predator 0.6 nozzle detailed*; *common predator quality* +layer_height = 0.32 +max_print_speed = 70 +perimeters = 2 +fill_pattern = gyroid + +[print:0.32mm 0.6 nozzle DETAILED SPEED @PREDATOR] +inherits = *common predator 0.6 nozzle detailed*; *common predator speed* +layer_height = 0.32 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.32mm 0.6 nozzle COARSE QUALITY @PREDATOR] +inherits = *common predator 0.6 nozzle coarse*; *common predator quality* +layer_height = 0.32 +max_print_speed = 70 +perimeters = 2 +fill_pattern = gyroid + +[print:0.32mm 0.6 nozzle COARSE SPEED @PREDATOR] +inherits = *common predator 0.6 nozzle coarse*; *common predator speed* +layer_height = 0.32 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.4mm 0.6 nozzle DETAILED QUALITY @PREDATOR] +inherits = *common predator 0.6 nozzle detailed*; *common predator quality* +layer_height = 0.4 +max_print_speed = 70 +perimeters = 2 +fill_pattern = gyroid + +[print:0.4mm 0.6 nozzle DETAILED SPEED @PREDATOR] +inherits = *common predator 0.6 nozzle detailed*; *common predator speed* +layer_height = 0.4 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.4mm 0.6 nozzle COARSE QUALITY @PREDATOR] +inherits = *common predator 0.6 nozzle coarse*; *common predator quality* +layer_height = 0.4 +max_print_speed = 70 +perimeters = 2 +fill_pattern = gyroid + +[print:0.4mm 0.6 nozzle COARSE SPEED @PREDATOR] +inherits = *common predator 0.6 nozzle coarse*; *common predator speed* +layer_height = 0.4 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.24mm 0.8 nozzle DETAILED QUALITY @PREDATOR] +inherits = *common predator 0.8 nozzle detailed*; *common predator quality* +layer_height = 0.24 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.24mm 0.8 nozzle DETAILED SPEED @PREDATOR] +inherits = *common predator 0.8 nozzle detailed*; *common predator speed* +layer_height = 0.24 +max_print_speed = 90 +perimeters = 2 +fill_pattern = gyroid + +[print:0.24mm 0.8 nozzle COARSE QUALITY @PREDATOR] +inherits = *common predator 0.8 nozzle coarse*; *common predator quality* +layer_height = 0.24 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.24mm 0.8 nozzle COARSE SPEED @PREDATOR] +inherits = *common predator 0.8 nozzle coarse*; *common predator speed* +layer_height = 0.24 +max_print_speed = 90 +perimeters = 2 +fill_pattern = gyroid + +[print:0.32mm 0.8 nozzle DETAILED QUALITY @PREDATOR] +inherits = *common predator 0.8 nozzle detailed*; *common predator quality* +layer_height = 0.32 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.32mm 0.8 nozzle DETAILED SPEED @PREDATOR] +inherits = *common predator 0.8 nozzle detailed*; *common predator speed* +layer_height = 0.32 +max_print_speed = 90 +perimeters = 2 +fill_pattern = gyroid + +[print:0.32mm 0.8 nozzle COARSE QUALITY @PREDATOR] +inherits = *common predator 0.8 nozzle coarse*; *common predator quality* +layer_height = 0.32 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.32mm 0.8 nozzle COARSE SPEED @PREDATOR] +inherits = *common predator 0.8 nozzle coarse*; *common predator speed* +layer_height = 0.32 +max_print_speed = 90 +perimeters = 2 +fill_pattern = gyroid + +[print:0.4mm 0.8 nozzle DETAILED QUALITY @PREDATOR] +inherits = *common predator 0.8 nozzle detailed*; *common predator quality* +layer_height = 0.4 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.4mm 0.8 nozzle DETAILED SPEED @PREDATOR] +inherits = *common predator 0.8 nozzle detailed*; *common predator speed* +layer_height = 0.4 +max_print_speed = 90 +perimeters = 2 +fill_pattern = gyroid + +[print:0.4mm 0.8 nozzle COARSE QUALITY @PREDATOR] +inherits = *common predator 0.8 nozzle coarse*; *common predator quality* +layer_height = 0.4 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.4mm 0.8 nozzle COARSE SPEED @PREDATOR] +inherits = *common predator 0.8 nozzle coarse*; *common predator speed* +layer_height = 0.4 +max_print_speed = 90 +perimeters = 2 +fill_pattern = gyroid + +[print:0.48mm 0.8 nozzle DETAILED QUALITY @PREDATOR] +inherits = *common predator 0.8 nozzle detailed*; *common predator quality* +layer_height = 0.48 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.48mm 0.8 nozzle DETAILED SPEED @PREDATOR] +inherits = *common predator 0.8 nozzle detailed*; *common predator speed* +layer_height = 0.48 +max_print_speed = 90 +perimeters = 2 +fill_pattern = gyroid + +[print:0.48mm 0.8 nozzle COARSE QUALITY @PREDATOR] +inherits = *common predator 0.8 nozzle coarse*; *common predator quality* +layer_height = 0.48 +max_print_speed = 80 +perimeters = 2 +fill_pattern = gyroid + +[print:0.48mm 0.8 nozzle COARSE SPEED @PREDATOR] +inherits = *common predator 0.8 nozzle coarse*; *common predator speed* +layer_height = 0.48 +max_print_speed = 90 +perimeters = 2 +fill_pattern = gyroid + +######################################### +########### end print presets ########### +######################################### + +######################################### +######## begin filament presets ######### +######################################### + +# Common filament preset +[filament:*common predator*] +cooling = 0 +compatible_printers = +extrusion_multiplier = 1 +filament_cost = 0 +filament_density = 0 +filament_diameter = 1.75 +filament_notes = "" +filament_settings_id = "" +filament_soluble = 0 +min_print_speed = 15 +slowdown_below_layer_time = 20 +compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_ANYCUBIC.*/ and printer_notes=~/.*PRINTER_MODEL_PREDATOR.*/ + +[filament:*PLA predator*] +inherits = *common predator* +bed_temperature = 60 +fan_below_layer_time = 100 +filament_colour = #FF3232 +filament_max_volumetric_speed = 10 +filament_type = PLA +filament_density = 1.24 +filament_cost = 20 +first_layer_bed_temperature = 60 +first_layer_temperature = 200 +fan_always_on = 1 +cooling = 1 +max_fan_speed = 100 +min_fan_speed = 100 +bridge_fan_speed = 100 +disable_fan_first_layers = 1 +temperature = 200 + +[filament:*PET predator*] +inherits = *common predator* +bed_temperature = 70 +cooling = 1 +disable_fan_first_layers = 3 +fan_below_layer_time = 20 +filament_colour = #FF8000 +filament_max_volumetric_speed = 8 +filament_type = PETG +filament_density = 1.27 +filament_cost = 30 +first_layer_bed_temperature =70 +first_layer_temperature = 240 +fan_always_on = 1 +max_fan_speed = 50 +min_fan_speed = 20 +bridge_fan_speed = 100 +temperature = 240 + +[filament:*ABS predator*] +inherits = *common predator* +bed_temperature = 100 +cooling = 0 +disable_fan_first_layers = 3 +fan_below_layer_time = 20 +filament_colour = #3A80CA +filament_max_volumetric_speed = 10 +filament_type = ABS +filament_density = 1.04 +filament_cost = 20 +first_layer_bed_temperature = 100 +first_layer_temperature = 245 +fan_always_on = 0 +max_fan_speed = 0 +min_fan_speed = 0 +bridge_fan_speed = 30 +top_fan_speed = 0 +temperature = 245 + +[filament:Generic PLA @PREDATOR] +inherits = *PLA predator* +filament_vendor = Generic + +[filament:Generic PETG @PREDATOR] +inherits = *PET predator* +filament_vendor = Generic + +[filament:Generic ABS @PREDATOR] +inherits = *ABS predator* +filament_vendor = Generic + +######################################### +######### end filament presets ########## +######################################### + +######################################### +######### begin printer presets ######### +######################################### + +# Anycubic predator common printer preset +[printer:*common predator*] +printer_vendor = Anycubic +printer_model = Predator +printer_technology = FFF +printer_variant = 0.4 +thumbnails = 16x16,220x124 +bed_shape = 188.779x16.516,186.621x32.9063,183.043x49.0462,178.072x64.8128,171.745x80.0862,164.112x94.75,155.229x108.693,145.165x121.808,133.997x133.997,121.808x145.165,108.693x155.229,94.75x164.112,80.0862x171.745,64.8128x178.072,49.0462x183.043,32.9063x186.621,16.516x188.779,1.16035e-14x189.5,-16.516x188.779,-32.9063x186.621,-49.0462x183.043,-64.8128x178.072,-80.0862x171.745,-94.75x164.112,-108.693x155.229,-121.808x145.165,-133.997x133.997,-145.165x121.808,-155.229x108.693,-164.112x94.75,-171.745x80.0862,-178.072x64.8128,-183.043x49.0462,-186.621x32.9063,-188.779x16.516,-189.5x2.32071e-14,-188.779x-16.516,-186.621x-32.9063,-183.043x-49.0462,-178.072x-64.8128,-171.745x-80.0862,-164.112x-94.75,-155.229x-108.693,-145.165x-121.808,-133.997x-133.997,-121.808x-145.165,-108.693x-155.229,-94.75x-164.112,-80.0862x-171.745,-64.8128x-178.072,-49.0462x-183.043,-32.9063x-186.621,-16.516x-188.779,-3.48106e-14x-189.5,16.516x-188.779,32.9063x-186.621,49.0462x-183.043,64.8128x-178.072,80.0862x-171.745,94.75x-164.112,108.693x-155.229,121.808x-145.165,133.997x-133.997,145.165x-121.808,155.229x-108.693,164.112x-94.75,171.745x-80.0862,178.072x-64.8128,183.043x-49.0462,186.621x-32.9063,188.779x-16.516,189.5x-4.64141e-14 +max_print_height = 445 +z_offset = 0 +single_extruder_multi_material = 0 +gcode_flavor = reprap +silent_mode = 0 +remaining_times = 0 +use_relative_e_distances = 0 +use_firmware_retraction = 0 +use_volumetric_e = 0 +variable_layer_height = 1 +start_gcode = ; start_gcode | start\n\n; v11 2020-11-14_11-27 tillverka\n\n; set metric values\n\nG21\n\n; use absolute positioning\n\nG90\n\n; set extruder to absolute mode\n\nM82\n\n; start with fan off\n\nM107\n\n; set temps\n\nM104 S[first_layer_temperature]\nM140 S[first_layer_bed_temperature]\n\n; home xy\n\nG28 X0 Y0\n\n; home z\n\nG28 Z0\n\n; move the head down to Z 94mm\n\nG1 Z94.0 F2394\n\n; set and wait for temps\n\nM109 S[first_layer_temperature]\nM190 S[first_layer_bed_temperature]\n\n; zero the extruded length\n\nG92 E0\n\n; extrude 3mm of feed stock\n\nG1 F200 E3\n\n; zero the extruded length again\n\nG92 E0\n\n; set speed\n\nG1 F{travel_speed}\n\n; print preskirt\n\nG92 E0\nG1 E3.94000 F2520.00000\n\nG1 X125.464 Y-139.310\nG1 Z0.329 F3994.000\n\nG1 F994.000\n\nG1 X125.464 Y-139.310 E4.19679\nG1 X130.218 Y-134.876 E4.70359\nG1 X132.569 Y-132.567 E4.96053\nG1 X137.099 Y-127.877 E5.46890\nG1 X139.325 Y-125.447 E5.72585\nG1 X141.507 Y-122.981 E5.98254\nG1 X145.685 Y-118.002 E6.48934\nG1 X149.741 Y-112.810 E7.00296\nG1 X153.561 Y-107.552 E7.50975\nG1 X155.440 Y-104.819 E7.76827\nG1 X158.980 Y-99.367 E8.27506\nG1 X160.702 Y-96.558 E8.53201\nG1 X163.962 Y-90.911 E9.04038\nG1 X165.535 Y-88.015 E9.29732\nG1 X168.496 Y-82.205 E9.80570\nG1 X169.915 Y-79.231 E10.06264\nG1 X171.280 Y-76.235 E10.31934\nG1 X173.819 Y-70.251 E10.82613\nG1 X176.180 Y-64.101 E11.33975\nG1 X178.297 Y-57.955 E11.84654\nG1 X179.294 Y-54.793 E12.10507\nG1 X181.085 Y-48.544 E12.61186\nG1 X181.911 Y-45.354 E12.86880\nG1 X183.378 Y-39.001 E13.37718\nG1 X184.035 Y-35.771 E13.63412\nG1 X185.168 Y-29.350 E14.14250\nG1 X185.655 Y-26.091 E14.39944\nG1 X186.084 Y-22.826 E14.65614\nG1 X186.764 Y-16.362 E15.16293\nG1 X187.223 Y-9.790 E15.67655\nG1 X187.450 Y-3.294 E16.18334\nG1 X187.479 Y0.002 E16.44028\nG1 X187.450 Y3.294 E16.69698\nG1 X187.223 Y9.810 E17.20529\nG1 X187.021 Y13.100 E17.46229\nG1 X186.454 Y19.575 E17.96909\nG1 X186.079 Y22.870 E18.22761\nG1 X185.174 Y29.307 E18.73440\nG1 X184.031 Y35.794 E19.24802\nG1 X182.679 Y42.152 E19.75481\nG1 X181.910 Y45.357 E20.01176\nG1 X180.223 Y51.655 E20.52013\nG1 X179.287 Y54.815 E20.77708\nG1 X177.272 Y61.017 E21.28545\nG1 X176.172 Y64.123 E21.54239\nG1 X175.019 Y67.207 E21.79909\nG1 X172.584 Y73.234 E22.30588\nG1 X169.905 Y79.252 E22.81950\nG1 X167.055 Y85.094 E23.32629\nG1 X165.524 Y88.035 E23.58482\nG1 X162.373 Y93.721 E24.09161\nG1 X160.700 Y96.560 E24.34855\nG1 X157.245 Y102.090 E24.85693\nG1 X155.427 Y104.838 E25.11387\nG1 X151.687 Y110.180 E25.62225\nG1 X149.727 Y112.829 E25.87919\nG1 X147.722 Y115.441 E26.13588\nG1 X143.631 Y120.493 E26.64268\nG1 X139.310 Y125.464 E27.15629\nG1 X134.876 Y130.218 E27.66309\nG1 X132.567 Y132.569 E27.92003\nG1 X127.877 Y137.099 E28.42840\nG1 X125.447 Y139.325 E28.68535\nG1 X122.981 Y141.507 E28.94204\nG1 X118.002 Y145.685 E29.44883\nG1 X112.810 Y149.741 E29.96245\nG1 X107.552 Y153.561 E30.46924\nG1 X104.819 Y155.440 E30.72777\nG1 X99.367 Y158.980 E31.23456\nG1 X96.558 Y160.702 E31.49151\nG1 X90.911 Y163.962 E31.99988\nG1 X88.015 Y165.535 E32.25682\nG1 X82.205 Y168.496 E32.76520\nG1 X79.231 Y169.915 E33.02214\nG1 X76.235 Y171.280 E33.27884\nG1 X70.251 Y173.819 E33.78563\nG1 X64.101 Y176.180 E34.29925\nG1 X57.955 Y178.297 E34.80604\nG1 X54.793 Y179.294 E35.06457\nG1 X48.544 Y181.085 E35.57136\nG1 X45.354 Y181.911 E35.82830\nG1 X39.001 Y183.378 E36.33668\nG1 X35.771 Y184.035 E36.59362\nG1 X29.350 Y185.168 E37.10200\nG1 X26.091 Y185.655 E37.35894\nG1 X22.826 Y186.084 E37.61563\nG1 X16.362 Y186.764 E38.12242\nG1 X9.790 Y187.223 E38.63605\nG1 X3.294 Y187.450 E39.14283\nG1 X-0.002 Y187.479 E39.39978\nG1 X-3.294 Y187.450 E39.65648\nG1 X-9.810 Y187.223 E40.16479\nG1 X-13.100 Y187.021 E40.42179\nG1 X-19.575 Y186.454 E40.92858\nG1 X-22.870 Y186.079 E41.18711\nG1 X-29.307 Y185.174 E41.69390\nG1 X-35.794 Y184.031 E42.20752\nG1 X-42.152 Y182.679 E42.71431\nG1 X-45.357 Y181.910 E42.97126\nG1 X-51.655 Y180.223 E43.47963\nG1 X-54.815 Y179.287 E43.73657\nG1 X-61.017 Y177.272 E44.24495\nG1 X-64.123 Y176.172 E44.50189\nG1 X-67.207 Y175.019 E44.75859\nG1 X-73.234 Y172.584 E45.26538\nG1 X-79.252 Y169.905 E45.77900\nG1 X-85.094 Y167.055 E46.28579\nG1 X-88.035 Y165.524 E46.54432\nG1 X-93.721 Y162.373 E47.05111\nG1 X-96.560 Y160.700 E47.30805\nG1 X-102.090 Y157.245 E47.81643\nG1 X-104.838 Y155.427 E48.07337\nG1 X-110.180 Y151.687 E48.58174\nG1 X-112.829 Y149.727 E48.83869\nG1 X-115.441 Y147.722 E49.09538\nG1 X-120.493 Y143.631 E49.60218\nG1 X-125.464 Y139.310 E50.11579\nG1 X-130.218 Y134.876 E50.62259\nG1 X-132.569 Y132.567 E50.87953\nG1 X-137.099 Y127.877 E51.38790\nG1 X-139.325 Y125.447 E51.64485\nG1 X-141.507 Y122.981 E51.90154\nG1 X-145.685 Y118.002 E52.40833\nG1 X-149.741 Y112.810 E52.92195\nG1 X-153.561 Y107.552 E53.42874\nG1 X-155.440 Y104.819 E53.68727\nG1 X-158.980 Y99.367 E54.19406\nG1 X-160.702 Y96.558 E54.45101\nG1 X-163.962 Y90.911 E54.95938\nG1 X-165.535 Y88.015 E55.21632\nG1 X-168.496 Y82.205 E55.72470\nG1 X-169.915 Y79.231 E55.98164\nG1 X-171.280 Y76.235 E56.23834\nG1 X-173.819 Y70.251 E56.74513\nG1 X-176.180 Y64.101 E57.25875\nG1 X-178.297 Y57.955 E57.76554\nG1 X-179.294 Y54.793 E58.02407\nG1 X-181.085 Y48.544 E58.53086\nG1 X-181.911 Y45.354 E58.78780\nG1 X-183.378 Y39.001 E59.29618\nG1 X-184.035 Y35.771 E59.55312\nG1 X-185.168 Y29.350 E60.06149\nG1 X-185.655 Y26.091 E60.31844\nG1 X-186.084 Y22.826 E60.57513\nG1 X-186.764 Y16.362 E61.08192\nG1 X-187.223 Y9.790 E61.59554\nG1 X-187.450 Y3.294 E62.10233\nG1 X-187.479 Y-0.002 E62.35928\nG1 X-187.450 Y-3.294 E62.61598\nG1 X-187.223 Y-9.810 E63.12429\nG1 X-187.021 Y-13.100 E63.38129\nG1 X-186.454 Y-19.575 E63.88808\nG1 X-186.079 Y-22.870 E64.14661\nG1 X-185.174 Y-29.307 E64.65340\nG1 X-184.031 Y-35.794 E65.16702\nG1 X-182.679 Y-42.152 E65.67381\nG1 X-181.910 Y-45.357 E65.93076\nG1 X-180.223 Y-51.655 E66.43913\nG1 X-179.287 Y-54.815 E66.69607\nG1 X-177.272 Y-61.017 E67.20445\nG1 X-176.172 Y-64.123 E67.46139\nG1 X-175.019 Y-67.207 E67.71809\nG1 X-172.584 Y-73.234 E68.22488\nG1 X-169.905 Y-79.252 E68.73850\nG1 X-167.055 Y-85.094 E69.24529\nG1 X-165.524 Y-88.035 E69.50382\nG1 X-162.373 Y-93.721 E70.01061\nG1 X-160.700 Y-96.560 E70.26755\nG1 X-157.245 Y-102.090 E70.77593\nG1 X-155.427 Y-104.838 E71.03287\nG1 X-151.687 Y-110.180 E71.54124\nG1 X-149.727 Y-112.829 E71.79819\nG1 X-147.722 Y-115.441 E72.05488\nG1 X-143.631 Y-120.493 E72.56167\nG1 X-139.310 Y-125.464 E73.07529\nG1 X-134.876 Y-130.218 E73.58209\nG1 X-132.567 Y-132.569 E73.83903\nG1 X-127.877 Y-137.099 E74.34740\nG1 X-125.447 Y-139.325 E74.60435\nG1 X-122.981 Y-141.507 E74.86104\nG1 X-118.002 Y-145.685 E75.36783\nG1 X-112.810 Y-149.741 E75.88145\nG1 X-107.552 Y-153.561 E76.38824\nG1 X-104.819 Y-155.440 E76.64677\nG1 X-99.367 Y-158.980 E77.15356\nG1 X-96.558 Y-160.702 E77.41051\nG1 X-90.911 Y-163.962 E77.91888\nG1 X-88.015 Y-165.535 E78.17582\nG1 X-82.205 Y-168.496 E78.68420\nG1 X-79.231 Y-169.915 E78.94114\nG1 X-76.235 Y-171.280 E79.19784\nG1 X-70.251 Y-173.819 E79.70463\nG1 X-64.101 Y-176.180 E80.21825\nG1 X-57.955 Y-178.297 E80.72504\nG1 X-54.793 Y-179.294 E80.98356\nG1 X-48.544 Y-181.085 E81.49036\nG1 X-45.354 Y-181.911 E81.74730\nG1 X-39.001 Y-183.378 E82.25568\nG1 X-35.771 Y-184.035 E82.51262\nG1 X-29.350 Y-185.168 E83.02099\nG1 X-26.091 Y-185.655 E83.27794\nG1 X-22.826 Y-186.084 E83.53463\nG1 X-16.362 Y-186.764 E84.04142\nG1 X-9.790 Y-187.223 E84.55504\nG1 X-3.294 Y-187.450 E85.06183\nG1 X0.006 Y-187.479 E85.31908\nG1 X6.521 Y-187.366 E85.82715\nG1 X9.810 Y-187.223 E86.08379\nG1 X13.100 Y-187.021 E86.34079\nG1 X19.575 Y-186.454 E86.84758\nG1 X22.870 Y-186.079 E87.10611\nG1 X29.307 Y-185.174 E87.61290\nG1 X35.794 Y-184.031 E88.12652\nG1 X42.152 Y-182.679 E88.63331\nG1 X45.357 Y-181.910 E88.89025\nG1 X51.655 Y-180.223 E89.39863\nG1 X54.815 Y-179.287 E89.65557\nG1 X61.017 Y-177.272 E90.16395\nG1 X64.123 Y-176.172 E90.42089\nG1 X67.207 Y-175.019 E90.67759\nG1 X73.234 Y-172.584 E91.18438\nG1 X79.252 Y-169.905 E91.69800\nG1 X85.094 Y-167.055 E92.20479\nG1 X88.035 Y-165.524 E92.46332\nG1 X93.721 Y-162.373 E92.97011\nG1 X96.560 Y-160.700 E93.22705\nG1 X102.090 Y-157.245 E93.73543\nG1 X104.838 Y-155.427 E93.99237\nG1 X110.180 Y-151.687 E94.50074\nG1 X112.829 Y-149.727 E94.75768\nG1 X115.441 Y-147.722 E95.01438\nG1 X120.493 Y-143.631 E95.52117\nG1 X122.911 Y-141.529 E95.77098\n\n; end preskirt\n; start_gcode | end +end_gcode = ; end_gcode | start\n\n; v11 2020-11-14_11-27 tillverka\n\n; use relative positioning\n\nG91\n\n; retract the filament a bit before lifting the nozzle to release some of the pressure\n\nG1 E-1 F300\n\n; home\n\nG28\n\n; use absolute positioning\n\nG90\n\n; cooldown\n\nM104 S0\nM140 S0\n\n; end_gcode | end\n +before_layer_gcode = +layer_gcode = +toolchange_gcode = +between_objects_gcode = +retract_length = 4 +retract_lift = 0.3 +retract_lift_above = 0 +retract_lift_below = 449 +retract_speed = 30 +deretract_speed = 0 +retract_restart_extra = 0 +retract_before_travel = 2 +retract_layer_change = 1 +wipe = 1 +retract_before_wipe = 70% +retract_length_toolchange = 10 +retract_restart_extra_toolchange = 0 +extruder_colour = #1193FF +machine_max_acceleration_e = 3000 +machine_max_acceleration_extruding = 1000 +machine_max_acceleration_retracting = 1000 +machine_max_acceleration_x = 1500 +machine_max_acceleration_y = 1500 +machine_max_acceleration_z = 1500 +machine_max_feedrate_e = 60 +machine_max_feedrate_x = 200 +machine_max_feedrate_y = 200 +machine_max_feedrate_z = 200 +machine_max_jerk_e = 5 +machine_max_jerk_x = 5 +machine_max_jerk_y = 5 +machine_max_jerk_z = 5 +machine_min_extruding_rate = 0 +machine_min_travel_rate = 0 +printer_settings_id = +printer_notes = Do not remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_ANYCUBIC\nPRINTER_MODEL_PREDATOR\nPRINTER_HAS_BOWDEN\n +default_filament_profile = Generic PLA @PREDATOR + +[printer:Anycubic Predator 0.4 nozzle] +inherits = *common predator* +printer_model = PREDATOR +printer_variant = 0.4 +nozzle_diameter = 0.4 +min_layer_height = 0.08 +max_layer_height = 0.32 +default_print_profile = 0.16mm 0.4 nozzle DETAILED QUALITY @PREDATOR + +[printer:Anycubic Predator 0.6 nozzle] +inherits = *common predator* +printer_model = PREDATOR +printer_variant = 0.6 +nozzle_diameter = 0.6 +min_layer_height = 0.12 +max_layer_height = 0.4 +default_print_profile = 0.24mm 0.8 nozzle DETAILED QUALITY @PREDATOR + +[printer:Anycubic Predator 0.8 nozzle] +inherits = *common predator* +printer_model = PREDATOR +printer_variant = 0.8 +nozzle_diameter = 0.8 +min_layer_height = 0.16 +max_layer_height = 0.48 +default_print_profile = 0.24mm 0.8 nozzle DETAILED QUALITY @PREDATOR + +## Anycubic 4MAX Pro 2.0 +## based on https://hartrusion.com/en/prusaslicer-config-for-anycubic-4max-pro-2-0/ + +[print:*common_4max*] +avoid_crossing_perimeters = 0 +avoid_crossing_perimeters_max_detour = 0 +bottom_fill_pattern = monotonic +bottom_solid_layers = 4 +bridge_acceleration = 300 +bridge_angle = 0 +bridge_flow_ratio = 0.65 +bridge_speed = 30 +brim_separation = 0 +brim_type = outer_only +brim_width = 0 +clip_multipart_objects = 1 +compatible_printers_condition = printer_model=="4MAXPRO20" and nozzle_diameter[0]==0.4 +complete_objects = 0 +default_acceleration = 900 +dont_support_bridges = 1 +draft_shield = disabled +elefant_foot_compensation = 0.2 +ensure_vertical_shell_thickness = 1 +external_perimeter_extrusion_width = 0 +external_perimeter_speed = 35 +external_perimeters_first = 0 +extra_perimeters = 0 +extruder_clearance_height = 20 +extruder_clearance_radius = 20 +extrusion_width = 0.45 +fill_angle = 45 +fill_density = 20% +fill_pattern = gyroid +first_layer_acceleration = 300 +first_layer_acceleration_over_raft = 0 +first_layer_extrusion_width = 0.65 +first_layer_height = 0.3 +first_layer_speed = 20 +first_layer_speed_over_raft = 30 +fuzzy_skin = none +fuzzy_skin_point_dist = 0.8 +fuzzy_skin_thickness = 0.3 +gap_fill_enabled = 1 +gap_fill_speed = 40 +gcode_comments = 0 +gcode_label_objects = 0 +gcode_resolution = 0.0125 +infill_acceleration = 600 +infill_anchor = 400% +infill_anchor_max = 50 +infill_every_layers = 1 +infill_extruder = 1 +infill_extrusion_width = 0 +infill_first = 0 +infill_only_where_needed = 0 +infill_overlap = 23% +infill_speed = 45 +inherits = +interface_shells = 0 +ironing = 0 +ironing_flowrate = 15% +ironing_spacing = 0.1 +ironing_speed = 15 +ironing_type = top +layer_height = 0.2 +max_print_speed = 50 +max_volumetric_speed = 0 +min_skirt_length = 0 +only_retract_when_crossing_perimeters = 0 +ooze_prevention = 0 +output_filename_format = {input_filename_base}_{layer_height}mm_{filament_type[0]}_{print_time}.gcode +overhangs = 1 +perimeter_acceleration = 500 +perimeter_extruder = 1 +perimeter_extrusion_width = 0 +perimeter_speed = 45 +perimeters = 3 +post_process = +print_settings_id = +raft_contact_distance = 0.1 +raft_expansion = 1.5 +raft_first_layer_density = 90% +raft_first_layer_expansion = 3 +raft_layers = 0 +resolution = 0 +seam_position = aligned +single_extruder_multi_material_priming = 1 +skirt_distance = 5 +skirt_height = 1 +skirts = 2 +slicing_mode = regular +small_perimeter_speed = 20 +solid_infill_below_area = 0 +solid_infill_every_layers = 0 +solid_infill_extruder = 1 +solid_infill_extrusion_width = 0 +solid_infill_speed = 45 +spiral_vase = 0 +standby_temperature_delta = -5 +support_material = 0 +support_material_angle = 0 +support_material_auto = 1 +support_material_bottom_contact_distance = 0 +support_material_bottom_interface_layers = -1 +support_material_buildplate_only = 1 +support_material_closing_radius = 2 +support_material_contact_distance = 0.2 +support_material_enforce_layers = 0 +support_material_extruder = 1 +support_material_extrusion_width = 0.4 +support_material_interface_contact_loops = 0 +support_material_interface_extruder = 1 +support_material_interface_layers = 2 +support_material_interface_pattern = rectilinear +support_material_interface_spacing = 0.2 +support_material_interface_speed = 30 +support_material_pattern = rectilinear-grid +support_material_spacing = 2.5 +support_material_speed = 45 +support_material_style = grid +support_material_synchronize_layers = 0 +support_material_threshold = 45 +support_material_with_sheath = 1 +support_material_xy_spacing = 60% +thick_bridges = 1 +thin_walls = 0 +top_fill_pattern = monotonic +top_infill_extrusion_width = 0.4 +top_solid_infill_speed = 30 +top_solid_layers = 5 +travel_speed = 60 +travel_speed_z = 0 +wipe_tower = 0 +wipe_tower_bridging = 10 +wipe_tower_brim_width = 2 +wipe_tower_no_sparse_layers = 0 +wipe_tower_rotation_angle = 0 +wipe_tower_width = 60 +wipe_tower_x = 180 +wipe_tower_y = 140 +xy_size_compensation = 0 + +[print:0.15mm Detail @4Max Pro 2.0] +inherits = *common_4max* +layer_height = 0.15 +bottom_solid_layers = 5 +top_solid_layers = 7 +perimeter_speed = 40 +external_perimeter_speed = 25 + +[print:0.20mm Quality @4Max Pro 2.0] +inherits = *common_4max* +external_perimeter_speed = 25 + +[print:0.30mm Draft @4Max Pro 2.0] +inherits = *common_4max* +layer_height = 0.3 +bottom_solid_layers = 3 +top_solid_layers = 3 + +[filament:*common_4max*] +bed_temperature = 60 +bridge_fan_speed = 100 +compatible_printers_condition = printer_model=="4MAXPRO20" +cooling = 1 +disable_fan_first_layers = 1 +extrusion_multiplier = 1 +fan_always_on = 1 +fan_below_layer_time = 30 +filament_density = 1.24 +filament_diameter = 1.75 +filament_max_volumetric_speed = 0 +filament_type = PLA +first_layer_bed_temperature = 60 +first_layer_temperature = 210 +full_fan_speed_layer = 5 +max_fan_speed = 100 +min_fan_speed = 80 +min_print_speed = 10 +slowdown_below_layer_time = 15 +temperature = 205 + +[filament:*PLA_4max*] +inherits = *common_4max* + +[filament:Generic PLA @4Max Pro 2.0] +inherits = *PLA_4max* +filament_vendor = Generic + +[filament:Anycubic PLA @4Max Pro 2.0] +inherits = *PLA_4max* +first_layer_temperature = 215 +temperature = 207 +filament_vendor = Anycubic + +[filament:Generic ABS @4Max Pro 2.0] +filament_vendor = Generic +compatible_printers_condition = printer_model=="4MAXPRO20" +bed_temperature = 100 +first_layer_bed_temperature = 100 +temperature = 245 +first_layer_temperature = 245 +bridge_fan_speed = 15 +cooling = 1 +disable_fan_first_layers = 3 +extrusion_multiplier = 1 +fan_always_on = 0 +fan_below_layer_time = 60 +filament_colour = #800000 +filament_density = 1.04 +filament_diameter = 1.75 +filament_type = ABS +full_fan_speed_layer = 0 +max_fan_speed = 0 +min_fan_speed = 0 +min_print_speed = 10 +slowdown_below_layer_time = 25 + +[filament:Generic TPU @4Max Pro 2.0] +filament_vendor = Generic +bed_temperature = 60 +bridge_fan_speed = 0 +compatible_printers_condition = printer_model=="4MAXPRO20" +cooling = 1 +disable_fan_first_layers = 3 +extrusion_multiplier = 1 +fan_always_on = 0 +fan_below_layer_time = 60 +filament_colour = #211AB5 +filament_density = 1.19 +filament_deretract_speed = 20 +filament_diameter = 1.75 +filament_retract_speed = 30 +filament_type = FLEX +filament_max_volumetric_speed = 1.65 +first_layer_bed_temperature = 60 +first_layer_temperature = 215 +full_fan_speed_layer = 0 +max_fan_speed = 0 +min_fan_speed = 0 +min_print_speed = 10 +slowdown_below_layer_time = 20 +temperature = 215 + +[filament:Polymaker PolyFlex TPU95 @4Max Pro 2.0] +filament_vendor = Polymaker +bed_temperature = 45 +bridge_fan_speed = 80 +compatible_printers_condition = printer_model=="4MAXPRO20" +cooling = 1 +disable_fan_first_layers = 5 +extrusion_multiplier = 1.04 +fan_always_on = 1 +fan_below_layer_time = 45 +filament_colour = #FD7D2F +filament_density = 1.22 +filament_deretract_speed = 25 +filament_diameter = 1.75 +filament_max_volumetric_speed = 1.65 +filament_retract_length = 4 +filament_retract_restart_extra = 0.1 +filament_retract_speed = 60 +filament_type = FLEX +first_layer_bed_temperature = 55 +first_layer_temperature = 215 +full_fan_speed_layer = 8 +max_fan_speed = 50 +min_fan_speed = 25 +min_print_speed = 10 +slowdown_below_layer_time = 10 +temperature = 217 + +[printer:Anycubic 4Max Pro 2.0] +printer_model = 4MAXPRO20 +printer_variant = 0.4 +printer_technology = FFF +bed_shape = 0x0,270x0,270x210,0x210 +color_change_gcode = M600 +default_filament_profile = Generic PLA @4Max Pro 2.0 +default_print_profile = 0.20mm Quality @4Max Pro 2.0 +deretract_speed = 25 +end_gcode = M104 S0 ; turn off extruder heating\nM140 S0 ; turn off bed heating\nM107 ; turn off fans\nG91 ; relative positioning\nG0 Z+0.5 ; move Z up a tiny bit\nG90 ; absolute positioning\nG0 X135 Y105 F{machine_max_feedrate_x[0]*60} ; move extruder to center position\nG0 Z190.5 F{machine_max_feedrate_z[0]*60} ; lower the plattform to Z min\nM84 ; steppers off\nG90 ; absolute positioning\n +extruder_offset = 0x0 +gcode_flavor = marlin +machine_limits_usage = time_estimate_only +machine_max_acceleration_e = 5000 +machine_max_acceleration_extruding = 1250 +machine_max_acceleration_retracting = 1250 +machine_max_acceleration_travel = 1500 +machine_max_acceleration_x = 900 +machine_max_acceleration_y = 900 +machine_max_acceleration_z = 100 +machine_max_feedrate_e = 120 +machine_max_feedrate_x = 200 +machine_max_feedrate_y = 200 +machine_max_feedrate_z = 16 +machine_max_jerk_e = 5 +machine_max_jerk_x = 6 +machine_max_jerk_y = 6 +machine_max_jerk_z = 0.2 +machine_min_extruding_rate = 0 +machine_min_travel_rate = 0 +max_layer_height = 0.3 +max_print_height = 190 +min_layer_height = 0.07 +nozzle_diameter = 0.4 +pause_print_gcode = M601 +remaining_times = 0 +retract_before_travel = 2 +retract_before_wipe = 0% +retract_layer_change = 1 +retract_length = 2.5 +retract_length_toolchange = 10 +retract_lift = 0 +retract_lift_above = 0 +retract_lift_below = 0 +retract_restart_extra = 0 +retract_restart_extra_toolchange = 0 +retract_speed = 35 +silent_mode = 0 +single_extruder_multi_material = 0 +start_gcode = G21 ; metric values\nG90 ; absolute positioning\nM82 ; set extruder to absolute mode\nM140 S[first_layer_bed_temperature] ; set bed temp\nG28 X0 Y0 ; home X and Y\nG28 Z0 ; home Z\nG1 Z30 F{machine_max_feedrate_z[0]*60} ; move Z a bit down to not blow on the bed edge while heating\nG1 X10 F3900 ; let some space on x to prevent the filament cooling exhaust from beeing blocked by the servo motor\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM104 S[first_layer_temperature] ; set extruder temp\nM106 S80 ; turn on fan to prevent air nozzle melt while heating up\nM109 S[first_layer_temperature] ; wait for extruder temp\nM107 ; start with the fan off\nG28 X0 ; goto X home again\nG92 E0 ; zero the extruded length\nG1 Z0.2 F360 ; move plattform upwards\n; extrude material next to the plattform (comment or remove following lines to disable)\nG1 F180 E20 ; extrude some material next to the plattform\nG92 E0 ; zero the extruded length\nG1 E-[retract_length] F{retract_speed[0]*60} ; do a filament retract\nG92 E0 ; zero the extruded length again\nG1 X5 F3900 ; move sideways to get rid of that string\nG1 E[retract_length] F{retract_speed[0]*60} ; do a filament deretract with retract parameters\nG92 E0 ; zero the extruded length again\n; draw intro line (comment or remove following lines to disable)\nG1 X30 E5 F700 ; draw intro line\nG92 E0 ; zero the extruded length\nG1 E-[retract_length] F{retract_speed[0]*60} ; do a filament retract\nG1 X40 Z2.0 ; move away from the introline\nG92 E0 ; zero the extruded length again\nG1 E[retract_length] F{retract_speed[0]*60} ; do a filament deretract with retract parameters\n; end of intro line code\nM117 Printing...\nG5 +use_firmware_retraction = 0 +use_relative_e_distances = 0 +use_volumetric_e = 0 +variable_layer_height = 1 +wipe = 0 +z_offset = 0 + +########## SLA printer presets ########## + +[sla_print:*common print ANYCUBIC SLA*] +compatible_printers_condition = printer_notes=~/.*PHOTONMONOX.*/ +layer_height = 0.05 +output_filename_format = [input_filename_base].pwmx +pad_edge_radius = 0.5 +pad_enable = 0 +pad_max_merge_distance = 50 +pad_wall_height = 0 +pad_wall_thickness = 1 +pad_wall_slope = 45 +faded_layers = 8 +slice_closing_radius = 0.005 +support_base_diameter = 3 +support_base_height = 1 +support_critical_angle = 45 +support_density_at_45 = 250 +support_density_at_horizontal = 500 +support_head_front_diameter = 0.4 +support_head_penetration = 0.4 +support_head_width = 3 +support_max_bridge_length = 10 +support_minimal_z = 0 +support_object_elevation = 5 +support_pillar_diameter = 1 +support_pillar_connection_mode = zigzag +support_pillar_widening_factor = 0 +supports_enable = 1 +support_small_pillar_diameter_percent = 60% + +[sla_print:0.05 Normal @ANYCUBIC] +inherits = *common print ANYCUBIC SLA* +layer_height = 0.05 + +########### Materials + +[sla_material:*common ANYCUBIC SLA*] +compatible_printers_condition = printer_notes=~/.*PHOTONMONOX.*/ +compatible_prints_condition = layer_height == 0.05 +exposure_time = 7 +initial_exposure_time = 40 +initial_layer_height = 0.05 +material_correction = 1,1,1 +material_notes = LIFT_DISTANCE=8.0\nLIFT_SPEED=2.5\nRETRACT_SPEED=3.0\nBOTTOM_LIFT_SPEED=2.0\nBOTTOM_LIFT_DISTANCE=9.0\nDELAY_BEFORE_EXPOSURE=0.5 + +[sla_material:*common 0.05 ANYCUBIC SLA*] +inherits = *common ANYCUBIC SLA* + +[sla_material:Generic Blue Resin @MONO 0.05] +inherits = *common 0.05 ANYCUBIC SLA* +exposure_time = 2.5 +initial_exposure_time = 40 +material_type = Tough +material_vendor = Generic +material_colour = #6080EC +compatible_printers_condition = printer_notes=~/.*PHOTONMONOX.*/ + +########## Printers + +[printer:Anycubic Photon Mono X] +printer_technology = SLA +printer_model = PHOTON MONO X +printer_variant = default +default_sla_material_profile = Generic Blue Resin @MONO 0.05 +default_sla_print_profile = 0.05 Normal @ANYCUBIC +thumbnails = 224x168 +sla_archive_format = pwmx +bed_shape = 1.48x1.02,193.48x1.02,193.48x121.02,1.48x121.02 +display_height = 120 +display_orientation = landscape +display_mirror_x = 1 +display_mirror_y = 0 +display_pixels_x = 3840 +display_pixels_y = 2400 +display_width = 192 +max_print_height = 245 +elefant_foot_compensation = 0.2 +elefant_foot_min_width = 0.2 +min_exposure_time = 1 +max_exposure_time = 120 +min_initial_exposure_time = 1 +max_initial_exposure_time = 300 +printer_correction = 1,1,1 +gamma_correction = 1 +area_fill = 45 +printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.'\nPRINTER_VENDOR_ANYCUBIC\nPRINTER_MODEL_PHOTONMONOX\n From 0bd3112b7a7840b7c75178ca8deb6b2b5a16d51a Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Fri, 18 Mar 2022 15:45:42 +0100 Subject: [PATCH 40/40] Reworked custom gcode toolpaths generation --- src/libslic3r/GCode/GCodeProcessor.cpp | 6 +++--- src/libslic3r/GCode/GCodeProcessor.hpp | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 43a5f1eb0a..3569f6322d 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -1206,7 +1206,6 @@ void GCodeProcessor::reset() m_extruded_last_z = 0.0f; m_first_layer_height = 0.0f; - m_processing_start_custom_gcode = false; m_g1_line_id = 0; m_layer_id = 0; m_cp_color.reset(); @@ -1810,7 +1809,6 @@ void GCodeProcessor::process_tags(const std::string_view comment, bool producers set_extrusion_role(ExtrusionEntity::string_to_role(comment.substr(reserved_tag(ETags::Role).length()))); if (m_extrusion_role == erExternalPerimeter) m_seams_detector.activate(true); - m_processing_start_custom_gcode = (m_extrusion_role == erCustom && m_g1_line_id == 0); return; } @@ -2516,6 +2514,8 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line) if (m_forced_height > 0.0f) m_height = m_forced_height; + else if (m_layer_id == 0) + m_height = (m_end_position[Z] <= double(m_first_layer_height)) ? m_end_position[Z] : m_first_layer_height; else { if (m_end_position[Z] > m_extruded_last_z + EPSILON) m_height = m_end_position[Z] - m_extruded_last_z; @@ -3269,7 +3269,7 @@ void GCodeProcessor::store_move_vertex(EMoveType type) m_extrusion_role, m_extruder_id, m_cp_color.current, - Vec3f(m_end_position[X], m_end_position[Y], m_processing_start_custom_gcode ? m_first_layer_height : m_end_position[Z] - m_z_offset) + m_extruder_offsets[m_extruder_id], + Vec3f(m_end_position[X], m_end_position[Y], m_end_position[Z] - m_z_offset) + m_extruder_offsets[m_extruder_id], static_cast(m_end_position[E] - m_start_position[E]), m_feedrate, m_width, diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index 5ca8f0b026..9faa795784 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -547,7 +547,6 @@ namespace Slic3r { ExtruderTemps m_extruder_temps; float m_extruded_last_z; float m_first_layer_height; // mm - bool m_processing_start_custom_gcode; unsigned int m_g1_line_id; unsigned int m_layer_id; CpColor m_cp_color;