mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-24 23:14:25 +08:00
The new test is used instead of the old one (also moved ArrangeHelper to libslic3r !)
This commit is contained in:
parent
e43ff45dac
commit
8a0e093862
@ -8,13 +8,15 @@
|
||||
#include <string>
|
||||
|
||||
#include "boost/regex.hpp"
|
||||
#include "boost/property_tree/json_parser.hpp"
|
||||
#include "boost/algorithm/string/replace.hpp""
|
||||
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
||||
static Sequential::PrinterGeometry get_printer_geometry(const DynamicPrintConfig& config)
|
||||
static Sequential::PrinterGeometry get_printer_geometry(const ConfigBase& config)
|
||||
{
|
||||
enum ShapeType {
|
||||
BOX,
|
||||
@ -228,7 +230,7 @@ static std::vector<Sequential::ObjectToPrint> get_objects_to_print(const Model&
|
||||
|
||||
|
||||
|
||||
void arrange_model_sequential(Model& model, const DynamicPrintConfig& config)
|
||||
void arrange_model_sequential(Model& model, const ConfigBase& config)
|
||||
{
|
||||
SeqArrange seq_arrange(model, config);
|
||||
seq_arrange.process_seq_arrange([](int) {});
|
||||
@ -237,7 +239,7 @@ void arrange_model_sequential(Model& model, const DynamicPrintConfig& config)
|
||||
|
||||
|
||||
|
||||
SeqArrange::SeqArrange(const Model& model, const DynamicPrintConfig& config)
|
||||
SeqArrange::SeqArrange(const Model& model, const ConfigBase& config)
|
||||
{
|
||||
m_printer_geometry = get_printer_geometry(config);
|
||||
m_solver_configuration = get_solver_config(m_printer_geometry);
|
||||
@ -304,7 +306,7 @@ void SeqArrange::apply_seq_arrange(Model& model) const
|
||||
|
||||
|
||||
|
||||
bool check_seq_printability(const Model& model, const DynamicPrintConfig& config)
|
||||
bool check_seq_printability(const Model& model, const ConfigBase& config)
|
||||
{
|
||||
Sequential::PrinterGeometry printer_geometry = get_printer_geometry(config);
|
||||
Sequential::SolverConfiguration solver_config = get_solver_config(printer_geometry);
|
@ -1,5 +1,5 @@
|
||||
#ifndef slic3r_Arrange_Helper_hpp
|
||||
#define slic3r_Arrange_Helper_hpp
|
||||
#ifndef libslic3r_Arrange_Helper_hpp
|
||||
#define libslic3r_Arrange_Helper_hpp
|
||||
|
||||
#include "libseqarrange/seq_interface.hpp"
|
||||
|
||||
@ -8,10 +8,10 @@
|
||||
namespace Slic3r {
|
||||
|
||||
class Model;
|
||||
class DynamicPrintConfig;
|
||||
class ConfigBase;
|
||||
|
||||
void arrange_model_sequential(Model& model, const DynamicPrintConfig& config);
|
||||
bool check_seq_printability(const Model& model, const DynamicPrintConfig& config);
|
||||
void arrange_model_sequential(Model& model, const ConfigBase& config);
|
||||
bool check_seq_printability(const Model& model, const ConfigBase& config);
|
||||
|
||||
|
||||
// This is just a helper class to collect data for seq. arrangement, running the arrangement
|
||||
@ -19,7 +19,7 @@ namespace Slic3r {
|
||||
// into a separate thread without copying the Model or sharing it with UI thread.
|
||||
class SeqArrange {
|
||||
public:
|
||||
explicit SeqArrange(const Model& model, const DynamicPrintConfig& config);
|
||||
explicit SeqArrange(const Model& model, const ConfigBase& config);
|
||||
void process_seq_arrange(std::function<void(int)> progress_fn);
|
||||
void apply_seq_arrange(Model& model) const;
|
||||
|
@ -34,6 +34,8 @@ set(SLIC3R_SOURCES
|
||||
AABBTreeLines.hpp
|
||||
AABBMesh.hpp
|
||||
AABBMesh.cpp
|
||||
ArrangeHelper.cpp
|
||||
ArrangeHelper.hpp
|
||||
Algorithm/LineSegmentation/LineSegmentation.cpp
|
||||
Algorithm/LineSegmentation/LineSegmentation.hpp
|
||||
Algorithm/PathSorting.hpp
|
||||
@ -603,6 +605,7 @@ target_link_libraries(libslic3r PUBLIC
|
||||
agg
|
||||
ankerl
|
||||
boost_headeronly
|
||||
libseqarrange
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "Utils.hpp"
|
||||
#include "BuildVolume.hpp"
|
||||
#include "format.hpp"
|
||||
#include "ArrangeHelper.hpp"
|
||||
|
||||
#include <float.h>
|
||||
|
||||
@ -462,7 +463,7 @@ std::string Print::validate(std::vector<std::string>* warnings) const
|
||||
return _u8L("The supplied settings will cause an empty print.");
|
||||
|
||||
if (m_config.complete_objects) {
|
||||
if (false) // LUKAS: To be fixed in the next commit.
|
||||
if (! check_seq_printability(m_model, m_config))
|
||||
return _u8L("Some objects are too close; your extruder will collide with them.");
|
||||
}
|
||||
|
||||
|
@ -17,8 +17,6 @@ set(SLIC3R_GUI_SOURCES
|
||||
pchheader.hpp
|
||||
GUI/AboutDialog.cpp
|
||||
GUI/AboutDialog.hpp
|
||||
GUI/ArrangeHelper.cpp
|
||||
GUI/ArrangeHelper.hpp
|
||||
GUI/ArrangeSettingsDialogImgui.hpp
|
||||
GUI/ArrangeSettingsDialogImgui.cpp
|
||||
GUI/UserAccountCommunication.cpp
|
||||
@ -457,7 +455,6 @@ target_link_libraries(
|
||||
stb_dxt
|
||||
fastfloat
|
||||
boost_headeronly
|
||||
libseqarrange
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include "I18N.hpp"
|
||||
#include "NotificationManager.hpp"
|
||||
#include "format.hpp"
|
||||
#include "ArrangeHelper.hpp"
|
||||
#include "libslic3r/ArrangeHelper.hpp"
|
||||
|
||||
#include "slic3r/GUI/BitmapCache.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp"
|
||||
@ -2143,33 +2143,6 @@ void GLCanvas3D::render()
|
||||
if (show_imgui_demo_window) ImGui::ShowDemoWindow();
|
||||
#endif // SHOW_IMGUI_DEMO_WINDOW
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
// This is just temporary pipe to export data to the separate arrange algorithm
|
||||
// and importing the result back. TESTING ONLY !!!
|
||||
static auto time_start = std::chrono::high_resolution_clock::now();
|
||||
auto time_now = std::chrono::high_resolution_clock::now();
|
||||
int time_limit_s = 1;
|
||||
static bool last_res = 0;
|
||||
bool valid = std::chrono::duration_cast<std::chrono::seconds>(time_now - time_start).count() < time_limit_s;
|
||||
|
||||
ImGui::Begin("TESTING ONLY (arrange)");
|
||||
if (ImGui::Button("Test seq printability:")) {
|
||||
last_res = check_seq_printability(wxGetApp().plater()->model(), *m_config);
|
||||
time_start = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::TextColored((valid && last_res ? ImVec4(0.,1.,0.,1.) : (valid ? ImVec4(1.,0.,0.,1.) : ImVec4(0.5,.5,0.5,1.))) , "\u25a0");
|
||||
ImGui::Text("(So far, multiple beds are not accounted for.)");
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const bool is_looking_downward = camera.is_looking_downward();
|
||||
|
||||
// draw scene
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "SeqArrangeJob.hpp"
|
||||
|
||||
#include "slic3r/GUI/ArrangeHelper.hpp"
|
||||
#include "libslic3r/ArrangeHelper.hpp"
|
||||
|
||||
#include "slic3r/GUI/GLCanvas3D.hpp"
|
||||
#include "slic3r/GUI/GUI_App.hpp"
|
||||
#include "slic3r/GUI/GUI_ObjectList.hpp"
|
||||
|
@ -139,7 +139,7 @@
|
||||
#include "PresetArchiveDatabase.hpp"
|
||||
#include "BulkExportDialog.hpp"
|
||||
|
||||
#include "ArrangeHelper.hpp"
|
||||
#include "libslic3r/ArrangeHelper.hpp"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "Gizmos/GLGizmosManager.hpp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user