Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
SoftFever committed Dec 22, 2022
1 parent f5b2820 commit 8c46a57
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 18 deletions.
4 changes: 2 additions & 2 deletions build_release.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ cd %WP%
mkdir build
cd build
cmake .. -G "Visual Studio 16 2019" -DBBL_RELEASE_TO_PUBLIC=1 -DCMAKE_PREFIX_PATH="%DEPS%/usr/local" -DCMAKE_INSTALL_PREFIX="./BambuStudio-SoftFever" -DCMAKE_BUILD_TYPE=Release -DWIN10SDK_PATH="C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0"
cmake --build . --config Release --target ALL_BUILD -- -m
cmake --build . --target install --config Release
@REM cmake --build . --config Release --target ALL_BUILD -- -m
@REM cmake --build . --target install --config Release
Binary file added resources/calib/sf_placeholder.stl
Binary file not shown.
8 changes: 3 additions & 5 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1636,20 +1636,18 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
if (print.is_calib_mode()) {
std::string gcode;
auto s = m_config.inner_wall_speed.value;
if (m_config.default_acceleration.value > 0) {
double acceleration = std::max(m_config.inner_wall_acceleration.value, m_config.outer_wall_acceleration.value);
gcode += m_writer.set_acceleration((unsigned int)floor(acceleration + 0.5));
}
gcode += m_writer.set_acceleration((unsigned int)floor(m_config.outer_wall_acceleration.value + 0.5));

if (m_config.default_jerk.value > 0) {
double jerk = m_config.default_jerk.value;
double jerk = m_config.outer_wall_jerk.value;
gcode += m_writer.set_jerk_xy((unsigned int)floor(jerk + 0.5));
}
m_config.outer_wall_speed = print.default_region_config().outer_wall_speed;
m_config.inner_wall_speed = print.default_region_config().inner_wall_speed;
calib_pressure_advance pa_test(this);
gcode = pa_test.generate_test();
file.write(gcode);
print.is_calib_mode() = false;
}
else {
//BBS: open spaghetti detector
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/calib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace Slic3r {
const double e = 0.04; // filament_mm/extrusion_mm
const double y_offset = 5;

const double fast = std::max(mp_gcodegen->config().get_abs_value("inner_wall_speed"), mp_gcodegen->config().get_abs_value("outer_wall_speed")) * 60.0;
const double fast = mp_gcodegen->config().get_abs_value("outer_wall_speed") * 60.0;
const double slow = std::max(1200.0, fast * 0.1);
std::stringstream gcode;
gcode << mp_gcodegen->writer().travel_to_z(0.2);
Expand Down
29 changes: 28 additions & 1 deletion src/slic3r/GUI/BBLTopbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ enum CUSTOM_ID
ID_TITLE,
ID_MODEL_STORE,
ID_PUBLISH,
ID_CALIB,
ID_TOOL_BAR = 3200,
ID_AMS_NOTEBOOK,
};
Expand Down Expand Up @@ -194,7 +195,7 @@ void BBLTopbar::Init(wxFrame* parent)
m_frame = parent;
m_skip_popup_file_menu = false;
m_skip_popup_dropdown_menu = false;

m_skip_popup_calib_menu = false;
wxInitAllImageHandlers();

this->AddSpacer(5);
Expand Down Expand Up @@ -241,6 +242,11 @@ void BBLTopbar::Init(wxFrame* parent)
wxBitmap redo_inactive_bitmap = create_scaled_bitmap("topbar_redo_inactive", nullptr, TOPBAR_ICON_SIZE);
m_redo_item->SetDisabledBitmap(redo_inactive_bitmap);

this->AddSpacer(FromDIP(10));

wxBitmap calib_bitmap = create_scaled_bitmap("ams_readonly", nullptr, TOPBAR_ICON_SIZE);
m_redo_item = this->AddTool(ID_CALIB, "", calib_bitmap);

this->AddSpacer(FromDIP(10));
this->AddStretchSpacer(1);

Expand Down Expand Up @@ -298,6 +304,7 @@ void BBLTopbar::Init(wxFrame* parent)
this->Bind(wxEVT_MENU_CLOSE, &BBLTopbar::OnMenuClose, this);
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnFileToolItem, this, ID_TOP_FILE_MENU);
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnDropdownToolItem, this, ID_TOP_DROPDOWN_MENU);
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnDropdownToolItem, this, ID_CALIB);
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnIconize, this, wxID_ICONIZE_FRAME);
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnFullScreen, this, wxID_MAXIMIZE_FRAME);
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnCloseFrame, this, wxID_CLOSE_FRAME);
Expand Down Expand Up @@ -468,6 +475,9 @@ void BBLTopbar::Rescale() {
item->SetBitmap(create_scaled_bitmap("topbar_redo", this, TOPBAR_ICON_SIZE));
item->SetDisabledBitmap(create_scaled_bitmap("topbar_redo_inactive", nullptr, TOPBAR_ICON_SIZE));

item = this->FindTool(ID_CALIB);
item->SetBitmap(create_scaled_bitmap("ams_readonly", this, TOPBAR_ICON_SIZE));

item = this->FindTool(ID_TITLE);

/*item = this->FindTool(ID_PUBLISH);
Expand Down Expand Up @@ -581,6 +591,23 @@ void BBLTopbar::OnDropdownToolItem(wxAuiToolBarEvent& evt)
tb->SetToolSticky(evt.GetId(), false);
}

void BBLTopbar::OnCalibToolItem(wxAuiToolBarEvent& evt)
{
wxAuiToolBar* tb = static_cast<wxAuiToolBar*>(evt.GetEventObject());

tb->SetToolSticky(evt.GetId(), true);

if (!m_skip_popup_calib_menu) {
PopupMenu(&m_calib_menu, wxPoint(FromDIP(1), this->GetSize().GetHeight() - 2));
}
else {
m_skip_popup_calib_menu = false;
}

// make sure the button is "un-stuck"
tb->SetToolSticky(evt.GetId(), false);
}

void BBLTopbar::OnMouseLeftDown(wxMouseEvent& event)
{
wxPoint mouse_pos = ::wxGetMousePosition();
Expand Down
3 changes: 3 additions & 0 deletions src/slic3r/GUI/BBLTopbar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class BBLTopbar : public wxAuiToolBar
void OnCloseFrame(wxAuiToolBarEvent& event);
void OnFileToolItem(wxAuiToolBarEvent& evt);
void OnDropdownToolItem(wxAuiToolBarEvent& evt);
void OnCalibToolItem(wxAuiToolBarEvent& evt);
void OnMouseLeftDClock(wxMouseEvent& mouse);
void OnMouseLeftDown(wxMouseEvent& event);
void OnMouseLeftUp(wxMouseEvent& event);
Expand Down Expand Up @@ -60,6 +61,7 @@ class BBLTopbar : public wxAuiToolBar
wxPoint m_delta;
wxMenu m_top_menu;
wxMenu* m_file_menu;
wxMenu* m_calib_menu;
wxAuiToolBarItem* m_title_item;
wxAuiToolBarItem* m_account_item;
wxAuiToolBarItem* m_model_store_item;
Expand All @@ -78,4 +80,5 @@ class BBLTopbar : public wxAuiToolBar
int m_toolbar_h;
bool m_skip_popup_file_menu;
bool m_skip_popup_dropdown_menu;
bool m_skip_popup_calib_menu;
};
1 change: 1 addition & 0 deletions src/slic3r/GUI/BackgroundSlicingProcess.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class BackgroundSlicingProcess
// Get the current print. It is either m_fff_print or m_sla_print.
const PrintBase* current_print() const { return m_print; }
const Print* fff_print() const { return m_fff_print; }
Print* fff_print() { return m_fff_print; }
const SLAPrint* sla_print() const { return m_sla_print; }
// Take the project path (if provided), extract the name of the project, run it through the macro processor and save it next to the project file.
// If the project_path is empty, just run output_filepath().
Expand Down
22 changes: 14 additions & 8 deletions src/slic3r/GUI/Plater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2442,7 +2442,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
q->Bind(EVT_GLVIEWTOOLBAR_PREVIEW, [q](SimpleEvent&) { q->select_view_3D("Preview", false); });
q->Bind(EVT_GLTOOLBAR_SLICE_PLATE, &priv::on_action_slice_plate, this);
q->Bind(EVT_GLTOOLBAR_SLICE_ALL, &priv::on_action_slice_all, this);
q->Bind(EVT_GLTOOLBAR_SLICE_ALL, &priv::on_action_calib_pa, this);
q->Bind(EVT_GLTOOLBAR_PA_CALIB, &priv::on_action_calib_pa, this);
q->Bind(EVT_GLTOOLBAR_PRINT_PLATE, &priv::on_action_print_plate, this);
q->Bind(EVT_GLTOOLBAR_SELECT_SLICED_PLATE, &priv::on_action_select_sliced_plate, this);
q->Bind(EVT_GLTOOLBAR_PRINT_ALL, &priv::on_action_print_all, this);
Expand Down Expand Up @@ -6001,11 +6001,14 @@ void Plater::priv::on_action_calib_pa(SimpleEvent&)
{
if (q != nullptr) {
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ":received calib pa event\n" ;
if(fff_print.model().objects.empty())
//add model
q->add_model(false,Slic3r::resources_dir()+"/calib/sf_placeholder.stl");

fff_print.is_calib_mode() = true;
const auto calib_pa_name = "PressureAdvanceTest-SF";
if (get_project_name() != calib_pa_name) {
q->new_project(false,false,calib_pa_name);
q->add_model(false, Slic3r::resources_dir() + "/calib/sf_placeholder.stl");
q->select_view_3D("3D");
}

background_process.fff_print()->is_calib_mode() = true;
//BBS update extruder params and speed table before slicing
Plater::setExtruderParams(Slic3r::Model::extruderParamsMap);
Plater::setPrintSpeedTable(Slic3r::Model::printSpeedMap);
Expand Down Expand Up @@ -7419,7 +7422,7 @@ Print& Plater::fff_print() { return p->fff_print; }
const SLAPrint& Plater::sla_print() const { return p->sla_print; }
SLAPrint& Plater::sla_print() { return p->sla_print; }

int Plater::new_project(bool skip_confirm, bool silent)
int Plater::new_project(bool skip_confirm, bool silent, const wxString& project_name)
{
bool transfer_preset_changes = false;
// BBS: save confirm
Expand Down Expand Up @@ -7459,7 +7462,10 @@ int Plater::new_project(bool skip_confirm, bool silent)
//reset project
p->project.reset();
//set project name
p->set_project_name(_L("Untitled"));
if (project_name.empty())
p->set_project_name(_L("Untitled"));
else
p->set_project_name(project_name);

Plater::TakeSnapshot snapshot(this, "New Project", UndoRedo::SnapshotType::ProjectSeparator);

Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/Plater.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class Plater: public wxPanel
const SLAPrint& sla_print() const;
SLAPrint& sla_print();

int new_project(bool skip_confirm = false, bool silent = false);
int new_project(bool skip_confirm = false, bool silent = false, const wxString& project_name = wxString());
// BBS: save & backup
void load_project(wxString const & filename = "", wxString const & originfile = "-");
int save_project(bool saveAs = false);
Expand Down

0 comments on commit 8c46a57

Please sign in to comment.