mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-14 19:12:38 -07:00
ENABLE_GCODE_VIEWER_AS_STATE -> Load gcode from file and process it
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
#include "libslic3r/Print.hpp"
|
||||
#include "libslic3r/Geometry.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#if ENABLE_GCODE_VIEWER_AS_STATE
|
||||
#include "MainFrame.hpp"
|
||||
#endif // ENABLE_GCODE_VIEWER_AS_STATE
|
||||
#include "Plater.hpp"
|
||||
#include "PresetBundle.hpp"
|
||||
#include "Camera.hpp"
|
||||
@@ -443,13 +446,19 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result)
|
||||
return;
|
||||
|
||||
// vertex data / bounding box -> extract from result
|
||||
std::vector<float> vertices_data(m_vertices.vertices_count * 3);
|
||||
for (size_t i = 0; i < m_vertices.vertices_count; ++i) {
|
||||
const GCodeProcessor::MoveVertex& move = gcode_result.moves[i];
|
||||
if (move.type == GCodeProcessor::EMoveType::Extrude)
|
||||
m_bounding_box.merge(move.position.cast<double>());
|
||||
::memcpy(static_cast<void*>(&vertices_data[i * 3]), static_cast<const void*>(move.position.data()), 3 * sizeof(float));
|
||||
}
|
||||
std::vector<float> vertices_data(m_vertices.vertices_count * 3);
|
||||
for (size_t i = 0; i < m_vertices.vertices_count; ++i) {
|
||||
const GCodeProcessor::MoveVertex& move = gcode_result.moves[i];
|
||||
#if ENABLE_GCODE_VIEWER_AS_STATE
|
||||
if (wxGetApp().mainframe->get_mode() != MainFrame::EMode::GCodeViewer) {
|
||||
#endif // ENABLE_GCODE_VIEWER_AS_STATE
|
||||
if (move.type == GCodeProcessor::EMoveType::Extrude && move.width != 0.0f && move.height != 0.0f)
|
||||
m_bounding_box.merge(move.position.cast<double>());
|
||||
#if ENABLE_GCODE_VIEWER_AS_STATE
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER_AS_STATE
|
||||
::memcpy(static_cast<void*>(&vertices_data[i * 3]), static_cast<const void*>(move.position.data()), 3 * sizeof(float));
|
||||
}
|
||||
|
||||
m_bounding_box.merge(m_bounding_box.max + m_sequential_view.marker.get_bounding_box().max[2] * Vec3d::UnitZ());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user