Tech ENABLE_ENHANCED_PRINT_VOLUME_FIT set as default
This commit is contained in:
parent
243f5c38ee
commit
0cb0f56a80
@ -36,15 +36,6 @@
|
|||||||
#define ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS 1
|
#define ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS 1
|
||||||
|
|
||||||
|
|
||||||
//====================
|
|
||||||
// 2.4.0.beta2 techs
|
|
||||||
//====================
|
|
||||||
#define ENABLE_2_4_0_BETA2 1
|
|
||||||
|
|
||||||
// Enable fit print volume command for circular printbeds
|
|
||||||
#define ENABLE_ENHANCED_PRINT_VOLUME_FIT (1 && ENABLE_2_4_0_BETA2)
|
|
||||||
|
|
||||||
|
|
||||||
//================
|
//================
|
||||||
// 2.4.1.rc techs
|
// 2.4.1.rc techs
|
||||||
//================
|
//================
|
||||||
|
@ -792,14 +792,9 @@ void MenuFactory::append_menu_item_change_extruder(wxMenu* menu)
|
|||||||
|
|
||||||
void MenuFactory::append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu)
|
void MenuFactory::append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu)
|
||||||
{
|
{
|
||||||
#if ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
append_menu_item(menu, wxID_ANY, _L("Scale to print volume"), _L("Scale the selected object to fit the print volume"),
|
append_menu_item(menu, wxID_ANY, _L("Scale to print volume"), _L("Scale the selected object to fit the print volume"),
|
||||||
[](wxCommandEvent&) { plater()->scale_selection_to_fit_print_volume(); }, "", menu,
|
[](wxCommandEvent&) { plater()->scale_selection_to_fit_print_volume(); }, "", menu,
|
||||||
[]() { return plater()->can_scale_to_print_volume(); }, m_parent);
|
[]() { return plater()->can_scale_to_print_volume(); }, m_parent);
|
||||||
#else
|
|
||||||
append_menu_item(menu, wxID_ANY, _L("Scale to print volume"), _L("Scale the selected object to fit the print volume"),
|
|
||||||
[](wxCommandEvent&) { plater()->scale_selection_to_fit_print_volume(); }, "", menu);
|
|
||||||
#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuFactory::append_menu_items_convert_unit(wxMenu* menu, int insert_pos/* = 1*/)
|
void MenuFactory::append_menu_items_convert_unit(wxMenu* menu, int insert_pos/* = 1*/)
|
||||||
|
@ -1941,9 +1941,7 @@ struct Plater::priv
|
|||||||
bool can_reload_from_disk() const;
|
bool can_reload_from_disk() const;
|
||||||
bool can_replace_with_stl() const;
|
bool can_replace_with_stl() const;
|
||||||
bool can_split(bool to_objects) const;
|
bool can_split(bool to_objects) const;
|
||||||
#if ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
bool can_scale_to_print_volume() const;
|
bool can_scale_to_print_volume() const;
|
||||||
#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
|
|
||||||
void generate_thumbnail(ThumbnailData& data, unsigned int w, unsigned int h, const ThumbnailsParams& thumbnail_params, Camera::EType camera_type);
|
void generate_thumbnail(ThumbnailData& data, unsigned int w, unsigned int h, const ThumbnailsParams& thumbnail_params, Camera::EType camera_type);
|
||||||
ThumbnailsList generate_thumbnails(const ThumbnailsParams& params, Camera::EType camera_type);
|
ThumbnailsList generate_thumbnails(const ThumbnailsParams& params, Camera::EType camera_type);
|
||||||
@ -3117,11 +3115,7 @@ void Plater::priv::split_volume()
|
|||||||
|
|
||||||
void Plater::priv::scale_selection_to_fit_print_volume()
|
void Plater::priv::scale_selection_to_fit_print_volume()
|
||||||
{
|
{
|
||||||
#if ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
this->view3D->get_canvas3d()->get_selection().scale_to_fit_print_volume(this->bed.build_volume());
|
this->view3D->get_canvas3d()->get_selection().scale_to_fit_print_volume(this->bed.build_volume());
|
||||||
#else
|
|
||||||
this->view3D->get_canvas3d()->get_selection().scale_to_fit_print_volume(*config);
|
|
||||||
#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::schedule_background_process()
|
void Plater::priv::schedule_background_process()
|
||||||
@ -4536,13 +4530,11 @@ bool Plater::priv::can_split(bool to_objects) const
|
|||||||
return sidebar->obj_list()->is_splittable(to_objects);
|
return sidebar->obj_list()->is_splittable(to_objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
bool Plater::priv::can_scale_to_print_volume() const
|
bool Plater::priv::can_scale_to_print_volume() const
|
||||||
{
|
{
|
||||||
const BuildVolume::Type type = this->bed.build_volume().type();
|
const BuildVolume::Type type = this->bed.build_volume().type();
|
||||||
return !view3D->get_canvas3d()->get_selection().is_empty() && (type == BuildVolume::Type::Rectangle || type == BuildVolume::Type::Circle);
|
return !view3D->get_canvas3d()->get_selection().is_empty() && (type == BuildVolume::Type::Rectangle || type == BuildVolume::Type::Circle);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
|
|
||||||
bool Plater::priv::layers_height_allowed() const
|
bool Plater::priv::layers_height_allowed() const
|
||||||
{
|
{
|
||||||
@ -6863,9 +6855,7 @@ bool Plater::can_reload_from_disk() const { return p->can_reload_from_disk(); }
|
|||||||
bool Plater::can_replace_with_stl() const { return p->can_replace_with_stl(); }
|
bool Plater::can_replace_with_stl() const { return p->can_replace_with_stl(); }
|
||||||
bool Plater::can_mirror() const { return p->can_mirror(); }
|
bool Plater::can_mirror() const { return p->can_mirror(); }
|
||||||
bool Plater::can_split(bool to_objects) const { return p->can_split(to_objects); }
|
bool Plater::can_split(bool to_objects) const { return p->can_split(to_objects); }
|
||||||
#if ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
bool Plater::can_scale_to_print_volume() const { return p->can_scale_to_print_volume(); }
|
bool Plater::can_scale_to_print_volume() const { return p->can_scale_to_print_volume(); }
|
||||||
#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
|
|
||||||
const UndoRedo::Stack& Plater::undo_redo_stack_main() const { return p->undo_redo_stack_main(); }
|
const UndoRedo::Stack& Plater::undo_redo_stack_main() const { return p->undo_redo_stack_main(); }
|
||||||
void Plater::clear_undo_redo_stack_main() { p->undo_redo_stack_main().clear(); }
|
void Plater::clear_undo_redo_stack_main() { p->undo_redo_stack_main().clear(); }
|
||||||
|
@ -323,9 +323,7 @@ public:
|
|||||||
bool can_replace_with_stl() const;
|
bool can_replace_with_stl() const;
|
||||||
bool can_mirror() const;
|
bool can_mirror() const;
|
||||||
bool can_split(bool to_objects) const;
|
bool can_split(bool to_objects) const;
|
||||||
#if ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
bool can_scale_to_print_volume() const;
|
bool can_scale_to_print_volume() const;
|
||||||
#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
|
|
||||||
void msw_rescale();
|
void msw_rescale();
|
||||||
void sys_color_changed();
|
void sys_color_changed();
|
||||||
|
@ -15,9 +15,7 @@
|
|||||||
#include "libslic3r/LocalesUtils.hpp"
|
#include "libslic3r/LocalesUtils.hpp"
|
||||||
#include "libslic3r/Model.hpp"
|
#include "libslic3r/Model.hpp"
|
||||||
#include "libslic3r/PresetBundle.hpp"
|
#include "libslic3r/PresetBundle.hpp"
|
||||||
#if ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
#include "libslic3r/BuildVolume.hpp"
|
#include "libslic3r/BuildVolume.hpp"
|
||||||
#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
|
||||||
@ -943,7 +941,6 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type
|
|||||||
wxGetApp().plater()->canvas3D()->requires_check_outside_state();
|
wxGetApp().plater()->canvas3D()->requires_check_outside_state();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
void Selection::scale_to_fit_print_volume(const BuildVolume& volume)
|
void Selection::scale_to_fit_print_volume(const BuildVolume& volume)
|
||||||
{
|
{
|
||||||
auto fit = [this](double s, Vec3d offset) {
|
auto fit = [this](double s, Vec3d offset) {
|
||||||
@ -1031,50 +1028,6 @@ void Selection::scale_to_fit_print_volume(const BuildVolume& volume)
|
|||||||
default: { break; }
|
default: { break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void Selection::scale_to_fit_print_volume(const DynamicPrintConfig& config)
|
|
||||||
{
|
|
||||||
if (is_empty() || m_mode == Volume)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// adds 1/100th of a mm on all sides to avoid false out of print volume detections due to floating-point roundings
|
|
||||||
Vec3d box_size = get_bounding_box().size() + 0.01 * Vec3d::Ones();
|
|
||||||
|
|
||||||
const ConfigOptionPoints* opt = dynamic_cast<const ConfigOptionPoints*>(config.option("bed_shape"));
|
|
||||||
if (opt != nullptr) {
|
|
||||||
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(opt->values));
|
|
||||||
BoundingBoxf3 print_volume({ unscale<double>(bed_box_2D.min(0)), unscale<double>(bed_box_2D.min(1)), 0.0 }, { unscale<double>(bed_box_2D.max(0)), unscale<double>(bed_box_2D.max(1)), config.opt_float("max_print_height") });
|
|
||||||
Vec3d print_volume_size = print_volume.size();
|
|
||||||
double sx = (box_size(0) != 0.0) ? print_volume_size(0) / box_size(0) : 0.0;
|
|
||||||
double sy = (box_size(1) != 0.0) ? print_volume_size(1) / box_size(1) : 0.0;
|
|
||||||
double sz = (box_size(2) != 0.0) ? print_volume_size(2) / box_size(2) : 0.0;
|
|
||||||
if (sx != 0.0 && sy != 0.0 && sz != 0.0)
|
|
||||||
{
|
|
||||||
double s = std::min(sx, std::min(sy, sz));
|
|
||||||
if (s != 1.0) {
|
|
||||||
wxGetApp().plater()->take_snapshot(_L("Scale To Fit"));
|
|
||||||
|
|
||||||
TransformationType type;
|
|
||||||
type.set_world();
|
|
||||||
type.set_relative();
|
|
||||||
type.set_joint();
|
|
||||||
|
|
||||||
// apply scale
|
|
||||||
start_dragging();
|
|
||||||
scale(s * Vec3d::Ones(), type);
|
|
||||||
wxGetApp().plater()->canvas3D()->do_scale(""); // avoid storing another snapshot
|
|
||||||
|
|
||||||
// center selection on print bed
|
|
||||||
start_dragging();
|
|
||||||
translate(print_volume.center() - get_bounding_box().center());
|
|
||||||
wxGetApp().plater()->canvas3D()->do_move(""); // avoid storing another snapshot
|
|
||||||
|
|
||||||
wxGetApp().obj_manipul()->set_dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
|
|
||||||
void Selection::mirror(Axis axis)
|
void Selection::mirror(Axis axis)
|
||||||
{
|
{
|
||||||
|
@ -17,9 +17,7 @@ class GLArrow;
|
|||||||
class GLCurvedArrow;
|
class GLCurvedArrow;
|
||||||
class DynamicPrintConfig;
|
class DynamicPrintConfig;
|
||||||
class GLShaderProgram;
|
class GLShaderProgram;
|
||||||
#if ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
class BuildVolume;
|
class BuildVolume;
|
||||||
#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
|
|
||||||
using GLVolumePtrs = std::vector<GLVolume*>;
|
using GLVolumePtrs = std::vector<GLVolume*>;
|
||||||
using ModelObjectPtrs = std::vector<ModelObject*>;
|
using ModelObjectPtrs = std::vector<ModelObject*>;
|
||||||
@ -323,11 +321,7 @@ public:
|
|||||||
void rotate(const Vec3d& rotation, TransformationType transformation_type);
|
void rotate(const Vec3d& rotation, TransformationType transformation_type);
|
||||||
void flattening_rotate(const Vec3d& normal);
|
void flattening_rotate(const Vec3d& normal);
|
||||||
void scale(const Vec3d& scale, TransformationType transformation_type);
|
void scale(const Vec3d& scale, TransformationType transformation_type);
|
||||||
#if ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
void scale_to_fit_print_volume(const BuildVolume& volume);
|
void scale_to_fit_print_volume(const BuildVolume& volume);
|
||||||
#else
|
|
||||||
void scale_to_fit_print_volume(const DynamicPrintConfig& config);
|
|
||||||
#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
|
||||||
void mirror(Axis axis);
|
void mirror(Axis axis);
|
||||||
|
|
||||||
void translate(unsigned int object_idx, const Vec3d& displacement);
|
void translate(unsigned int object_idx, const Vec3d& displacement);
|
||||||
|
Loading…
Reference in New Issue
Block a user