mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-14 04:27:36 +00:00
Merge branch 'main' into libvgcode
This commit is contained in:
@@ -759,22 +759,59 @@ std::string GCodeWriter::_travel_to_z(double z, const std::string &comment)
|
||||
|
||||
std::string GCodeWriter::_spiral_travel_to_z(double z, const Vec2d &ij_offset, const std::string &comment)
|
||||
{
|
||||
m_pos(2) = z;
|
||||
|
||||
std::string output;
|
||||
double speed = this->config.travel_speed_z.value;
|
||||
|
||||
if (speed == 0.) {
|
||||
speed = m_is_first_layer ? this->config.get_abs_value("initial_layer_travel_speed")
|
||||
: this->config.travel_speed.value;
|
||||
}
|
||||
|
||||
std::string output = "G17\n";
|
||||
GCodeG2G3Formatter w(true);
|
||||
w.emit_z(z);
|
||||
w.emit_ij(ij_offset);
|
||||
w.emit_string(" P1 ");
|
||||
w.emit_f(speed * 60.0);
|
||||
w.emit_comment(GCodeWriter::full_gcode_comment, comment);
|
||||
return output + w.string();
|
||||
if (!this->config.enable_arc_fitting) { // Orca: if arc fitting is disabled, approximate the arc with small linear segments
|
||||
std::ostringstream oss;
|
||||
const double z_start = m_pos(2); // starting Z height
|
||||
const int segments = 24; // number of linear segments to use for approximating the arc
|
||||
const double px = m_pos(0) - m_x_offset; // take plate offset into consideration
|
||||
const double py = m_pos(1) - m_y_offset; // take plate offset into consideration
|
||||
const double cx = px + ij_offset(0); // center x
|
||||
const double cy = py + ij_offset(1); // center y
|
||||
const double radius = ij_offset.norm(); // radius
|
||||
const double a0 = std::atan2(py - cy, px - cx); // start angle
|
||||
const double delta = 2.0 * M_PI; // CCW full circle
|
||||
|
||||
if (full_gcode_comment)
|
||||
oss << ";" << comment << "\n";
|
||||
|
||||
oss << "G1 F" << (speed * 60.0) << "\n"; // set feedrate
|
||||
|
||||
// approximate the arc with small linear segments (without the last point which is added later to ensure exactness)
|
||||
for (int i = 1; i < segments; ++i) {
|
||||
double t = double(i) / segments; // parametric position along arc
|
||||
double a = a0 + delta * t; // CCW arc param
|
||||
double x = cx + radius * std::cos(a); // point on circle
|
||||
double y = cy + radius * std::sin(a); // point on circle
|
||||
double zz = z_start + (z - z_start) * t; // interpolated Z height
|
||||
|
||||
oss << "G1 X" << x << " Y" << y << " Z" << zz << "\n";
|
||||
}
|
||||
|
||||
oss << "G1 X" << px << " Y" << py << " Z" << z << "\n"; // final point to ensure exactness
|
||||
output = oss.str();
|
||||
} else { // Orca: if arc fitting is enabled emit a G2/G3 command for the spiral lift
|
||||
output = std::string("G17") + (full_gcode_comment ? " ; XY plane for arc\n" : "\n");
|
||||
|
||||
GCodeG2G3Formatter w(true);
|
||||
w.emit_z(z);
|
||||
w.emit_ij(ij_offset);
|
||||
w.emit_string(" P1 ");
|
||||
w.emit_f(speed * 60.0);
|
||||
w.emit_comment(GCodeWriter::full_gcode_comment, comment);
|
||||
|
||||
output += w.string();
|
||||
}
|
||||
|
||||
m_pos(2) = z;
|
||||
return output;
|
||||
}
|
||||
|
||||
bool GCodeWriter::will_move_z(double z) const
|
||||
|
||||
@@ -3891,6 +3891,14 @@ std::pair<PresetsConfigSubstitutions, size_t> PresetBundle::load_vendor_configs_
|
||||
config.apply(config_src);
|
||||
extend_default_config_length(config, true, *default_config);
|
||||
if (instantiation == "false" && "Template" != vendor_name) {
|
||||
// Report configuration fields, which are misplaced into a wrong group.
|
||||
std::string incorrect_keys = Preset::remove_invalid_keys(config, *default_config);
|
||||
if (!incorrect_keys.empty()) {
|
||||
++m_errors;
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": The config " << subfile << " contains incorrect keys: " << incorrect_keys
|
||||
<< ", which were removed";
|
||||
}
|
||||
|
||||
config_maps.emplace(preset_name, std::move(config));
|
||||
if ((presets_collection->type() == Preset::TYPE_FILAMENT) && (!filament_id.empty()))
|
||||
filament_id_maps.emplace(preset_name, filament_id);
|
||||
|
||||
@@ -486,15 +486,15 @@ void BBLTopbar::Rescale() {
|
||||
|
||||
item = this->FindTool(wxID_UNDO);
|
||||
item->SetBitmap(create_scaled_bitmap("topbar_undo", this, TOPBAR_ICON_SIZE));
|
||||
item->SetDisabledBitmap(create_scaled_bitmap("topbar_undo_inactive", nullptr, TOPBAR_ICON_SIZE));
|
||||
item->SetDisabledBitmap(create_scaled_bitmap("topbar_undo_inactive", this, TOPBAR_ICON_SIZE));
|
||||
|
||||
item = this->FindTool(wxID_REDO);
|
||||
item->SetBitmap(create_scaled_bitmap("topbar_redo", this, TOPBAR_ICON_SIZE));
|
||||
item->SetDisabledBitmap(create_scaled_bitmap("topbar_redo_inactive", nullptr, TOPBAR_ICON_SIZE));
|
||||
item->SetDisabledBitmap(create_scaled_bitmap("topbar_redo_inactive", this, TOPBAR_ICON_SIZE));
|
||||
|
||||
item = this->FindTool(ID_CALIB);
|
||||
item->SetBitmap(create_scaled_bitmap("calib_sf", nullptr, TOPBAR_ICON_SIZE));
|
||||
item->SetDisabledBitmap(create_scaled_bitmap("calib_sf_inactive", nullptr, TOPBAR_ICON_SIZE));
|
||||
item->SetBitmap(create_scaled_bitmap("calib_sf", this, TOPBAR_ICON_SIZE));
|
||||
item->SetDisabledBitmap(create_scaled_bitmap("calib_sf_inactive", this, TOPBAR_ICON_SIZE));
|
||||
|
||||
item = this->FindTool(ID_TITLE);
|
||||
|
||||
|
||||
@@ -821,13 +821,14 @@ void GUI_App::post_init()
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", init with input files, size %1%, input_gcode %2%")
|
||||
%this->init_params->input_files.size() %this->init_params->input_gcode;
|
||||
|
||||
switch_to_3d = true;
|
||||
|
||||
const auto first_url = this->init_params->input_files.front();
|
||||
if (this->init_params->input_files.size() == 1 && is_supported_open_protocol(first_url)) {
|
||||
switch_to_3d = true;
|
||||
start_download(first_url);
|
||||
m_open_method = "url";
|
||||
} else {
|
||||
switch_to_3d = true;
|
||||
if (this->init_params->input_gcode) {
|
||||
mainframe->select_tab(size_t(MainFrame::tp3DEditor));
|
||||
plater_->select_view_3D("3D");
|
||||
@@ -904,6 +905,7 @@ void GUI_App::post_init()
|
||||
mainframe->Thaw();
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", end load_gl_resources";
|
||||
}
|
||||
|
||||
plater_->trigger_restore_project(1);
|
||||
//#endif
|
||||
|
||||
|
||||
@@ -59,8 +59,8 @@ MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &he
|
||||
|
||||
m_dsa_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
btn_sizer->Add(0, 0, 0, wxLEFT, FromDIP(120));
|
||||
btn_sizer->AddStretchSpacer();
|
||||
btn_sizer->Add(m_dsa_sizer, 0, wxEXPAND);
|
||||
btn_sizer->AddStretchSpacer();
|
||||
main_sizer->Add(btn_sizer, 0, wxBOTTOM | wxRIGHT | wxEXPAND | wxTOP, FromDIP(10));
|
||||
|
||||
apply_style(style);
|
||||
|
||||
@@ -64,10 +64,10 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow* parent) :
|
||||
auto input_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
wxStaticText *label_top = new wxStaticText(this, wxID_ANY, from_u8((boost::format(_utf8(L("Save %s as"))) % into_u8(tab->title())).str()));
|
||||
label_top->SetFont(::Label::Body_13);
|
||||
label_top->SetFont(::Label::Body_14);
|
||||
label_top->SetForegroundColour(wxColour(38,46,48));
|
||||
|
||||
m_input_area = new RoundedRectangle(this, wxColor(172, 172, 172), wxDefaultPosition, wxSize(-1,-1), 3, 1);
|
||||
m_input_area = new RoundedRectangle(this, StateColor::darkModeColorFor(wxColour("#DBDBDB")), wxDefaultPosition, wxSize(-1,-1), 3, 1);
|
||||
m_input_area->SetMinSize(wxSize(FromDIP(360), FromDIP(32)));
|
||||
|
||||
wxBoxSizer *input_sizer_h = new wxBoxSizer(wxHORIZONTAL);
|
||||
@@ -87,9 +87,9 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow* parent) :
|
||||
m_valid_label = new wxStaticText(this, wxID_ANY, "");
|
||||
m_valid_label->SetForegroundColour(wxColor(255, 111, 0));
|
||||
|
||||
input_sizer->Add(label_top, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, BORDER_W);
|
||||
input_sizer->Add(m_input_area, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, BORDER_W);
|
||||
input_sizer->Add(m_valid_label, 0, wxEXPAND | wxLEFT | wxRIGHT, BORDER_W);
|
||||
input_sizer->Add(label_top, 0, wxEXPAND | wxLEFT, BORDER_W);
|
||||
input_sizer->Add(m_input_area, 0, wxEXPAND | wxTOP, BORDER_W);
|
||||
input_sizer->Add(m_valid_label, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, BORDER_W);
|
||||
|
||||
|
||||
m_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
|
||||
@@ -348,11 +348,6 @@ enum class ActionButtonType : int {
|
||||
abSendGCode
|
||||
};
|
||||
|
||||
int SidebarProps::TitlebarMargin() { return 8; } // Use as side margins on titlebar. Has less margin on sides to create separation with its content
|
||||
int SidebarProps::ContentMargin() { return 12; } // Use as side margins contents of title
|
||||
int SidebarProps::IconSpacing() { return 10; } // Use on main elements
|
||||
int SidebarProps::ElementSpacing() { return 5; } // Use if elements has relation between them like edit button for combo box etc.
|
||||
|
||||
struct ExtruderGroup : StaticGroup
|
||||
{
|
||||
ExtruderGroup(wxWindow * parent, int index, wxString const &title);
|
||||
@@ -547,9 +542,9 @@ void Sidebar::priv::layout_printer(bool isBBL, bool isDual)
|
||||
hsizer_printer->Add(panel_nozzle_dia , 0, wxLEFT, FromDIP(4));
|
||||
hsizer_printer->Add(panel_printer_bed, 0, wxLEFT, FromDIP(4));
|
||||
//hsizer_printer->Add(btn_sync_printer , 0, wxLEFT, FromDIP(4));
|
||||
vsizer_printer->AddSpacer(FromDIP(8));
|
||||
vsizer_printer->AddSpacer(FromDIP(SidebarProps::ContentMarginV()));
|
||||
vsizer_printer->Add(hsizer_printer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(SidebarProps::ContentMargin()));
|
||||
vsizer_printer->AddSpacer(FromDIP(8));
|
||||
vsizer_printer->AddSpacer(FromDIP(SidebarProps::ContentMarginV()));
|
||||
// Printer - extruder
|
||||
|
||||
// double
|
||||
@@ -2099,16 +2094,14 @@ Sidebar::Sidebar(Plater *parent)
|
||||
|
||||
//bSizer_filament_content->Add(p->sizer_filaments, 1, wxALIGN_CENTER | wxALL);
|
||||
wxSizer *sizer_filaments2 = new wxBoxSizer(wxVERTICAL);
|
||||
sizer_filaments2->AddSpacer(FromDIP(16));
|
||||
sizer_filaments2->Add(p->sizer_filaments, 0, wxEXPAND, 0);
|
||||
sizer_filaments2->AddSpacer(FromDIP(16));
|
||||
p->m_panel_filament_content->SetSizer(sizer_filaments2);
|
||||
p->m_panel_filament_content->Layout();
|
||||
auto min_size = sizer_filaments2->GetMinSize();
|
||||
if (min_size.y > p->m_panel_filament_content->GetMaxHeight())
|
||||
min_size.y = p->m_panel_filament_content->GetMaxHeight();
|
||||
p->m_panel_filament_content->SetMinSize(min_size);
|
||||
scrolled_sizer->Add(p->m_panel_filament_content, 0, wxEXPAND, 0);
|
||||
scrolled_sizer->Add(p->m_panel_filament_content, 0, wxEXPAND | wxTOP | wxBOTTOM, FromDIP(SidebarProps::ContentMarginV())); // ORCA use vertical margin on parent otherwise it shows scrollbar even on 1 filament
|
||||
}
|
||||
|
||||
{
|
||||
@@ -2769,6 +2762,8 @@ void Sidebar::msw_rescale()
|
||||
p->m_bpButton_ams_filament->msw_rescale();
|
||||
p->m_bpButton_set_filament->msw_rescale();
|
||||
p->m_flushing_volume_btn->Rescale();
|
||||
set_flushing_volume_warning(is_flush_config_modified()); // ORCA reapply appearance
|
||||
|
||||
//BBS
|
||||
p->left_extruder->Rescale();
|
||||
p->right_extruder->Rescale();
|
||||
@@ -2849,6 +2844,7 @@ void Sidebar::sys_color_changed()
|
||||
p->m_bpButton_ams_filament->msw_rescale();
|
||||
p->m_bpButton_set_filament->msw_rescale();
|
||||
p->m_flushing_volume_btn->Rescale();
|
||||
set_flushing_volume_warning(is_flush_config_modified()); // ORCA reapply appearance
|
||||
|
||||
// BBS
|
||||
#if 0
|
||||
@@ -3565,21 +3561,12 @@ wxButton* Sidebar::get_wiping_dialog_button()
|
||||
|
||||
void Sidebar::set_flushing_volume_warning(const bool flushing_volume_modify)
|
||||
{
|
||||
if (flushing_volume_modify){
|
||||
p->m_flushing_volume_btn->SetBorderColor(wxColour(255, 111, 0));
|
||||
p->m_flushing_volume_btn->SetTextColor(wxColour(255, 111, 0));
|
||||
}
|
||||
else {
|
||||
StateColor flush_fg_col(std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Normal));
|
||||
|
||||
StateColor flush_bd_col(std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(172, 172, 172), StateColor::Normal));
|
||||
p->m_flushing_volume_btn->SetBorderColor(flush_bd_col);
|
||||
p->m_flushing_volume_btn->SetTextColor(flush_fg_col);
|
||||
if(flushing_volume_modify){
|
||||
p->m_flushing_volume_btn->SetStyle(ButtonStyle::Regular, ButtonType::Compact);
|
||||
p->m_flushing_volume_btn->SetBorderColor(wxColour("#FF6F00"));
|
||||
}
|
||||
else
|
||||
p->m_flushing_volume_btn->SetStyle(ButtonStyle::Confirm, ButtonType::Compact);
|
||||
}
|
||||
|
||||
void Sidebar::enable_buttons(bool enable)
|
||||
@@ -5103,14 +5090,19 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (originfile != "<lock>") // see bbs_3mf.cpp for lock detail
|
||||
boost::filesystem::remove_all(last);
|
||||
}
|
||||
|
||||
catch (...) {}
|
||||
int skip_confirm = e.GetInt();
|
||||
this->q->new_project(skip_confirm, true);
|
||||
});
|
||||
|
||||
if (this->q->get_project_filename().IsEmpty() && this->q->is_empty_project()) {
|
||||
int skip_confirm = e.GetInt();
|
||||
this->q->new_project(skip_confirm, true);
|
||||
}
|
||||
});
|
||||
//wxPostEvent(this->q, wxCommandEvent{EVT_RESTORE_PROJECT});
|
||||
}
|
||||
|
||||
@@ -15071,6 +15063,9 @@ void Plater::export_toolpaths_to_obj() const
|
||||
p->preview->get_canvas3d()->export_toolpaths_to_obj(into_u8(path).c_str());
|
||||
}
|
||||
|
||||
bool Plater::is_empty_project() {
|
||||
return model().objects.empty();
|
||||
}
|
||||
bool Plater::is_multi_extruder_ams_empty()
|
||||
{
|
||||
std::vector<std::string> extruder_ams_count_str = p->config->option<ConfigOptionStrings>("extruder_ams_count", true)->values;
|
||||
|
||||
@@ -118,10 +118,11 @@ const wxString DEFAULT_PROJECT_NAME = "Untitled";
|
||||
class SidebarProps
|
||||
{
|
||||
public:
|
||||
static int TitlebarMargin();
|
||||
static int ContentMargin();
|
||||
static int IconSpacing();
|
||||
static int ElementSpacing();
|
||||
static int TitlebarMargin(){ return 8 ;} // Use as side margins on titlebar. Has less margin on sides to create separation with its content
|
||||
static int ContentMargin() { return 12;} // Use as side margins contents of title
|
||||
static int ContentMarginV(){ return 9 ;} // Use as vertical margins contents of title
|
||||
static int IconSpacing() { return 10;} // Use on main elements
|
||||
static int ElementSpacing(){ return 5 ;} // Use if elements has relation between them like edit button for combo box etc.
|
||||
};
|
||||
|
||||
class Sidebar : public wxPanel
|
||||
@@ -350,6 +351,7 @@ public:
|
||||
m_exported_file = exported_file;
|
||||
}
|
||||
|
||||
bool is_empty_project();
|
||||
bool is_multi_extruder_ams_empty();
|
||||
// BBS
|
||||
bool is_new_project_and_check_state() { return m_new_project_and_check_state; }
|
||||
|
||||
@@ -1095,7 +1095,7 @@ void PreferencesDialog::create()
|
||||
|
||||
m_pref_tabs->SelectItem(0);
|
||||
|
||||
m_sizer_body->Add(m_pref_tabs, 0, wxEXPAND | wxBOTTOM, FromDIP(5));
|
||||
m_sizer_body->Add(m_pref_tabs, 0, wxEXPAND | wxBOTTOM | wxTOP, FromDIP(5));
|
||||
m_sizer_body->Add(m_parent, 1, wxEXPAND);
|
||||
|
||||
SetSizer(m_sizer_body);
|
||||
|
||||
@@ -403,7 +403,7 @@ void Tab::create_preset_tab()
|
||||
m_top_sizer->SetMinSize(-1, 3 * m_em_unit);
|
||||
m_top_panel->SetSizer(m_top_sizer);
|
||||
if (m_presets_choice)
|
||||
m_main_sizer->Add(m_top_panel, 0, wxEXPAND | wxUP | wxDOWN, m_em_unit);
|
||||
m_main_sizer->Add(m_top_panel, 0, wxEXPAND | wxUP | wxDOWN, FromDIP(SidebarProps::ContentMarginV()));
|
||||
else
|
||||
m_top_panel->Hide();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user