Merge branch 'main' into dev/bbl-network-upd

This commit is contained in:
Noisyfox
2025-05-05 15:21:17 +08:00
committed by GitHub
189 changed files with 5887 additions and 347 deletions

View File

@@ -3081,7 +3081,7 @@ int CLI::run(int argc, char **argv)
else {
partplate_list.reset_size(old_printable_width, old_printable_depth, old_printable_height, false);
}
partplate_list.set_shapes(current_printable_area, current_exclude_area, bed_texture, height_to_lid, height_to_rod);
partplate_list.set_shapes(make_counter_clockwise(current_printable_area), current_exclude_area, bed_texture, height_to_lid, height_to_rod);
//plate_stride = partplate_list.plate_stride_x();
}

View File

@@ -14,6 +14,7 @@ BuildVolume::BuildVolume(const std::vector<Vec2d> &printable_area, const double
assert(printable_height >= 0);
m_polygon = Polygon::new_scale(printable_area);
assert(m_polygon.is_counter_clockwise());
// Calcuate various metrics of the input polygon.
m_convex_hull = Geometry::convex_hull(m_polygon.points);

View File

@@ -1410,4 +1410,14 @@ ExPolygons variable_offset_inner_ex(const ExPolygon &expoly, const std::vector<s
return output;
}
Pointfs make_counter_clockwise(const Pointfs& pointfs)
{
Pointfs ps = pointfs;
if (Polygon::new_scale(pointfs).is_clockwise()) {
std::reverse(ps.begin(), ps.end());
}
return ps;
}
}

View File

@@ -661,6 +661,8 @@ Polygons variable_offset_outer(const ExPolygon &expoly, const std::vector<std::
ExPolygons variable_offset_outer_ex(const ExPolygon &expoly, const std::vector<std::vector<float>> &deltas, double miter_limit = 2.);
ExPolygons variable_offset_inner_ex(const ExPolygon &expoly, const std::vector<std::vector<float>> &deltas, double miter_limit = 2.);
Pointfs make_counter_clockwise(const Pointfs& pointfs);
} // namespace Slic3r
#endif // slic3r_ClipperUtils_hpp_

View File

@@ -4337,16 +4337,18 @@ LayerResult GCode::process_layer(
for (ObjectByExtruder::Island &island : instance_to_print.object_by_extruder.islands) {
const auto& by_region_specific = is_anything_overridden ? island.by_region_per_copy(by_region_per_copy_cache, static_cast<unsigned int>(instance_to_print.instance_id), extruder_id, print_wipe_extrusions != 0) : island.by_region;
//BBS: add brim by obj by extruder
if (this->m_objsWithBrim.find(instance_to_print.print_object.id()) != this->m_objsWithBrim.end() && !print_wipe_extrusions) {
this->set_origin(0., 0.);
m_avoid_crossing_perimeters.use_external_mp();
for (const ExtrusionEntity* ee : print.m_brimMap.at(instance_to_print.print_object.id()).entities) {
gcode += this->extrude_entity(*ee, "brim", m_config.support_speed.value);
if (first_layer) {
if (this->m_objsWithBrim.find(instance_to_print.print_object.id()) != this->m_objsWithBrim.end() && !print_wipe_extrusions) {
this->set_origin(0., 0.);
m_avoid_crossing_perimeters.use_external_mp();
for (const ExtrusionEntity* ee : print.m_brimMap.at(instance_to_print.print_object.id()).entities) {
gcode += this->extrude_entity(*ee, "brim", m_config.support_speed.value);
}
m_avoid_crossing_perimeters.use_external_mp(false);
// Allow a straight travel move to the first object point.
m_avoid_crossing_perimeters.disable_once();
this->m_objsWithBrim.erase(instance_to_print.print_object.id());
}
m_avoid_crossing_perimeters.use_external_mp(false);
// Allow a straight travel move to the first object point.
m_avoid_crossing_perimeters.disable_once();
this->m_objsWithBrim.erase(instance_to_print.print_object.id());
}
// When starting a new object, use the external motion planner for the first travel move.
const Point& offset = instance_to_print.print_object.instances()[instance_to_print.instance_id].shift;

View File

@@ -831,7 +831,7 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
const ConfigOptionPoints* printable_area = config.option<ConfigOptionPoints>("printable_area");
if (printable_area != nullptr)
m_result.printable_area = printable_area->values;
m_result.printable_area = make_counter_clockwise(printable_area->values);
//BBS: add bed_exclude_area
const ConfigOptionPoints* bed_exclude_area = config.option<ConfigOptionPoints>("bed_exclude_area");

View File

@@ -8117,15 +8117,15 @@ Points get_bed_shape(const DynamicPrintConfig &config)
return {};
}
return to_points(bed_shape_opt->values);
return to_points(make_counter_clockwise(bed_shape_opt->values));
}
Points get_bed_shape(const PrintConfig &cfg)
{
return to_points(cfg.printable_area.values);
return to_points(make_counter_clockwise(cfg.printable_area.values));
}
Points get_bed_shape(const SLAPrinterConfig &cfg) { return to_points(cfg.printable_area.values); }
Points get_bed_shape(const SLAPrinterConfig &cfg) { return to_points(make_counter_clockwise(cfg.printable_area.values)); }
Polygon get_bed_shape_with_excluded_area(const PrintConfig& cfg)
{

View File

@@ -676,9 +676,9 @@ CustomGCode::Info CalibPressureAdvancePattern::generate_custom_gcodes(const Dyna
/* Draw a line at slightly slower accel and speed in order to trick gcode writer to force update acceleration and speed.
* We do this since several tests may be generated by their own gcode writers which are
* not aware about their neighbours updating acceleration/speed */
gcode << m_writer.set_print_acceleration(accel - 10);
gcode << m_writer.set_print_acceleration(std::max<int>(1, accel - 1));
gcode << move_to(Vec2d(m_starting_point.x(), m_starting_point.y()), m_writer, "Move to starting point", zhop_height, layer_height);
gcode << draw_line(m_writer, Vec2d(m_starting_point.x(), m_starting_point.y() + frame_size_y()), line_width(), height_layer(), speed_adjust(speed_perimeter() - 10), "Accel/flow trick line");
gcode << draw_line(m_writer, Vec2d(m_starting_point.x(), m_starting_point.y() + frame_size_y()), line_width(), height_layer(), speed_adjust(std::max<int>(1, speed_perimeter() - 1)), "Accel/flow trick line");
gcode << m_writer.set_print_acceleration(accel);
}

View File

@@ -596,6 +596,7 @@ if (APPLE)
GUI/Mouse3DHandlerMac.mm
GUI/InstanceCheckMac.mm
GUI/InstanceCheckMac.h
GUI/GUI_UtilsMac.mm
GUI/wxMediaCtrl2.mm
GUI/wxMediaCtrl2.h
)

View File

@@ -1,6 +1,9 @@
#include "2DBed.hpp"
#include "GUI_App.hpp"
#include "3DBed.hpp"
#include "PartPlate.hpp"
#include <wx/dcbuffer.h>
#include "libslic3r/BoundingBox.hpp"
@@ -21,6 +24,63 @@ wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(25 * wxGetApp().em_unit(), -
#endif /*__APPLE__*/
}
int Bed_2D::calculate_grid_step(const BoundingBox& bb)
{
// Orca: use 500 x 500 bed size as baseline.
int min_edge = (bb.size() / ((coord_t) scale_(1)) ).minCoeff(); // Get short edge
// if the grid is too dense, we increase the step
return min_edge >= 6000 ? 100 // Short edge >= 6000mm Main Grid: 5 x 100 = 500mm
: min_edge >= 1200 ? 50 // Short edge >= 1200mm Main Grid: 5 x 50 = 250mm
: min_edge >= 600 ? 20 // Short edge >= 600mm Main Grid: 5 x 20 = 100mm
: 10; // Short edge < 600mm Main Grid: 5 x 10 = 50mm
}
std::vector<Polylines> Bed_2D::generate_grid(const ExPolygon& poly, const BoundingBox& bb, const Vec2d& origin, const float& step, const float& scale)
{
Polylines lines_thin, lines_bold;
int count = 0;
// ORCA draw grid lines relative to origin
for (coord_t x = origin.x(); x >= bb.min(0); x -= step) { // Negative X axis
(count % 5 ? lines_thin : lines_bold).push_back(Polyline(
Point(x, bb.min(1)),
Point(x, bb.max(1))
));
count ++;
}
count = 0;
for (coord_t x = origin.x(); x <= bb.max(0); x += step) { // Positive X axis
(count % 5 ? lines_thin : lines_bold).push_back(Polyline(
Point(x, bb.min(1)),
Point(x, bb.max(1))
));
count ++;
}
count = 0;
for (coord_t y = origin.y(); y >= bb.min(1); y -= step) { // Negative Y axis
(count % 5 ? lines_thin : lines_bold).push_back(Polyline(
Point(bb.min(0), y),
Point(bb.max(0), y)
));
count ++;
}
count = 0;
for (coord_t y = origin.y(); y <= bb.max(1); y += step) { // Positive Y axis
(count % 5 ? lines_thin : lines_bold).push_back(Polyline(
Point(bb.min(0), y),
Point(bb.max(0), y)
));
count ++;
}
std::vector<Polylines> grid;
// clip with a slightly grown expolygon because our lines lay on the contours and may get erroneously clipped
auto scaled_poly = offset(poly, scale);
grid.push_back(intersection_pl(lines_thin, scaled_poly));
grid.push_back(intersection_pl(lines_bold, scaled_poly));
return grid;
}
void Bed_2D::repaint(const std::vector<Vec2d>& shape)
{
wxAutoBufferedPaintDC dc(this);
@@ -28,6 +88,7 @@ void Bed_2D::repaint(const std::vector<Vec2d>& shape)
auto ch = GetSize().GetHeight();
// when canvas is not rendered yet, size is 0, 0
if (cw == 0) return ;
bool is_dark = wxGetApp().dark_mode();
if (m_user_drawn_background) {
// On all systems the AutoBufferedPaintDC() achieves double buffering.
@@ -35,7 +96,7 @@ void Bed_2D::repaint(const std::vector<Vec2d>& shape)
// and on Linux / GTK the background is erased to gray color.
// Fill DC with the background on Windows & Linux / GTK.
wxColour color;
if (wxGetApp().dark_mode()) {// SetBackgroundColour
if (is_dark) {// SetBackgroundColour
color = wxColour(45, 45, 49);
}
else {
@@ -58,7 +119,6 @@ void Bed_2D::repaint(const std::vector<Vec2d>& shape)
auto ccenter = cbb.center();
// get bounding box of bed shape in G - code coordinates
auto bed_polygon = Polygon::new_scale(shape);
auto bb = BoundingBoxf(shape);
bb.merge(Vec2d(0, 0)); // origin needs to be in the visible area
auto bw = bb.size()(0);
@@ -75,8 +135,16 @@ void Bed_2D::repaint(const std::vector<Vec2d>& shape)
m_scale_factor = sfactor;
m_shift = Vec2d(shift(0) + cbb.min(0), shift(1) - (cbb.max(1) - ch));
// ORCA match colors
ColorRGBA bed_rgba = is_dark ? Bed3D::DEFAULT_MODEL_COLOR_DARK : Bed3D::DEFAULT_MODEL_COLOR;
std::string bed_color = encode_color(ColorRGBA(bed_rgba[0] * 0.8f, bed_rgba[1] * 0.8f,bed_rgba[2] * 0.8f, bed_rgba[3]));
ColorRGBA grid_color = is_dark ? PartPlate::LINE_TOP_SEL_DARK_COLOR : PartPlate::LINE_TOP_SEL_COLOR;
std::string lines_bold_color = encode_color(grid_color);
std::string lines_thin_color = encode_color(grid_color * 0.85);
wxColour text_color = wxColour(lines_bold_color);
// draw bed fill
dc.SetBrush(wxBrush(wxColour(255, 255, 255), wxBRUSHSTYLE_SOLID));
dc.SetBrush(wxBrush(wxColour(bed_color), wxBRUSHSTYLE_SOLID));
wxPointList pt_list;
for (auto pt : shape)
{
@@ -85,36 +153,40 @@ void Bed_2D::repaint(const std::vector<Vec2d>& shape)
}
dc.DrawPolygon(&pt_list, 0, 0);
// draw grid
auto step = 10; // 1cm grid
Polylines polylines;
for (auto x = bb.min(0) - fmod(bb.min(0), step) + step; x < bb.max(0); x += step) {
polylines.push_back(Polyline::new_scale({ Vec2d(x, bb.min(1)), Vec2d(x, bb.max(1)) }));
}
for (auto y = bb.min(1) - fmod(bb.min(1), step) + step; y < bb.max(1); y += step) {
polylines.push_back(Polyline::new_scale({ Vec2d(bb.min(0), y), Vec2d(bb.max(0), y) }));
}
polylines = intersection_pl(polylines, bed_polygon);
ExPolygon bed_poly;
for (const Vec2d& p : shape)
bed_poly.contour.append({p(0), p(1)});
auto bed_bb = bed_poly.contour.bounding_box();
int step = calculate_grid_step(bed_bb);
auto grid_lines = generate_grid(bed_poly, bed_bb, m_pos, step, 1.0f);
dc.SetPen(wxPen(wxColour(230, 230, 230), 1, wxPENSTYLE_SOLID));
for (auto pl : polylines)
{
for (size_t i = 0; i < pl.points.size()-1; i++) {
Point pt1 = to_pixels(unscale(pl.points[i]), ch);
Point pt2 = to_pixels(unscale(pl.points[i + 1]), ch);
// clip with a slightly grown expolygon because our lines lay on the contours and may get erroneously clipped
dc.SetPen(wxPen(wxColour(lines_thin_color), 1, wxPENSTYLE_SOLID));
for (auto pl : grid_lines[0]) {
for (size_t i = 0; i < pl.points.size() - 1; i++) {
Point pt1 = to_pixels(pl.points[i ], ch);
Point pt2 = to_pixels(pl.points[i+1], ch);
dc.DrawLine(pt1(0), pt1(1), pt2(0), pt2(1));
}
}
dc.SetPen(wxPen(wxColour(lines_bold_color), 1, wxPENSTYLE_SOLID));
for (auto pl : grid_lines[1]) {
for (size_t i = 0; i < pl.points.size() - 1; i++) {
Point pt1 = to_pixels(pl.points[i ], ch);
Point pt2 = to_pixels(pl.points[i+1], ch);
dc.DrawLine(pt1(0), pt1(1), pt2(0), pt2(1));
}
}
// draw bed contour
dc.SetPen(wxPen(wxColour(0, 0, 0), 1, wxPENSTYLE_SOLID));
dc.SetBrush(wxBrush(wxColour(0, 0, 0), wxBRUSHSTYLE_TRANSPARENT));
dc.SetPen( wxPen( wxColour(lines_bold_color), 1, wxPENSTYLE_SOLID));
dc.SetBrush(wxBrush(wxColour(lines_bold_color), wxBRUSHSTYLE_TRANSPARENT));
dc.DrawPolygon(&pt_list, 0, 0);
auto origin_px = to_pixels(Vec2d(0, 0), ch);
// draw axes
auto axes_len = 50;
auto axes_len = 5 * wxGetApp().em_unit(); // scale axis
auto arrow_len = 6;
auto arrow_angle = Geometry::deg2rad(45.0);
dc.SetPen(wxPen(wxColour(255, 0, 0), 2, wxPENSTYLE_SOLID)); // red
@@ -139,13 +211,26 @@ void Bed_2D::repaint(const std::vector<Vec2d>& shape)
dc.DrawCircle(origin_px(0), origin_px(1), 3);
static const auto origin_label = wxString("(0,0)");
dc.SetTextForeground(wxColour(0, 0, 0));
dc.SetTextForeground(wxColour("#FFFFFF"));
dc.SetFont(wxFont(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
auto extent = dc.GetTextExtent(origin_label);
const auto origin_label_x = origin_px(0) <= cw / 2 ? origin_px(0) + 1 : origin_px(0) - 1 - extent.GetWidth();
const auto origin_label_y = origin_px(1) <= ch / 2 ? origin_px(1) + 1 : origin_px(1) - 1 - extent.GetHeight();
const auto origin_label_x = origin_px(0) + 2; // ORCA always draw (0,0) text in axes bounding box
const auto origin_label_y = origin_px(1) - extent.GetHeight() - 2;
dc.SetPen( wxPen( wxColour(wxColour(bed_color)), 1, wxPENSTYLE_SOLID));
dc.SetBrush(wxBrush(wxColour(wxColour(bed_color)), wxBRUSHSTYLE_SOLID));
dc.DrawRectangle(wxPoint(origin_label_x, origin_label_y), extent); // ORCA draw a background to origin position text to improve readability when overlaps with grid
dc.DrawText(origin_label, origin_label_x, origin_label_y);
// ORCA add grid size value as information for large scale beds
auto grid_label = wxString("1x1 Grid: " + std::to_string(step) + " mm");
Point draw_bb = to_pixels(Vec2d(
std::min(m_pos(0),bb.min(0)),
std::min(m_pos(1),bb.min(1))
),ch);
dc.SetTextForeground(wxColour(StateColor::darkModeColorFor("#262E30")));
dc.SetFont(wxFont(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
dc.DrawText(grid_label, draw_bb(0), draw_bb(1) + 5);
// draw current position
if (m_pos!= Vec2d(0, 0)) {
auto pos_px = to_pixels(m_pos, ch);
@@ -166,6 +251,12 @@ Point Bed_2D::to_pixels(const Vec2d& point, int height)
return Point(p(0) + Border, height - p(1) + Border);
}
Point Bed_2D::to_pixels(const Point& point, int height)
{
auto p = point * m_scale_factor + Point(m_shift);
return Point(p(0) + Border, height - p(1) + Border);
}
void Bed_2D::set_pos(const Vec2d& pos)
{
m_pos = pos;

View File

@@ -18,11 +18,16 @@ class Bed_2D : public wxPanel
Vec2d m_pos = Vec2d::Zero();
Point to_pixels(const Vec2d& point, int height);
Point to_pixels(const Point& point, int height);
void set_pos(const Vec2d& pos);
public:
explicit Bed_2D(wxWindow* parent);
static int calculate_grid_step(const BoundingBox& bb);
static std::vector<Polylines> generate_grid(const ExPolygon& poly, const BoundingBox& pp_bbox, const Vec2d& origin, const float& step, const float& scale);
void repaint(const std::vector<Vec2d>& shape);
};

View File

@@ -28,10 +28,6 @@
#endif
static const float GROUND_Z = -0.04f;
static const Slic3r::ColorRGBA DEFAULT_MODEL_COLOR = { 0.3255f, 0.337f, 0.337f, 1.0f };
static const Slic3r::ColorRGBA DEFAULT_MODEL_COLOR_DARK = { 0.255f, 0.255f, 0.283f, 1.0f };
static const Slic3r::ColorRGBA DEFAULT_SOLID_GRID_COLOR = { 0.9f, 0.9f, 0.9f, 1.0f };
static const Slic3r::ColorRGBA DEFAULT_TRANSPARENT_GRID_COLOR = { 0.9f, 0.9f, 0.9f, 0.6f };
namespace Slic3r {
namespace GUI {
@@ -185,6 +181,12 @@ const float Bed3D::Axes::DefaultStemLength = 25.0f;
const float Bed3D::Axes::DefaultTipRadius = 2.5f * Bed3D::Axes::DefaultStemRadius;
const float Bed3D::Axes::DefaultTipLength = 5.0f;
// ORCA make bed colors accessable for 2D bed
ColorRGBA Bed3D::DEFAULT_MODEL_COLOR = { 0.3255f, 0.337f, 0.337f, 1.0f };
ColorRGBA Bed3D::DEFAULT_MODEL_COLOR_DARK = { 0.255f, 0.255f, 0.283f, 1.0f };
ColorRGBA Bed3D::DEFAULT_SOLID_GRID_COLOR = { 0.9f, 0.9f, 0.9f, 1.0f };
ColorRGBA Bed3D::DEFAULT_TRANSPARENT_GRID_COLOR = { 0.9f, 0.9f, 0.9f, 0.6f };
ColorRGBA Bed3D::AXIS_X_COLOR = ColorRGBA::X();
ColorRGBA Bed3D::AXIS_Y_COLOR = ColorRGBA::Y();
ColorRGBA Bed3D::AXIS_Z_COLOR = ColorRGBA::Z();
@@ -432,7 +434,7 @@ std::tuple<Bed3D::Type, std::string, std::string> Bed3D::detect_type(const Point
while (curr != nullptr) {
if (curr->config.has("printable_area")) {
std::string texture_filename, model_filename;
if (shape == dynamic_cast<const ConfigOptionPoints*>(curr->config.option("printable_area"))->values) {
if (shape == make_counter_clockwise(dynamic_cast<const ConfigOptionPoints*>(curr->config.option("printable_area"))->values)) {
if (curr->is_system)
model_filename = PresetUtils::system_printer_bed_model(*curr);
else {

View File

@@ -47,6 +47,12 @@ bool init_model_from_poly(GLModel &model, const ExPolygon &poly, float z);
class Bed3D
{
public:
// ORCA make bed colors accessable for 2D bed
static ColorRGBA DEFAULT_MODEL_COLOR;
static ColorRGBA DEFAULT_MODEL_COLOR_DARK;
static ColorRGBA DEFAULT_SOLID_GRID_COLOR;
static ColorRGBA DEFAULT_TRANSPARENT_GRID_COLOR;
static ColorRGBA AXIS_X_COLOR;
static ColorRGBA AXIS_Y_COLOR;
static ColorRGBA AXIS_Z_COLOR;

View File

@@ -20,9 +20,9 @@
namespace Slic3r {
namespace GUI {
BedShape::BedShape(const ConfigOptionPoints& points)
BedShape::BedShape(const Pointfs& points)
{
m_build_volume = { points.values, 0. };
m_build_volume = { points, 0. };
}
static std::string get_option_label(BedShape::Parameter param)
@@ -130,7 +130,7 @@ void BedShape::apply_optgroup_values(ConfigOptionsGroupShp optgroup)
}
}
void BedShapeDialog::build_dialog(const ConfigOptionPoints& default_pt, const ConfigOptionString& custom_texture, const ConfigOptionString& custom_model)
void BedShapeDialog::build_dialog(const Pointfs& default_pt, const ConfigOptionString& custom_texture, const ConfigOptionString& custom_model)
{
SetFont(wxGetApp().normal_font());
@@ -172,10 +172,10 @@ void BedShapeDialog::on_dpi_changed(const wxRect &suggested_rect)
const std::string BedShapePanel::NONE = "None";
const std::string BedShapePanel::EMPTY_STRING = "";
void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const std::string& custom_texture, const std::string& custom_model)
void BedShapePanel::build_panel(const Pointfs& default_pt, const std::string& custom_texture, const std::string& custom_model)
{
wxGetApp().UpdateDarkUI(this);
m_shape = default_pt.values;
m_shape = make_counter_clockwise(default_pt);
m_custom_texture = custom_texture.empty() ? NONE : custom_texture;
m_custom_model = custom_model.empty() ? NONE : custom_model;
@@ -240,7 +240,7 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const std:
SetSizerAndFit(top_sizer);
set_shape(default_pt);
set_shape(m_shape);
update_preview();
}
@@ -454,16 +454,16 @@ wxPanel* BedShapePanel::init_model_panel()
// Deduce the bed shape type(rect, circle, custom)
// This routine shall be smart enough if the user messes up
// with the list of points in the ini file directly.
void BedShapePanel::set_shape(const ConfigOptionPoints& points)
void BedShapePanel::set_shape(const Pointfs& points)
{
BedShape shape(points);
m_shape_options_book->SetSelection(int(shape.get_page_type()));
shape.apply_optgroup_values(m_optgroups[int(shape.get_page_type())]);
// Copy the polygon to the canvas, make a copy of the array, if custom shape is selected
if (shape.is_custom())
m_loaded_shape = points.values;
m_loaded_shape = points;
m_shape_options_book->SetSelection(int(shape.get_page_type()));
shape.apply_optgroup_values(m_optgroups[int(shape.get_page_type())]);
update_shape();
@@ -580,6 +580,7 @@ void BedShapePanel::load_stl()
}
auto polygon = expolygons[0].contour;
polygon.make_counter_clockwise();
std::vector<Vec2d> points;
for (auto pt : polygon.points)
points.push_back(unscale(pt));

View File

@@ -34,7 +34,7 @@ struct BedShape
Diameter
};
BedShape(const ConfigOptionPoints& points);
BedShape(const Pointfs& points);
bool is_custom() { return m_build_volume.type() == BuildVolume_Type::Convex || m_build_volume.type() == BuildVolume_Type::Custom; }
@@ -56,18 +56,18 @@ class BedShapePanel : public wxPanel
static const std::string EMPTY_STRING;
Bed_2D* m_canvas;
std::vector<Vec2d> m_shape;
std::vector<Vec2d> m_loaded_shape;
Pointfs m_shape;
Pointfs m_loaded_shape;
std::string m_custom_texture;
std::string m_custom_model;
public:
BedShapePanel(wxWindow* parent) : wxPanel(parent, wxID_ANY), m_custom_texture(NONE), m_custom_model(NONE) {}
void build_panel(const ConfigOptionPoints& default_pt, const std::string& custom_texture, const std::string& custom_model);
void build_panel(const Pointfs& default_pt, const std::string& custom_texture, const std::string& custom_model);
// Returns the resulting bed shape polygon. This value will be stored to the ini file.
const std::vector<Vec2d>& get_shape() const { return m_shape; }
const Pointfs& get_shape() const { return m_shape; }
const std::string& get_custom_texture() const { return (m_custom_texture != NONE) ? m_custom_texture : EMPTY_STRING; }
const std::string& get_custom_model() const { return (m_custom_model != NONE) ? m_custom_model : EMPTY_STRING; }
@@ -76,7 +76,7 @@ private:
void activate_options_page(ConfigOptionsGroupShp options_group);
wxPanel* init_texture_panel();
wxPanel* init_model_panel();
void set_shape(const ConfigOptionPoints& points);
void set_shape(const Pointfs& points);
void update_preview();
void update_shape();
void load_stl();
@@ -96,9 +96,9 @@ public:
BedShapeDialog(wxWindow* parent) : DPIDialog(parent, wxID_ANY, _(L("Bed Shape")),
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE) {}
void build_dialog(const ConfigOptionPoints& default_pt, const ConfigOptionString& custom_texture, const ConfigOptionString& custom_model);
void build_dialog(const Pointfs& default_pt, const ConfigOptionString& custom_texture, const ConfigOptionString& custom_model);
const std::vector<Vec2d>& get_shape() const { return m_panel->get_shape(); }
const Pointfs& get_shape() const { return m_panel->get_shape(); }
const std::string& get_custom_texture() const { return m_panel->get_custom_texture(); }
const std::string& get_custom_model() const { return m_panel->get_custom_model(); }

View File

@@ -1278,7 +1278,7 @@ PageBedShape::PageBedShape(ConfigWizard* parent)
{
append_text(_L("Set the shape of your printer's bed."));
shape_panel->build_panel(*wizard_p()->custom_config->option<ConfigOptionPoints>("printable_area"),
shape_panel->build_panel(wizard_p()->custom_config->option<ConfigOptionPoints>("printable_area")->values,
*wizard_p()->custom_config->option<ConfigOptionString>("bed_custom_texture"),
*wizard_p()->custom_config->option<ConfigOptionString>("bed_custom_model"));

View File

@@ -67,55 +67,96 @@ static const std::vector<std::string> filament_types = {"PLA", "rPLA", "PLA+
static const std::vector<std::string> printer_vendors =
{"Anker", "Anycubic", "Artillery", "Bambulab", "BIQU",
"Comgrow", "Creality", "Custom Printer", "Elegoo", "Flashforge",
"FLSun", "FlyingBear", "Folgertech", "InfiMech", "Kingroon",
"Orca Arena Printer", "Peopoly", "Prusa", "Qidi", "Raise3D",
"RatRig", "SecKit", "Snapmaker", "Sovol", "Tronxy",
"TwoTrees", "UltiMaker", "Vivedino", "Voron", "Voxelab",
"Vzbot", "Wanhao"};
"Blocks", "Chuanying", "Co Print", "Comgrow", "CONSTRUCT3D",
"Creality", "DeltaMaker", "Dremel", "Elegoo", "Flashforge",
"FLSun", "FlyingBear", "Folgertech", "Geeetech", "Ginger Additive",
"InfiMech", "Kingroon", "Lulzbot", "MagicMaker", "Mellow",
"Orca Arena Printer", "Peopoly", "Positron 3D", "Prusa", "Qidi",
"Raise3D", "RatRig", "RolohaunDesign", "SecKit", "Snapmaker",
"Sovol", "Thinker X400", "Tronxy", "TwoTrees", "UltiMaker",
"Vivedino", "Volumic", "Voron", "Voxelab", "Vzbot",
"Wanhao", "Z-Bolt"};
static const std::unordered_map<std::string, std::vector<std::string>> printer_model_map =
{{"Anker", {"Anker M5", "Anker M5 All-Metal Hot End", "Anker M5C"}},
{"Anycubic", {"Kossel Linear Plus", "Kossel Pulley(Linear)", "Mega Zero", "i3 Mega", "Predator"}},
{"Artillery", {"sidewinder X1", "Genius", "Hornet"}},
{"BIBO", {"BIBO2 Touch"}},
{"BIQU", {"BX"}},
{"Creality ENDER", {"Ender-3", "Ender-3 BLTouch", "Ender-3 Pro", "Ender-3 Neo",
"Ender-3 V2 Neo", "Ender-3 S1 Plus", "Ender-3 Max", "Ender-3 Max Neo",
"Ender-4", "Ender-5 Pro", "Ender-5 Pro",
"Ender-7", "Ender-2", "Ender-2 Pro"}},
{"Creality CR", {"CR-5 Pro", "CR-5 Pro H", "CR-10 SMART", "CR-10 SMART Pro", "CR-10 Mini",
"CR-10", "CR-10 v3", "CR-10 S", "CR-10 v2", "CR-10 v2",
"CR-10 S Pro", "CR-10 S Pro v2", "CR-10 S4", "CR-10 S5", "CR-20", "CR-20 Pro", "CR-200B",
"CR-8"}},
{"Creality SERMOON",{"Sermoon-D1", "Sermoon-V1", "Sermoon-V1 Pro"}},
{"FLSun", {"FLSun QQs Pro", "FLSun Q5"}},
{"gCreate", {"gMax 1.5XT Plus", "gMax 2", "gMax 2 Pro", "gMax 2 Dual 2in1", "gMax 2 Dual Chimera"}},
{"Geeetech", {"Thunder", "Thunder Pro", "Mizar s", "Mizar Pro", "Mizar", "Mizar Max",
"Mizar M", "A10 Pro", "A10 M", "A10 T", "A20", "A20 M",
"A20T", "A30 Pro", "A30 M", "A30 T", "E180", "Me Ducer",
"Me creator", "Me Creator2", "GiantArmD200", "l3 ProB", "l3 Prow", "l3 ProC"}},
{"INAT", {"Proton X Rail", "Proton x Rod", "Proton XE-750"}},
{"Infinity3D", {"DEV-200", "DEV-350"}},
{"Jubilee", {"Jubilee"}},
{"LNL3D", {"D3 v2", "D3 Vulcan", "D5", "D6"}},
{"LulzBot", {"Mini Aero", "Taz6 Aero"}},
{"MakerGear", {"Micro", "M2(V4 Hotend)", "M2 Dual", "M3-single Extruder", "M3-Independent Dual Rev.0", "M3-Independent Dual Rev.0(Duplication Mode)",
"M3-Independent Dual Rev.1", "M3-Independent Dual Rev.1(Duplication Mode)", "ultra One", "Ultra One (DuplicationMode)"}},
{"Original Prusa", {"MK4", "SL1S SPEED", "MMU3"}},
{"Papapiu", {"N1s"}},
{"Print4Taste", {"mycusini 2.0"}},
{"RatRig", {"V-core-3 300mm", "V-Core-3 400mm", "V-Core-3 500mm", "V-Minion"}},
{"Rigid3D", {"Zero2", "Zero3"}},
{"Snapmaker", {"A250", "A350"}},
{"Sovol", {"SV06", "SV06 PLUS", "SV05", "SV04", "SV03 / SV03 BLTOUCH", "SVO2 / SV02 BLTOUCH", "SVO1 / SV01 BLToUCH", "SV01 PRO"}},
{"TriLAB", {"AzteQ Industrial","AzteQ Dynamic", "DeltiQ 2", "DeltiQ 2 Plus", "DeltiQ 2 + FlexPrint 2", "DeltiQ 2 Plus + FlexPrint 2", "DeltiQ 2 +FlexPrint",
"DeltiQ 2 Plus + FlexPrint", "DeltiQ M", "DeltiQ L", "DeltiQ XL"}},
{"Trimaker", {"Nebula cloud", "Nebula", "Cosmos ll"}},
{"Ultimaker", {"Ultimaker 2"}},
{"Voron", {"v2 250mm3", "v2 300mm3", "v2 350mm3", "v1 250mm3", "v1 300mm3", "v1 350mm3",
"Zero 120mm3", "Switchwire"}},
{"Zonestar", {"Z5", "Z6", "Z5x", "Z8", "Z9"}}};
{{"Anker", {"Anker M5", "Anker M5 All-Metal Hot End", "Anker M5C"}},
{"Anycubic", {"Anycubic i3 Mega S", "Anycubic Chiron", "Anycubic Vyper", "Anycubic Kobra", "Anycubic Kobra Max",
"Anycubic Kobra Plus", "Anycubic 4Max Pro", "Anycubic 4Max Pro 2", "Anycubic Kobra 2", "Anycubic Kobra 2 Plus",
"Anycubic Kobra 2 Max", "Anycubic Kobra 2 Pro", "Anycubic Kobra 2 Neo", "Anycubic Kobra 3", "Anycubic Kobra S1"}},
{"Artillery", {"Artillery Sidewinder X1", "Artillery Genius", "Artillery Genius Pro", "Artillery Sidewinder X2", "Artillery Hornet",
"Artillery Sidewinder X3 Pro", "Artillery Sidewinder X3 Plus", "Artillery Sidewinder X4 Pro", "Artillery Sidewinder X4 Plus"}},
{"Bambulab", {"Bambu Lab X1 Carbon", "Bambu Lab X1", "Bambu Lab X1E", "Bambu Lab P1P", "Bambu Lab P1S",
"Bambu Lab A1 mini", "Bambu Lab A1"}},
{"BIQU", {"BIQU B1", "BIQU BX", "BIQU Hurakan"}},
{"Blocks", {"BLOCKS Pro S100", "BLOCKS RD50 V2", "BLOCKS RF50"}},
{"Chuanying", {"Chuanying X1"}},
{"Co Print", {"Co Print ChromaSet"}},
{"Comgrow", {"Comgrow T300", "Comgrow T500"}},
{"CONSTRUCT3D", {"Construct 1 XL", "Construct 1"}},
{"Creality", {"Creality CR-10 V2", "Creality CR-10 Max", "Creality CR-10 SE", "Creality CR-6 SE", "Creality CR-6 Max",
"Creality CR-M4", "Creality Ender-3 V2", "Creality Ender-3 V2 Neo", "Creality Ender-3 S1", "Creality Ender-3",
"Creality Ender-3 Pro", "Creality Ender-3 S1 Pro", "Creality Ender-3 S1 Plus", "Creality Ender-3 V3 SE", "Creality Ender-3 V3 KE",
"Creality Ender-3 V3", "Creality Ender-3 V3 Plus", "Creality Ender-5", "Creality Ender-5 Max", "Creality Ender-5 Plus",
"Creality Ender-5 Pro (2019)", "Creality Ender-5S", "Creality Ender-5 S1", "Creality Ender-6", "Creality Sermoon V1",
"Creality K1", "Creality K1C", "Creality K1 Max", "Creality K1 SE", "Creality K2 Plus",
"Creality Hi"}},
{"DeltaMaker", {"DeltaMaker 2", "DeltaMaker 2T", "DeltaMaker 2XT"}},
{"Dremel", {"Dremel 3D20", "Dremel 3D40", "Dremel 3D45"}},
{"Elegoo", {"Elegoo Centauri Carbon", "Elegoo Centauri", "Elegoo Neptune", "Elegoo Neptune X", "Elegoo Neptune 2",
"Elegoo Neptune 2S", "Elegoo Neptune 2D", "Elegoo Neptune 3", "Elegoo Neptune 3 Pro", "Elegoo Neptune 3 Plus",
"Elegoo Neptune 3 Max", "Elegoo Neptune 4 Pro", "Elegoo Neptune 4", "Elegoo Neptune 4 Max", "Elegoo Neptune 4 Plus",
"Elegoo OrangeStorm Giga"}},
{"Flashforge", {"Flashforge Adventurer 5M", "Flashforge Adventurer 5M Pro", "Flashforge AD5X", "Flashforge Adventurer 3 Series", "Flashforge Adventurer 4 Series",
"Flashforge Guider 3 Ultra", "Flashforge Guider 2s"}},
{"FLSun", {"FLSun Q5", "FLSun QQ-S Pro", "FLSun Super Racer (SR)", "FLSun V400", "FLSun T1",
"FLSun S1"}},
{"FlyingBear", {"FlyingBear Reborn3", "FlyingBear S1", "FlyingBear Ghost 6"}},
{"Folgertech", {"Folgertech i3", "Folgertech FT-5", "Folgertech FT-6"}},
{"Geeetech", {"Geeetech Thunder", "Geeetech Mizar M", "Geeetech Mizar S", "Geeetech Mizar Pro", "Geeetech Mizar Max",
"Geeetech Mizar", "Geeetech A10 Pro", "Geeetech A10 M", "Geeetech A10 T", "Geeetech A20",
"Geeetech A20 M", "Geeetech A20 T", "Geeetech A30 Pro", "Geeetech A30 M", "Geeetech A30 T",
"Geeetech M1"}},
{"Ginger Additive", {"ginger G1"}},
{"InfiMech", {"InfiMech TX", "InfiMech TX Hardened Steel Nozzle"}},
{"Kingroon", {"Kingroon KP3S PRO S1", "Kingroon KP3S PRO V2", "Kingroon KP3S 3.0", "Kingroon KP3S V1", "Kingroon KLP1"}},
{"Lulzbot", {"Lulzbot Taz 6", "Lulzbot Taz 4 or 5", "Lulzbot Taz Pro Dual", "Lulzbot Taz Pro S"}},
{"MagicMaker", {"MM hqs hj", "MM hqs SF", "MM hj SK", "MM BoneKing", "MM slb"}},
{"Mellow", {"M1"}},
{"Orca Arena Printer",{"Orca Arena X1 Carbon"}},
{"Peopoly", {"Peopoly Magneto X"}},
{"Positron 3D", {"The Positron"}},
{"Prusa", {"MK4IS", "MINIIS", "MK3S", "MINI", "MK3.5",
"Prusa XL", "Prusa XL 5T", "MK4S", "MK4S HF"}},
{"Qidi", {"Qidi X-Plus 4", "Qidi Q1 Pro", "Qidi X-Max 3", "Qidi X-Plus 3", "Qidi X-Smart 3",
"Qidi X-Plus", "Qidi X-Max", "Qidi X-CF Pro"}},
{"Raise3D", {"Raise3D Pro3", "Raise3D Pro3 Plus"}},
{"RatRig", {"RatRig V-Core 3 200", "RatRig V-Core 3 300", "RatRig V-Core 3 400", "RatRig V-Core 3 500", "RatRig V-Minion",
"RatRig V-Cast", "RatRig V-Core 4 300", "RatRig V-Core 4 400", "RatRig V-Core 4 500", "RatRig V-Core 4 HYBRID 300",
"RatRig V-Core 4 HYBRID 400", "RatRig V-Core 4 HYBRID 500", "RatRig V-Core 4 IDEX 300", "RatRig V-Core 4 IDEX 300 COPY MODE", "RatRig V-Core 4 IDEX 300 MIRROR MODE",
"RatRig V-Core 4 IDEX 400", "RatRig V-Core 4 IDEX 400 COPY MODE", "RatRig V-Core 4 IDEX 400 MIRROR MODE", "RatRig V-Core 4 IDEX 500", "RatRig V-Core 4 IDEX 500 COPY MODE",
"RatRig V-Core 4 IDEX 500 MIRROR MODE"}},
{"RolohaunDesign", {"Rook MK1 LDO"}},
{"SecKit", {"SecKit SK-Tank", "Seckit Go3"}},
{"Snapmaker", {"Snapmaker J1", "Snapmaker A250", "Snapmaker A350", "Snapmaker A250 Dual", "Snapmaker A350 Dual",
"Snapmaker A250 QSKit", "Snapmaker A350 QSKit", "Snapmaker A250 BKit", "Snapmaker A350 BKit", "Snapmaker A250 QS+B Kit",
"Snapmaker A350 QS+B Kit", "Snapmaker A250 Dual QSKit", "Snapmaker A350 Dual QSKit", "Snapmaker A250 Dual BKit", "Snapmaker A350 Dual BKit",
"Snapmaker A250 Dual QS+B Kit", "Snapmaker A350 Dual QS+B Kit", "Snapmaker Artisan"}},
{"Sovol", {"Sovol SV01 Pro", "Sovol SV02", "Sovol SV05", "Sovol SV06", "Sovol SV06 Plus",
"Sovol SV06 ACE", "Sovol SV06 Plus ACE", "Sovol SV07", "Sovol SV07 Plus", "Sovol SV08"}},
{"Thinker X400", {"Thinker X400"}},
{"Tronxy", {"Tronxy X5SA 400 Marlin Firmware"}},
{"TwoTrees", {"TwoTrees SP-5 Klipper", "TwoTrees SK1"}},
{"UltiMaker", {"UltiMaker 2"}},
{"Vivedino", {"Troodon 2.0 - RRF", "Troodon 2.0 - Klipper"}},
{"Volumic", {"EXO42 Performance", "EXO65 Performance", "SH65 Performance", "EXO42", "EXO65",
"SH65", "VS30SC2", "VS30SC", "VS30ULTRA", "VS30MK3",
"VS30MK2", "VS20MK2"}},
{"Voron", {"Voron 2.4 250", "Voron 2.4 300", "Voron 2.4 350", "Voron Trident 250", "Voron Trident 300",
"Voron Trident 350", "Voron 0.1", "Voron Switchwire 250"}},
{"Voxelab", {"Voxelab Aquila X2"}},
{"Vzbot", {"Vzbot 235 AWD", "Vzbot 330 AWD"}},
{"Wanhao", {"Wanhao D12-300"}},
{"Z-Bolt", {"Z-Bolt S300", "Z-Bolt S300 Dual", "Z-Bolt S400", "Z-Bolt S400 Dual", "Z-Bolt S600",
"Z-Bolt S600 Dual"}}};
static std::vector<std::string> nozzle_diameter_vec = {"0.4", "0.15", "0.2", "0.25", "0.3", "0.35", "0.5", "0.6", "0.75", "0.8", "1.0", "1.2"};
static std::unordered_map<std::string, float> nozzle_diameter_map = {{"0.15", 0.15}, {"0.2", 0.2}, {"0.25", 0.25}, {"0.3", 0.3},
@@ -1704,6 +1745,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent)
m_select_vendor->SetLabelColor(DEFAULT_PROMPT_TEXT_COLOUR);
wxArrayString printer_vendor;
for (const std::string &vendor : printer_vendors) {
assert(printer_model_map.find(vendor) != printer_model_map.end());
printer_vendor.Add(vendor);
}
m_select_vendor->Set(printer_vendor);

View File

@@ -4067,7 +4067,7 @@ void GUI_App::on_http_error(wxCommandEvent &evt)
try {
auto evt_str = evt.GetString();
if (!evt_str.empty()) {
json j = json::parse(evt_str);
json j = json::parse(evt_str.utf8_string());
if (j.contains("code")) {
if (!j["code"].is_null())
code = j["code"].get<int>();

View File

@@ -83,15 +83,49 @@ class wxRenderer : public wxDelegateRendererNative
{
public:
wxRenderer() : wxDelegateRendererNative(wxRendererNative::Get()) {}
virtual void DrawItemSelectionRect(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) wxOVERRIDE
{ GetGeneric().DrawItemSelectionRect(win, dc, rect, flags); }
virtual void DrawItemSelectionRect(wxWindow *win, wxDC& dc, const wxRect& rect, int flags = 0) override
{ // ORCA draw selection background to improve consistency between platforms
dc.SetBrush(StateColor::darkModeColorFor(wxColour("#BFE1DE")));
dc.DrawRectangle(rect);
//GetGeneric().DrawItemSelectionRect(win, dc, rect, flags);
}
virtual void DrawFocusRect( wxWindow *win, wxDC& dc, const wxRect& rect, int flags = 0) override
{ // ORCA draw focus rectangle to improve consistency between platforms
dc.SetPen( StateColor::darkModeColorFor(wxColour("#009688")));
dc.DrawRectangle(rect);
}
virtual void DrawTreeItemButton( wxWindow *win, wxDC& dc, const wxRect& rect, int flags = 0) override
{ // ORCA draw custom triangle to improve consistency between platforms
dc.SetPen( StateColor::darkModeColorFor(wxColour("#7C8282")));
dc.SetBrush(StateColor::darkModeColorFor(wxColour("#7C8282")));
bool expanded = (flags == wxCONTROL_EXPANDED || flags == (wxCONTROL_CURRENT | wxCONTROL_EXPANDED));
wxRect r = rect;
// stretch rectangle depends on orientation
r.Deflate((expanded ? wxSize(4, 6) : wxSize(6, 4)) * (wxGetApp().em_unit() * .1));
wxPoint triangle[3];
triangle[0] = wxPoint(r.x, r.y);
triangle[1] = triangle[0] + wxPoint(r.width, expanded ? 0 :r.height/2);
triangle[2] = triangle[0] + wxPoint(expanded ? r.width/2 : 0, r.height);
dc.DrawPolygon(3, &triangle[0]);
}
virtual void DrawItemText(
wxWindow* win,
wxDC& dc,
const wxString& text,
const wxRect& rect,
int align = wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
int flags = 0, // wxCONTROL_SELECTED wxCONTROL_FOCUSED wxCONTROL_DISABLED
wxEllipsizeMode ellipsizeMode = wxELLIPSIZE_END
) override
{ // ORCA draw custom text to improve consistency between platforms
dc.SetFont(Label::Body_13);
dc.SetTextForeground(StateColor::darkModeColorFor(wxColour("#262E30"))); // use same color for selected / non-selected
dc.DrawText(text,wxPoint(rect.x, rect.y));
}
};
ObjectList::ObjectList(wxWindow* parent) :
wxDataViewCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_MULTIPLE)
wxDataViewCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_MULTIPLE | wxNO_BORDER | wxDV_NO_HEADER) // ORCA: Remove border and header
{
wxGetApp().UpdateDVCDarkUI(this, true);
@@ -103,7 +137,6 @@ ObjectList::ObjectList(wxWindow* parent) :
SetFont(Label::sysFont(13));
#ifdef __WXMSW__
GenericGetHeader()->SetFont(Label::sysFont(13));
static auto render = new wxRenderer;
wxRendererNative::Set(render);
#endif
@@ -289,18 +322,12 @@ ObjectList::ObjectList(wxWindow* parent) :
} else {
m_last_size = this->GetSize();
}
#ifdef __WXGTK__
// On GTK, the EnsureVisible call is postponed to Idle processing (see wxDataViewCtrl::m_ensureVisibleDefered).
// So the postponed EnsureVisible() call is planned for an item, which may not exist at the Idle processing time, if this wxEVT_SIZE
// event is succeeded by a delete of the currently active item. We are trying our luck by postponing the wxEVT_SIZE triggered EnsureVisible(),
// which seems to be working as of now.
this->CallAfter([this](){ ensure_current_item_visible(); });
#else
update_name_column_width();
// BBS
this->CallAfter([this]() { ensure_current_item_visible(); });
#endif
e.Skip();
}));
m_last_size = this->GetSize();
@@ -390,7 +417,7 @@ void ObjectList::create_objects_ctrl()
AppendColumn(name_col);
// column PrintableProperty (Icon) of the view control:
AppendBitmapColumn(" ", colPrint, wxOSX ? wxDATAVIEW_CELL_EDITABLE : wxDATAVIEW_CELL_INERT, 3*em,
AppendBitmapColumn(" ", colPrint, wxOSX ? wxDATAVIEW_CELL_EDITABLE : wxDATAVIEW_CELL_INERT, m_columns_width[colPrint]*em,
wxALIGN_CENTER_HORIZONTAL, 0);
// column Extruder of the view control:
@@ -426,11 +453,11 @@ void ObjectList::create_objects_ctrl()
// For some reason under OSX on 4K(5K) monitors in wxDataViewColumn constructor doesn't set width of column.
// Therefore, force set column width.
if (wxOSX)
{
#ifdef __WXOSX__
dataview_remove_insets(this);
for (int cn = colName; cn < colCount; cn++)
GetColumn(cn)->SetWidth(m_columns_width[cn] * em);
}
#endif
}
void ObjectList::get_selected_item_indexes(int& obj_idx, int& vol_idx, const wxDataViewItem& input_item/* = wxDataViewItem(nullptr)*/)
@@ -831,7 +858,8 @@ void ObjectList::update_objects_list_filament_column(size_t filaments_count)
// set show/hide for this column
set_filament_column_hidden(filaments_count == 1);
//a workaround for a wrong last column width updating under OSX
GetColumn(colEditing)->SetWidth(25);
auto em = em_unit(this);
GetColumn(colEditing)->SetWidth(m_columns_width[colEditing]*em);
m_prevent_update_filament_in_config = false;
}
@@ -859,7 +887,7 @@ void ObjectList::update_name_column_width() const
}
}
GetColumn(colName)->SetWidth(client_size.x - (others_width)*em);
GetColumn(colName)->SetWidth(max(0, client_size.x - (others_width)*em));
}
void ObjectList::set_filament_column_hidden(const bool hide) const
@@ -5470,14 +5498,8 @@ void ObjectList::msw_rescale()
const int em = wxGetApp().em_unit();
GetColumn(colName )->SetWidth(20 * em);
GetColumn(colPrint )->SetWidth( 3 * em);
GetColumn(colFilament)->SetWidth( 5 * em);
// BBS
GetColumn(colSupportPaint)->SetWidth(3 * em);
GetColumn(colColorPaint)->SetWidth(3 * em);
GetColumn(colSinking)->SetWidth(3 * em);
GetColumn(colEditing )->SetWidth( 3 * em);
for (int cn = colName; cn < colCount; cn++)
GetColumn(cn)->SetWidth(m_columns_width[cn] * em);
// rescale/update existing items with bitmaps
m_objects_model->Rescale();

View File

@@ -17,6 +17,7 @@
#include <wx/dcclient.h>
#include <wx/debug.h>
#include <wx/settings.h>
#include <wx/dataview.h>
#include <chrono>
@@ -493,6 +494,9 @@ bool load_image(const std::string& filename, wxImage &image);
bool generate_image(const std::string &filename, wxImage &image, wxSize img_size, int method = GERNERATE_IMAGE_RESIZE);
int get_dpi_for_window(const wxWindow *window);
#ifdef __WXOSX__
void dataview_remove_insets(wxDataViewCtrl* dv);
#endif
}}

View File

@@ -0,0 +1,19 @@
#import <wx/osx/cocoa/dataview.h>
#import "GUI_Utils.hpp"
namespace Slic3r {
namespace GUI {
void dataview_remove_insets(wxDataViewCtrl* dv) {
NSScrollView* scrollview = (NSScrollView*) ((wxCocoaDataViewControl*)dv->GetDataViewPeer())->GetWXWidget();
NSOutlineView* outlineview = scrollview.documentView;
[outlineview setIntercellSpacing: NSMakeSize(0.0, 1.0)];
if (@available(macOS 11, *)) {
[outlineview setStyle:NSTableViewStylePlain];
}
}
}
}

View File

@@ -124,7 +124,7 @@ namespace GUI {
{
try {
wxString strInput = evt.GetString();
json j = json::parse(strInput);
json j = json::parse(strInput.utf8_string());
wxString strCmd = j["command"];

View File

@@ -30,6 +30,7 @@
#include "libslic3r/PresetBundle.hpp"
#include "BackgroundSlicingProcess.hpp"
#include "Widgets/Label.hpp"
#include "2DBed.hpp"
#include "3DBed.hpp"
#include "PartPlate.hpp"
#include "Camera.hpp"
@@ -466,65 +467,22 @@ void PartPlate::calc_gridlines(const ExPolygon& poly, const BoundingBox& pp_bbox
m_gridlines.reset();
m_gridlines_bolder.reset();
Polylines axes_lines, axes_lines_bolder;
int count = 0;
int step = 10; // Uses up to 599mm Main Grid: 10 x 5 = 50mm
// Orca: use 500 x 500 bed size as baseline.
// if the grid is too dense, we increase the step
auto min_edge_scaled = (pp_bbox.size() / ((coord_t) scale_(1))).minCoeff();
if ( min_edge_scaled >= 6000) // Switch when short edge >= 6000mm Main Grid: 100 x 5 = 500mm
step = 100;
else if (min_edge_scaled >= 1200) // Switch when short edge >= 1200mm Main Grid: 50 x 5 = 250mm
step = 50;
else if (min_edge_scaled >= 600) // Switch when short edge >= 600mm Main Grid: 20 x 5 = 100mm
step = 20;
// calculate and generate grid
int step = Bed_2D::calculate_grid_step(pp_bbox);
Vec2d scaled_origin = Vec2d(scale_(m_origin.x()),scale_(m_origin.x()));
auto grid_lines = Bed_2D::generate_grid(poly, pp_bbox, scaled_origin, scale_(step), SCALED_EPSILON);
// ORCA draw grid lines relative to origin
for (coord_t x = scale_(m_origin.x()); x >= pp_bbox.min(0); x -= scale_(step)) { // Negative X axis
(count % 5 == 0 ? axes_lines_bolder : axes_lines).push_back(Polyline(
Point(x, pp_bbox.min(1)),
Point(x, pp_bbox.max(1))
));
count ++;
}
count = 0;
for (coord_t x = scale_(m_origin.x()); x <= pp_bbox.max(0); x += scale_(step)) { // Positive X axis
(count % 5 == 0 ? axes_lines_bolder : axes_lines).push_back(Polyline(
Point(x, pp_bbox.min(1)),
Point(x, pp_bbox.max(1))
));
count ++;
}
count = 0;
for (coord_t y = scale_(m_origin.y()); y >= pp_bbox.min(1); y -= scale_(step)) { // Negative Y axis
(count % 5 == 0 ? axes_lines_bolder : axes_lines).push_back(Polyline(
Point(pp_bbox.min(0), y),
Point(pp_bbox.max(0), y)
));
count ++;
}
count = 0;
for (coord_t y = scale_(m_origin.y()); y <= pp_bbox.max(1); y += scale_(step)) { // Positive Y axis
(count % 5 == 0 ? axes_lines_bolder : axes_lines).push_back(Polyline(
Point(pp_bbox.min(0), y),
Point(pp_bbox.max(0), y)
));
count ++;
}
count = 0;
// clip with a slightly grown expolygon because our lines lay on the contours and may get erroneously clipped
Lines gridlines = to_lines(intersection_pl(axes_lines, offset(poly, (float)SCALED_EPSILON)));
Lines gridlines_bolder = to_lines(intersection_pl(axes_lines_bolder, offset(poly, (float)SCALED_EPSILON)));
Lines lines_thin = to_lines(grid_lines[0]);
Lines lines_bold = to_lines(grid_lines[1]);
// append bed contours
Lines contour_lines = to_lines(poly);
std::copy(contour_lines.begin(), contour_lines.end(), std::back_inserter(gridlines));
std::copy(contour_lines.begin(), contour_lines.end(), std::back_inserter(lines_thin));
if (!init_model_from_lines(m_gridlines, gridlines, GROUND_Z_GRIDLINE))
if (!init_model_from_lines(m_gridlines , lines_thin, GROUND_Z_GRIDLINE))
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "Unable to create bed grid lines\n";
if (!init_model_from_lines(m_gridlines_bolder, gridlines_bolder, GROUND_Z_GRIDLINE))
if (!init_model_from_lines(m_gridlines_bolder, lines_bold, GROUND_Z_GRIDLINE))
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "Unable to create bed grid lines\n";
}
@@ -873,8 +831,8 @@ void PartPlate::render_exclude_area(bool force_default_color) {
if (force_default_color) //for thumbnail case
return;
ColorRGBA select_color{ 0.765f, 0.7686f, 0.7686f, 1.0f };
ColorRGBA unselect_color{ 0.9f, 0.9f, 0.9f, 1.0f };
ColorRGBA select_color{ .9f, .86f, .82f, .7f }; // ORCA
ColorRGBA unselect_color{ .6f, .6f, .6f, .3f }; // ORCA
//ColorRGBA default_color{ 0.9f, 0.9f, 0.9f, 1.0f };
// draw exclude area
@@ -2590,49 +2548,57 @@ void PartPlate::generate_exclude_polygon(ExPolygon &exclude_polygon)
int points_count = 8;
if (m_exclude_area.size() == 4)
{
//rectangle case
for (int i = 0; i < 4; i++)
{
const Vec2d& p = m_exclude_area[i];
Vec2d center;
double start_angle, stop_angle, radius;
switch (i) {
case 0:
radius = 5.f;
center(0) = p(0) + radius;
center(1) = p(1) + radius;
start_angle = PI;
stop_angle = 1.5 * PI;
compute_exclude_points(center, radius, start_angle, stop_angle, points_count);
break;
case 1:
exclude_polygon.contour.append({ scale_(p(0)), scale_(p(1)) });
break;
case 2:
radius = 3.f;
center(0) = p(0) - radius;
center(1) = p(1) - radius;
start_angle = 0;
stop_angle = 0.5 * PI;
compute_exclude_points(center, radius, start_angle, stop_angle, points_count);
break;
case 3:
exclude_polygon.contour.append({ scale_(p(0)), scale_(p(1)) });
break;
}
//rectangle case
for (int i = 0; i < 4; i++)
{
const Vec2d& p = m_exclude_area[i];
Vec2d center;
double start_angle, stop_angle, radius;
radius = 1.f; // ORCA use equal rounding for all corners
switch (i) {
case 0: // Left-Bottom
center(0) = p(0) + radius;
center(1) = p(1) + radius;
start_angle = 1.0 * PI; //180
stop_angle = 1.5 * PI; //270
compute_exclude_points(center, radius, start_angle, stop_angle, points_count);
break;
case 1: // Right-Bottom
center(0) = p(0) - radius;
center(1) = p(1) + radius;
start_angle = 1.5 * PI; //270
stop_angle = 2.0 * PI; //360
compute_exclude_points(center, radius, start_angle, stop_angle, points_count);
break;
case 2: // Right-Top
center(0) = p(0) - radius;
center(1) = p(1) - radius;
start_angle = 0.0 * PI; //0
stop_angle = 0.5 * PI; //90
compute_exclude_points(center, radius, start_angle, stop_angle, points_count);
break;
case 3: // Left-Top
center(0) = p(0) + radius;
center(1) = p(1) - radius;
start_angle = 0.5 * PI; //90
stop_angle = 1.0 * PI; //180
compute_exclude_points(center, radius, start_angle, stop_angle, points_count);
break;
}
}
}
else {
for (const Vec2d& p : m_exclude_area) {
exclude_polygon.contour.append({ scale_(p(0)), scale_(p(1)) });
}
}
exclude_polygon.contour.make_counter_clockwise();
}
bool PartPlate::set_shape(const Pointfs& shape, const Pointfs& exclude_areas, Vec2d position, float height_to_lid, float height_to_rod)
{
Pointfs new_shape, new_exclude_areas;
m_raw_shape = shape;
for (const Vec2d& p : shape) {
new_shape.push_back(Vec2d(p.x() + position.x(), p.y() + position.y()));
}

View File

@@ -117,7 +117,6 @@ private:
friend class PartPlateList;
Pointfs m_raw_shape;
Pointfs m_shape;
Pointfs m_exclude_area;
BoundingBoxf3 m_bounding_box;

View File

@@ -13397,7 +13397,7 @@ void Plater::set_bed_shape() const
//BBS: add bed exclude area
void Plater::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_area, const double printable_height, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom) const
{
p->set_bed_shape(shape, exclude_area, printable_height, custom_texture, custom_model, force_as_custom);
p->set_bed_shape(make_counter_clockwise(shape), exclude_area, printable_height, custom_texture, custom_model, force_as_custom);
}
void Plater::force_filament_colors_update()

View File

@@ -237,7 +237,7 @@ void ProjectPanel::OnScriptMessage(wxWebViewEvent& evt)
{
try {
wxString strInput = evt.GetString();
json j = json::parse(strInput);
json j = json::parse(strInput.utf8_string());
wxString strCmd = j["command"];

View File

@@ -6060,7 +6060,7 @@ wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent)
btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) {
bool is_configed_by_BBL = PresetUtils::system_printer_bed_model(m_preset_bundle->printers.get_edited_preset()).size() > 0;
BedShapeDialog dlg(this);
dlg.build_dialog(*m_config->option<ConfigOptionPoints>("printable_area"),
dlg.build_dialog(m_config->option<ConfigOptionPoints>("printable_area")->values,
*m_config->option<ConfigOptionString>("bed_custom_texture"),
*m_config->option<ConfigOptionString>("bed_custom_model"));
if (dlg.ShowModal() == wxID_OK) {

View File

@@ -199,7 +199,7 @@ void DownPluginFrame::OnScriptMessage(wxWebViewEvent &evt)
{
try {
wxString strInput = evt.GetString();
json j = json::parse(strInput);
json j = json::parse(strInput.utf8_string());
wxString strCmd = j["command"];

View File

@@ -373,7 +373,7 @@ void GuideFrame::OnScriptMessage(wxWebViewEvent &evt)
try {
wxString strInput = evt.GetString();
BOOST_LOG_TRIVIAL(trace) << "GuideFrame::OnScriptMessage;OnRecv:" << strInput.c_str();
json j = json::parse(strInput);
json j = json::parse(strInput.utf8_string());
wxString strCmd = j["command"];
BOOST_LOG_TRIVIAL(trace) << "GuideFrame::OnScriptMessage;Command:" << strCmd;
@@ -1212,6 +1212,7 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
json pm = json::parse(contents);
// wxLogMessage("GUIDE: json_path2 loaded");
OneModel["name"] = pm["name"];
OneModel["vendor"] = strVendor;
std::string NozzleOpt = pm["nozzle_diameter"];
StringReplace(NozzleOpt, " ", "");

View File

@@ -990,7 +990,7 @@ bool CalibUtils::get_pa_k_n_value_by_cali_idx(const MachineObject *obj, int cali
bool CalibUtils::process_and_store_3mf(Model *model, const DynamicPrintConfig &full_config, const Calib_Params &params, wxString &error_message)
{
Pointfs bedfs = full_config.opt<ConfigOptionPoints>("printable_area")->values;
Pointfs bedfs = make_counter_clockwise(full_config.opt<ConfigOptionPoints>("printable_area")->values);
double print_height = full_config.opt_float("printable_height");
double current_width = bedfs[2].x() - bedfs[0].x();
double current_depth = bedfs[2].y() - bedfs[0].y();