Code cleanup and techs removal - step 1

This commit is contained in:
enricoturri1966 2024-02-16 13:47:52 +01:00 committed by Lukas Matena
parent 5c4c18661e
commit 7bd60043d8
11 changed files with 186 additions and 375 deletions

View File

@ -145,41 +145,41 @@ void GCodeProcessor::CpColor::reset()
float GCodeProcessor::Trapezoid::acceleration_time(float entry_feedrate, float acceleration) const
{
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
return acceleration_time_from_distance(entry_feedrate, acceleration_distance(), acceleration);
#else
return acceleration_time_from_distance(entry_feedrate, accelerate_until, acceleration);
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
}
#if !ENABLE_ET_SPE1872
#if !ENABLE_NEW_GCODE_VIEWER
float GCodeProcessor::Trapezoid::cruise_time() const
{
return (cruise_feedrate != 0.0f) ? cruise_distance() / cruise_feedrate : 0.0f;
}
#endif // !ENABLE_ET_SPE1872
#endif // !ENABLE_NEW_GCODE_VIEWER
float GCodeProcessor::Trapezoid::deceleration_time(float distance, float acceleration) const
{
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
return acceleration_time_from_distance(cruise_feedrate, deceleration_distance(distance), -acceleration);
#else
return acceleration_time_from_distance(cruise_feedrate, distance - decelerate_after, -acceleration);
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
}
#if !ENABLE_ET_SPE1872
#if !ENABLE_NEW_GCODE_VIEWER
float GCodeProcessor::Trapezoid::cruise_distance() const
{
return decelerate_after - accelerate_until;
}
#endif // !ENABLE_ET_SPE1872
#endif // !ENABLE_NEW_GCODE_VIEWER
void GCodeProcessor::TimeBlock::calculate_trapezoid()
{
#if !ENABLE_ET_SPE1872
#if !ENABLE_NEW_GCODE_VIEWER
trapezoid.cruise_feedrate = feedrate_profile.cruise;
#endif // !ENABLE_ET_SPE1872
#endif // !ENABLE_NEW_GCODE_VIEWER
float accelerate_distance = std::max(0.0f, estimated_acceleration_distance(feedrate_profile.entry, feedrate_profile.cruise, acceleration));
const float decelerate_distance = std::max(0.0f, estimated_acceleration_distance(feedrate_profile.cruise, feedrate_profile.exit, -acceleration));
@ -193,23 +193,23 @@ void GCodeProcessor::TimeBlock::calculate_trapezoid()
cruise_distance = 0.0f;
trapezoid.cruise_feedrate = speed_from_distance(feedrate_profile.entry, accelerate_distance, acceleration);
}
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
else
trapezoid.cruise_feedrate = feedrate_profile.cruise;
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
trapezoid.accelerate_until = accelerate_distance;
trapezoid.decelerate_after = accelerate_distance + cruise_distance;
}
#if !ENABLE_ET_SPE1872
#if !ENABLE_NEW_GCODE_VIEWER
float GCodeProcessor::TimeBlock::time() const
{
return trapezoid.acceleration_time(feedrate_profile.entry, acceleration) +
trapezoid.cruise_time() +
trapezoid.deceleration_time(distance, acceleration);
}
#endif // !ENABLE_ET_SPE1872
#endif // !ENABLE_NEW_GCODE_VIEWER
void GCodeProcessor::TimeMachine::State::reset()
{
@ -255,17 +255,7 @@ void GCodeProcessor::TimeMachine::reset()
#endif // ENABLE_NEW_GCODE_VIEWER
}
#if ENABLE_NEW_GCODE_VIEWER
#if !ENABLE_ET_SPE1872
void GCodeProcessor::TimeMachine::simulate_st_synchronize(GCodeProcessorResult& result, PrintEstimatedStatistics::ETimeMode mode, float additional_time)
{
if (!enabled)
return;
calculate_time(result, mode, 0, additional_time);
}
#endif // !ENABLE_ET_SPE1872
#else
#if !ENABLE_NEW_GCODE_VIEWER
void GCodeProcessor::TimeMachine::simulate_st_synchronize(float additional_time)
{
if (!enabled)
@ -273,11 +263,11 @@ void GCodeProcessor::TimeMachine::simulate_st_synchronize(float additional_time)
calculate_time(0, additional_time);
}
#endif // ENABLE_NEW_GCODE_VIEWER
#endif // !ENABLE_NEW_GCODE_VIEWER
static void planner_forward_pass_kernel(const GCodeProcessor::TimeBlock& prev, GCodeProcessor::TimeBlock& curr)
{
#if ENABLE_ET_SPE1872_FIRMWARE_BUDDY
#if ENABLE_NEW_GCODE_VIEWER
//
// C:\prusa\firmware\Prusa-Firmware-Buddy\lib\Marlin\Marlin\src\module\planner.cpp
// Line 954
@ -312,12 +302,12 @@ static void planner_forward_pass_kernel(const GCodeProcessor::TimeBlock& prev, G
}
}
}
#endif // ENABLE_ET_SPE1872_FIRMWARE_BUDDY
#endif // ENABLE_NEW_GCODE_VIEWER
}
static void planner_reverse_pass_kernel(GCodeProcessor::TimeBlock& curr, const GCodeProcessor::TimeBlock& next)
{
#if ENABLE_ET_SPE1872_FIRMWARE_BUDDY
#if ENABLE_NEW_GCODE_VIEWER
//
// C:\prusa\firmware\Prusa-Firmware-Buddy\lib\Marlin\Marlin\src\module\planner.cpp
// Line 857
@ -359,7 +349,7 @@ static void planner_reverse_pass_kernel(GCodeProcessor::TimeBlock& curr, const G
curr.flags.recalculate = true;
}
#endif // ENABLE_ET_SPE1872_FIRMWARE_BUDDY
#endif // ENABLE_NEW_GCODE_VIEWER
}
static void recalculate_trapezoids(std::vector<GCodeProcessor::TimeBlock>& blocks)
@ -377,7 +367,7 @@ static void recalculate_trapezoids(std::vector<GCodeProcessor::TimeBlock>& block
// Recalculate if current block entry or exit junction speed has changed.
if (curr->flags.recalculate || next->flags.recalculate) {
// NOTE: Entry and exit factors always > 0 by all previous logic operations.
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
curr->feedrate_profile.exit = next->feedrate_profile.entry;
curr->calculate_trapezoid();
#else
@ -385,7 +375,7 @@ static void recalculate_trapezoids(std::vector<GCodeProcessor::TimeBlock>& block
block.feedrate_profile.exit = next->feedrate_profile.entry;
block.calculate_trapezoid();
curr->trapezoid = block.trapezoid;
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
curr->flags.recalculate = false; // Reset current only to ensure next trapezoid is computed
}
}
@ -393,7 +383,7 @@ static void recalculate_trapezoids(std::vector<GCodeProcessor::TimeBlock>& block
// Last/newest block in buffer. Always recalculated.
if (next != nullptr) {
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
next->feedrate_profile.exit = next->safe_feedrate;
next->calculate_trapezoid();
#else
@ -401,7 +391,7 @@ static void recalculate_trapezoids(std::vector<GCodeProcessor::TimeBlock>& block
block.feedrate_profile.exit = next->safe_feedrate;
block.calculate_trapezoid();
next->trapezoid = block.trapezoid;
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
next->flags.recalculate = false;
}
}
@ -443,7 +433,6 @@ void GCodeProcessor::TimeMachine::calculate_time(size_t keep_last_n_blocks, floa
if (block.layer_id == 1)
first_layer_time += block_time;
#if ENABLE_ET_SPE1872
// detect actual speed moves required to render toolpaths using actual speed
if (mode == PrintEstimatedStatistics::ETimeMode::Normal) {
GCodeProcessorResult::MoveVertex& curr_move = result.moves[block.move_id];
@ -531,7 +520,6 @@ void GCodeProcessor::TimeMachine::calculate_time(size_t keep_last_n_blocks, floa
std::nullopt
});
}
#endif // ENABLE_ET_SPE1872
#else
if (block.move_type == EMoveType::Travel)
travel_time += block_time;
@ -1557,21 +1545,17 @@ void GCodeProcessor::finalize(bool perform_post_process)
}
}
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
calculate_time(m_result);
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
// process the time blocks
for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count); ++i) {
TimeMachine& machine = m_time_processor.machines[i];
TimeMachine::CustomGCodeTime& gcode_time = machine.gcode_time;
#if ENABLE_NEW_GCODE_VIEWER
#if !ENABLE_ET_SPE1872
machine.calculate_time(m_result, static_cast<PrintEstimatedStatistics::ETimeMode>(i));
#endif // !ENABLE_ET_SPE1872
#else
#if !ENABLE_NEW_GCODE_VIEWER
machine.calculate_time();
#endif // ENABLE_NEW_GCODE_VIEWER
#endif // !ENABLE_NEW_GCODE_VIEWER
if (gcode_time.needed && gcode_time.cache != 0.0f)
gcode_time.times.push_back({ CustomGCode::ColorChange, gcode_time.cache });
}
@ -3119,20 +3103,16 @@ void GCodeProcessor::process_G1(const std::array<std::optional<double>, 4>& axes
blocks.push_back(block);
#if !ENABLE_ET_SPE1872
#if !ENABLE_NEW_GCODE_VIEWER
if (blocks.size() > TimeProcessor::Planner::refresh_threshold)
#if ENABLE_NEW_GCODE_VIEWER
machine.calculate_time(m_result, static_cast<PrintEstimatedStatistics::ETimeMode>(i), TimeProcessor::Planner::queue_size);
#else
machine.calculate_time(TimeProcessor::Planner::queue_size);
#endif // ENABLE_NEW_GCODE_VIEWER
#endif // !ENABLE_ET_SPE1872
#endif // !ENABLE_NEW_GCODE_VIEWER
}
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
if (m_time_processor.machines[0].blocks.size() > TimeProcessor::Planner::refresh_threshold)
calculate_time(m_result, TimeProcessor::Planner::queue_size);
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
if (m_seams_detector.is_active()) {
// check for seam starting vertex
@ -3268,11 +3248,11 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool cloc
arc.end = Vec3d(end_position[X], end_position[Y], end_position[Z]);
// radii
#if ENABLE_ET_SPE1872_FIRMWARE_G2G3
#if ENABLE_NEW_GCODE_VIEWER
if (std::abs(arc.end_radius() - arc.start_radius()) > 0.001) {
#else
if (std::abs(arc.end_radius() - arc.start_radius()) > EPSILON) {
#endif // ENABLE_ET_SPE1872_FIRMWARE_G2G3
#endif // ENABLE_NEW_GCODE_VIEWER
// what to do ???
}
@ -3341,7 +3321,7 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool cloc
process_G1(g1_axes, g1_feedrate, G1DiscretizationOrigin::G2G3, remaining_internal_g1_lines);
};
#if ENABLE_ET_SPE1872_FIRMWARE_BUDDY_G2G3
#if ENABLE_NEW_GCODE_VIEWER
if (m_flavor == gcfMarlinFirmware) {
// calculate arc segments
// reference:
@ -3411,7 +3391,7 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool cloc
internal_only_g1_line(adjust_target(end_position, prev_target), arc.delta_z() != 0.0, (segments == 1) ? feedrate : std::nullopt, extrusion);
}
else {
#endif // ENABLE_ET_SPE1872_FIRMWARE_BUDDY_G2G3
#endif // ENABLE_NEW_GCODE_VIEWER
// calculate arc segments
// reference:
// Prusa-Firmware\Firmware\motion_control.cpp - mc_arc()
@ -3431,14 +3411,14 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool cloc
const double z_per_segment = arc.delta_z() * inv_segment;
const double extruder_per_segment = (extrusion.has_value()) ? *extrusion * inv_segment : 0.0;
#if ENABLE_ET_SPE1872_FIRMWARE_G2G3
#if ENABLE_NEW_GCODE_VIEWER
const double sq_theta_per_segment = sqr(theta_per_segment);
const double cos_T = 1.0 - 0.5 * sq_theta_per_segment;
const double sin_T = theta_per_segment - sq_theta_per_segment * theta_per_segment / 6.0f;
#else
const double cos_T = 1.0 - 0.5 * sqr(theta_per_segment); // Small angle approximation
const double sin_T = theta_per_segment;
#endif // ENABLE_ET_SPE1872_FIRMWARE_G2G3
#endif // ENABLE_NEW_GCODE_VIEWER
AxisCoords prev_target = m_start_position;
AxisCoords arc_target;
@ -3451,14 +3431,14 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool cloc
static const size_t N_ARC_CORRECTION = 25;
Vec3d curr_rel_arc_start = arc.relative_start();
#if ENABLE_ET_SPE1872_FIRMWARE_G2G3
#if ENABLE_NEW_GCODE_VIEWER
size_t count = N_ARC_CORRECTION;
#else
size_t count = 0;
#endif // ENABLE_ET_SPE1872_FIRMWARE_G2G3
#endif // ENABLE_NEW_GCODE_VIEWER
for (size_t i = 1; i < segments; ++i) {
#if ENABLE_ET_SPE1872_FIRMWARE_G2G3
#if ENABLE_NEW_GCODE_VIEWER
if (count-- == 0) {
const double cos_Ti = ::cos(i * theta_per_segment);
const double sin_Ti = ::sin(i * theta_per_segment);
@ -3488,7 +3468,7 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool cloc
curr_rel_arc_start.y() = -double(rel_center.x()) * sin_Ti - double(rel_center.y()) * cos_Ti;
count = 0;
}
#endif // ENABLE_ET_SPE1872_FIRMWARE_G2G3
#endif // ENABLE_NEW_GCODE_VIEWER
// Update arc_target location
arc_target[X] = arc.center.x() + curr_rel_arc_start.x();
@ -3505,9 +3485,9 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool cloc
// Ensure last segment arrives at target location.
m_start_position = m_end_position; // this is required because we are skipping the call to process_gcode_line()
internal_only_g1_line(adjust_target(end_position, prev_target), arc.delta_z() != 0.0, (segments == 1) ? feedrate : std::nullopt, extrusion);
#if ENABLE_ET_SPE1872_FIRMWARE_BUDDY_G2G3
#if ENABLE_NEW_GCODE_VIEWER
}
#endif // ENABLE_ET_SPE1872_FIRMWARE_BUDDY_G2G3
#endif // ENABLE_NEW_GCODE_VIEWER
}
void GCodeProcessor::process_G10(const GCodeReader::GCodeLine& line)
@ -4278,13 +4258,13 @@ void GCodeProcessor::post_process()
++m_times_cache_id;
}
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
if (it == m_machine.g1_times_cache.end() || it->id > g1_lines_counter)
return ret;
#else
if (it->id > g1_lines_counter)
return ret;
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
// search for internal G1 lines
if (GCodeReader::GCodeLine::cmd_is(line, "G2") || GCodeReader::GCodeLine::cmd_is(line, "G3")) {
@ -4813,9 +4793,9 @@ void GCodeProcessor::store_move_vertex(EMoveType type, bool internal_only)
Vec3f(m_end_position[X], m_end_position[Y], m_end_position[Z] - m_z_offset) + m_extruder_offsets[m_extruder_id],
static_cast<float>(m_end_position[E] - m_start_position[E]),
m_feedrate,
#if ENABLE_ET_SPE1872
0.0f,
#endif // ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
0.0f, // actual feedrate
#endif // ENABLE_NEW_GCODE_VIEWER
m_width,
m_height,
m_mm3_per_mm,
@ -4970,11 +4950,11 @@ float GCodeProcessor::get_filament_unload_time(size_t extruder_id)
void GCodeProcessor::process_custom_gcode_time(CustomGCode::Type code)
{
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
//FIXME this simulates st_synchronize! is it correct?
// The estimated time may be longer than the real print time.
simulate_st_synchronize();
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count); ++i) {
TimeMachine& machine = m_time_processor.machines[i];
if (!machine.enabled)
@ -4982,15 +4962,11 @@ void GCodeProcessor::process_custom_gcode_time(CustomGCode::Type code)
TimeMachine::CustomGCodeTime& gcode_time = machine.gcode_time;
gcode_time.needed = true;
#if !ENABLE_NEW_GCODE_VIEWER
//FIXME this simulates st_synchronize! is it correct?
// The estimated time may be longer than the real print time.
#if ENABLE_NEW_GCODE_VIEWER
#if !ENABLE_ET_SPE1872
machine.simulate_st_synchronize(m_result, static_cast<PrintEstimatedStatistics::ETimeMode>(i));
#endif // !ENABLE_ET_SPE1872
#else
machine.simulate_st_synchronize();
#endif // ENABLE_NEW_GCODE_VIEWER
#endif // !ENABLE_NEW_GCODE_VIEWER
if (gcode_time.cache != 0.0f) {
gcode_time.times.push_back({ code, gcode_time.cache });
gcode_time.cache = 0.0f;
@ -5007,7 +4983,7 @@ void GCodeProcessor::process_filaments(CustomGCode::Type code)
m_used_filaments.process_extruder_cache(m_extruder_id);
}
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
void GCodeProcessor::calculate_time(GCodeProcessorResult& result, size_t keep_last_n_blocks, float additional_time)
{
// calculate times
@ -5067,9 +5043,7 @@ void GCodeProcessor::calculate_time(GCodeProcessorResult& result, size_t keep_la
}
}
}
#endif // ENABLE_ET_SPE1872
#if ENABLE_ET_SPE1872
void GCodeProcessor::simulate_st_synchronize(float additional_time)
{
calculate_time(m_result, 0, additional_time);
@ -5078,14 +5052,10 @@ void GCodeProcessor::simulate_st_synchronize(float additional_time)
void GCodeProcessor::simulate_st_synchronize(float additional_time)
{
for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count); ++i) {
#if ENABLE_NEW_GCODE_VIEWER
m_time_processor.machines[i].simulate_st_synchronize(m_result, static_cast<PrintEstimatedStatistics::ETimeMode>(i), additional_time);
#else
m_time_processor.machines[i].simulate_st_synchronize(additional_time);
}
}
#endif // ENABLE_NEW_GCODE_VIEWER
}
}
#endif // ENABLE_ET_SPE1872
void GCodeProcessor::update_estimated_statistics()
{

View File

@ -140,9 +140,9 @@ namespace Slic3r {
Vec3f position{ Vec3f::Zero() }; // mm
float delta_extruder{ 0.0f }; // mm
float feedrate{ 0.0f }; // mm/s
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
float actual_feedrate{ 0.0f }; // mm/s
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
float width{ 0.0f }; // mm
float height{ 0.0f }; // mm
float mm3_per_mm{ 0.0f };
@ -157,9 +157,9 @@ namespace Slic3r {
bool internal_only{ false };
float volumetric_rate() const { return feedrate * mm3_per_mm; }
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
float actual_volumetric_rate() const { return actual_feedrate * mm3_per_mm; }
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
};
std::string filename;
@ -286,20 +286,18 @@ namespace Slic3r {
float cruise_feedrate{ 0.0f }; // mm/sec
float acceleration_time(float entry_feedrate, float acceleration) const;
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
float cruise_time() const { return (cruise_feedrate != 0.0f) ? cruise_distance() / cruise_feedrate : 0.0f; }
#else
float cruise_time() const;
#endif // ENABLE_ET_SPE1872
float deceleration_time(float distance, float acceleration) const;
#if ENABLE_ET_SPE1872
float acceleration_distance() const { return accelerate_until; }
float cruise_distance() const { return decelerate_after - accelerate_until; }
float deceleration_distance(float distance) const { return distance - decelerate_after; }
bool is_cruise_only(float distance) const { return std::abs(cruise_distance() - distance) < EPSILON; }
#else
float cruise_time() const;
float deceleration_time(float distance, float acceleration) const;
float cruise_distance() const;
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
};
struct TimeBlock
@ -329,14 +327,14 @@ namespace Slic3r {
// Calculates this block's trapezoid
void calculate_trapezoid();
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
float time() const {
return trapezoid.acceleration_time(feedrate_profile.entry, acceleration) +
trapezoid.cruise_time() + trapezoid.deceleration_time(distance, acceleration);
}
#else
float time() const;
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
};
private:
@ -368,7 +366,7 @@ namespace Slic3r {
float elapsed_time;
};
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
struct ActualSpeedMove
{
unsigned int move_id{ 0 };
@ -382,7 +380,7 @@ namespace Slic3r {
std::optional<float> fan_speed;
std::optional<float> temperature;
};
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
bool enabled;
float acceleration; // mm/s^2
@ -414,22 +412,17 @@ namespace Slic3r {
std::vector<G1LinesCacheItem> g1_times_cache;
#if ENABLE_NEW_GCODE_VIEWER
float first_layer_time;
std::vector<ActualSpeedMove> actual_speed_moves;
#else
std::array<float, static_cast<size_t>(EMoveType::Count)> moves_time;
std::array<float, static_cast<size_t>(GCodeExtrusionRole::Count)> roles_time;
std::vector<float> layers_time;
#endif // ENABLE_NEW_GCODE_VIEWER
#if ENABLE_ET_SPE1872
std::vector<ActualSpeedMove> actual_speed_moves;
#endif // ENABLE_ET_SPE1872
void reset();
// Simulates firmware st_synchronize() call
#if ENABLE_NEW_GCODE_VIEWER
#if !ENABLE_ET_SPE1872
void simulate_st_synchronize(GCodeProcessorResult& result, PrintEstimatedStatistics::ETimeMode mode, float additional_time = 0.0f);
#endif // !ENABLE_ET_SPE1872
void calculate_time(GCodeProcessorResult& result, PrintEstimatedStatistics::ETimeMode mode, size_t keep_last_n_blocks = 0, float additional_time = 0.0f);
#else
void simulate_st_synchronize(float additional_time = 0.0f);
@ -930,9 +923,9 @@ namespace Slic3r {
void process_custom_gcode_time(CustomGCode::Type code);
void process_filaments(CustomGCode::Type code);
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
void calculate_time(GCodeProcessorResult& result, size_t keep_last_n_blocks = 0, float additional_time = 0.0f);
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
// Simulates firmware st_synchronize() call
void simulate_st_synchronize(float additional_time = 0.0f);

View File

@ -61,13 +61,10 @@
#define ENABLE_BINARIZED_GCODE_DEBUG_WINDOW 0
#define ENABLE_NEW_GCODE_VIEWER 1
#define ENABLE_NEW_GCODE_VIEWER_DEBUG (1 && ENABLE_NEW_GCODE_VIEWER)
// requires VGCODE_ENABLE_ET_SPE1872 set to 1 in libvgcode (Types.hpp)
#define ENABLE_ET_SPE1872 (1 && ENABLE_NEW_GCODE_VIEWER)
#define ENABLE_ET_SPE1872_FIRMWARE_BUDDY (1 && ENABLE_ET_SPE1872)
#define ENABLE_ET_SPE1872_FIRMWARE_BUDDY_G2G3 (1 && ENABLE_ET_SPE1872_FIRMWARE_BUDDY)
#define ENABLE_ET_SPE1872_FIRMWARE_G2G3 (1 && ENABLE_ET_SPE1872)
#define ENABLE_ET_SPE1872_DEBUG (1 && ENABLE_ET_SPE1872)
// Enable imgui debug dialog for new gcode viewer (using libvgcode)
#define ENABLE_NEW_GCODE_VIEWER_DEBUG (0 && ENABLE_NEW_GCODE_VIEWER)
// Enable extension of tool position imgui dialog to show actual speed profile
#define ENABLE_ACTUAL_SPEED_DEBUG 1
// Enable G-Code viewer statistics imgui dialog
#define ENABLE_GCODE_VIEWER_STATISTICS (0 && !ENABLE_NEW_GCODE_VIEWER)

View File

@ -32,7 +32,6 @@ struct PathVertex
// Segment speed
//
float feedrate{ 0.0f };
#if VGCODE_ENABLE_ET_SPE1872
//
// Segment actual speed
//
@ -41,7 +40,6 @@ struct PathVertex
// Segment mm3_per_mm
//
float mm3_per_mm{ 0.0f };
#endif // VGCODE_ENABLE_ET_SPE1872
//
// Segment fan speed
//
@ -50,12 +48,6 @@ struct PathVertex
// Segment temperature
//
float temperature{ 0.0f };
#if !VGCODE_ENABLE_ET_SPE1872
//
// Segment volumetric rate
//
float volumetric_rate{ 0.0f };
#endif // !VGCODE_ENABLE_ET_SPE1872
#if VGCODE_ENABLE_COG_AND_TOOL_MARKERS
//
// Segment weight
@ -112,7 +104,6 @@ struct PathVertex
// Return true if the segment was generated by custom gcode
//
bool is_custom_gcode() const;
#if VGCODE_ENABLE_ET_SPE1872
//
// Return the volumetric flow rate of the segment
//
@ -121,7 +112,6 @@ struct PathVertex
// Return the acutal volumetric flow rate of the segment
//
float actual_volumetric_rate() const { return actual_feedrate * mm3_per_mm; }
#endif // VGCODE_ENABLE_ET_SPE1872
static const PathVertex DUMMY_PATH_VERTEX;
};

View File

@ -6,8 +6,6 @@
#define VGCODE_TYPES_HPP
#define VGCODE_ENABLE_COG_AND_TOOL_MARKERS 0
#define VGCODE_ENABLE_ET_SPE1872 1
#define VGCODE_ENABLE_ET_SPE1872_DEBUG (1 && VGCODE_ENABLE_ET_SPE1872)
#include <array>
#include <vector>
@ -85,15 +83,11 @@ enum class EViewType : uint8_t
Height,
Width,
Speed,
#if VGCODE_ENABLE_ET_SPE1872
ActualSpeed,
#endif // VGCODE_ENABLE_ET_SPE1872
FanSpeed,
Temperature,
VolumetricFlowRate,
#if VGCODE_ENABLE_ET_SPE1872
ActualVolumetricFlowRate,
#endif // VGCODE_ENABLE_ET_SPE1872
LayerTimeLinear,
LayerTimeLogarithmic,
Tool,

View File

@ -166,15 +166,11 @@ public:
// EViewType::Height
// EViewType::Width
// EViewType::Speed
#if VGCODE_ENABLE_ET_SPE1872
// EViewType::ActualSpeed
#endif // VGCODE_ENABLE_ET_SPE1872
// EViewType::FanSpeed
// EViewType::Temperature
// EViewType::VolumetricFlowRate
#if VGCODE_ENABLE_ET_SPE1872
// EViewType::ActualVolumetricFlowRate
#endif // VGCODE_ENABLE_ET_SPE1872
// EViewType::LayerTimeLinear
// EViewType::LayerTimeLogarithmic
//
@ -186,15 +182,11 @@ public:
// EViewType::Height
// EViewType::Width
// EViewType::Speed
#if VGCODE_ENABLE_ET_SPE1872
// EViewType::ActualSpeed
#endif // VGCODE_ENABLE_ET_SPE1872
// EViewType::FanSpeed
// EViewType::Temperature
// EViewType::VolumetricFlowRate
#if VGCODE_ENABLE_ET_SPE1872
// EViewType::ActualVolumetricFlowRate
#endif // VGCODE_ENABLE_ET_SPE1872
// EViewType::LayerTimeLinear
// EViewType::LayerTimeLogarithmic
//

View File

@ -948,13 +948,8 @@ Color ViewerImpl::get_vertex_color(const PathVertex& v) const
if (v.type == EMoveType::Noop)
return DUMMY_COLOR;
#if VGCODE_ENABLE_ET_SPE1872
if ((v.is_wipe() && m_settings.view_type != EViewType::ActualSpeed) || v.is_option())
return get_option_color(move_type_to_option(v.type));
#else
if (v.is_wipe() || v.is_option())
return get_option_color(move_type_to_option(v.type));
#endif // VGCODE_ENABLE_ET_SPE1872
switch (m_settings.view_type)
{
@ -974,12 +969,10 @@ Color ViewerImpl::get_vertex_color(const PathVertex& v) const
{
return m_speed_range.get_color_at(v.feedrate);
}
#if VGCODE_ENABLE_ET_SPE1872
case EViewType::ActualSpeed:
{
return m_actual_speed_range.get_color_at(v.actual_feedrate);
}
#endif // VGCODE_ENABLE_ET_SPE1872
case EViewType::FanSpeed:
{
return v.is_travel() ? get_option_color(move_type_to_option(v.type)) : m_fan_speed_range.get_color_at(v.fan_speed);
@ -990,18 +983,12 @@ Color ViewerImpl::get_vertex_color(const PathVertex& v) const
}
case EViewType::VolumetricFlowRate:
{
#if VGCODE_ENABLE_ET_SPE1872
return v.is_travel() ? get_option_color(move_type_to_option(v.type)) : m_volumetric_rate_range.get_color_at(v.volumetric_rate());
#else
return v.is_travel() ? get_option_color(move_type_to_option(v.type)) : m_volumetric_rate_range.get_color_at(v.volumetric_rate);
#endif // VGCODE_ENABLE_ET_SPE1872
}
#if VGCODE_ENABLE_ET_SPE1872
case EViewType::ActualVolumetricFlowRate:
{
return v.is_travel() ? get_option_color(move_type_to_option(v.type)) : m_actual_volumetric_rate_range.get_color_at(v.actual_volumetric_rate());
}
#endif // VGCODE_ENABLE_ET_SPE1872
case EViewType::LayerTimeLinear:
{
return v.is_travel() ? get_option_color(move_type_to_option(v.type)) :
@ -1087,15 +1074,11 @@ const ColorRange& ViewerImpl::get_color_range(EViewType type) const
case EViewType::Height: { return m_height_range; }
case EViewType::Width: { return m_width_range; }
case EViewType::Speed: { return m_speed_range; }
#if VGCODE_ENABLE_ET_SPE1872
case EViewType::ActualSpeed: { return m_actual_speed_range; }
#endif // VGCODE_ENABLE_ET_SPE1872
case EViewType::FanSpeed: { return m_fan_speed_range; }
case EViewType::Temperature: { return m_temperature_range; }
case EViewType::VolumetricFlowRate: { return m_volumetric_rate_range; }
#if VGCODE_ENABLE_ET_SPE1872
case EViewType::ActualVolumetricFlowRate: { return m_actual_volumetric_rate_range; }
#endif // VGCODE_ENABLE_ET_SPE1872
case EViewType::LayerTimeLinear: { return m_layer_time_range[0]; }
case EViewType::LayerTimeLogarithmic: { return m_layer_time_range[1]; }
default: { return ColorRange::DUMMY_COLOR_RANGE; }
@ -1109,15 +1092,11 @@ void ViewerImpl::set_color_range_palette(EViewType type, const Palette& palette)
case EViewType::Height: { m_height_range.set_palette(palette); }
case EViewType::Width: { m_width_range.set_palette(palette); }
case EViewType::Speed: { m_speed_range.set_palette(palette); }
#if VGCODE_ENABLE_ET_SPE1872
case EViewType::ActualSpeed: { m_actual_speed_range.set_palette(palette); }
#endif // VGCODE_ENABLE_ET_SPE1872
case EViewType::FanSpeed: { m_fan_speed_range.set_palette(palette); }
case EViewType::Temperature: { m_temperature_range.set_palette(palette); }
case EViewType::VolumetricFlowRate: { m_volumetric_rate_range.set_palette(palette); }
#if VGCODE_ENABLE_ET_SPE1872
case EViewType::ActualVolumetricFlowRate: { m_actual_volumetric_rate_range.set_palette(palette); }
#endif // VGCODE_ENABLE_ET_SPE1872
case EViewType::LayerTimeLinear: { m_layer_time_range[0].set_palette(palette); }
case EViewType::LayerTimeLogarithmic: { m_layer_time_range[1].set_palette(palette); }
default: { break; }
@ -1150,15 +1129,11 @@ size_t ViewerImpl::get_used_cpu_memory() const
ret += m_height_range.size_in_bytes_cpu();
ret += m_width_range.size_in_bytes_cpu();
ret += m_speed_range.size_in_bytes_cpu();
#if VGCODE_ENABLE_ET_SPE1872
ret += m_actual_speed_range.size_in_bytes_cpu();
#endif // VGCODE_ENABLE_ET_SPE1872
ret += m_fan_speed_range.size_in_bytes_cpu();
ret += m_temperature_range.size_in_bytes_cpu();
ret += m_volumetric_rate_range.size_in_bytes_cpu();
#if VGCODE_ENABLE_ET_SPE1872
ret += m_actual_volumetric_rate_range.size_in_bytes_cpu();
#endif // VGCODE_ENABLE_ET_SPE1872
for (size_t i = 0; i < COLOR_RANGE_TYPES_COUNT; ++i) {
ret += m_layer_time_range[i].size_in_bytes_cpu();
}
@ -1293,15 +1268,11 @@ void ViewerImpl::update_color_ranges()
m_width_range.reset();
m_height_range.reset();
m_speed_range.reset();
#if VGCODE_ENABLE_ET_SPE1872
m_actual_speed_range.reset();
#endif // VGCODE_ENABLE_ET_SPE1872
m_fan_speed_range.reset();
m_temperature_range.reset();
m_volumetric_rate_range.reset();
#if VGCODE_ENABLE_ET_SPE1872
m_actual_volumetric_rate_range.reset();
#endif // VGCODE_ENABLE_ET_SPE1872
m_layer_time_range[0].reset(); // ColorRange::EType::Linear
m_layer_time_range[1].reset(); // ColorRange::EType::Logarithmic
@ -1311,16 +1282,11 @@ void ViewerImpl::update_color_ranges()
m_height_range.update(round_to_bin(v.height));
if (!v.is_custom_gcode() || m_settings.extrusion_roles_visibility.at(EGCodeExtrusionRole::Custom)) {
m_width_range.update(round_to_bin(v.width));
#if VGCODE_ENABLE_ET_SPE1872
m_volumetric_rate_range.update(round_to_bin(v.volumetric_rate()));
#else
m_volumetric_rate_range.update(round_to_bin(v.volumetric_rate));
#endif // VGCODE_ENABLE_ET_SPE1872
}
m_fan_speed_range.update(v.fan_speed);
m_temperature_range.update(v.temperature);
}
#if VGCODE_ENABLE_ET_SPE1872
if ((v.is_travel() && m_settings.options_visibility.at(EOptionType::Travels)) ||
(v.is_wipe() && m_settings.options_visibility.at(EOptionType::Wipes)) ||
v.is_extrusion()) {
@ -1328,10 +1294,6 @@ void ViewerImpl::update_color_ranges()
m_actual_speed_range.update(v.actual_feedrate);
m_actual_volumetric_rate_range.update(round_to_bin(v.actual_volumetric_rate()));
}
#else
if ((v.is_travel() && m_settings.options_visibility.at(EOptionType::Travels)) || v.is_extrusion())
m_speed_range.update(v.feedrate);
#endif // VGCODE_ENABLE_ET_SPE1872
}
const std::vector<float> times = m_layers.get_times(m_settings.time_mode);

View File

@ -284,15 +284,11 @@ private:
ColorRange m_height_range;
ColorRange m_width_range;
ColorRange m_speed_range;
#if VGCODE_ENABLE_ET_SPE1872
ColorRange m_actual_speed_range;
#endif // VGCODE_ENABLE_ET_SPE1872
ColorRange m_fan_speed_range;
ColorRange m_temperature_range;
ColorRange m_volumetric_rate_range;
#if VGCODE_ENABLE_ET_SPE1872
ColorRange m_actual_volumetric_rate_range;
#endif // VGCODE_ENABLE_ET_SPE1872
std::array<ColorRange, COLOR_RANGE_TYPES_COUNT> m_layer_time_range{
ColorRange(EColorRangeType::Linear), ColorRange(EColorRangeType::Logarithmic)
};

View File

@ -33,9 +33,9 @@
#include "MsgDialog.hpp"
#endif // ENABLE_NEW_GCODE_VIEWER
#if ENABLE_ET_SPE1872_DEBUG
#if ENABLE_ACTUAL_SPEED_DEBUG
#define IMGUI_DEFINE_MATH_OPERATORS
#endif // ENABLE_ET_SPE1872_DEBUG
#endif // ENABLE_ACTUAL_SPEED_DEBUG
#include <imgui/imgui_internal.h>
#include <GL/glew.h>
@ -333,7 +333,7 @@ void GCodeViewer::SequentialRangeCap::reset() {
}
#endif // !ENABLE_NEW_GCODE_VIEWER
#if ENABLE_ET_SPE1872_DEBUG
#if ENABLE_ACTUAL_SPEED_DEBUG
int GCodeViewer::SequentialView::ActualSpeedImguiWidget::plot(const char* label, const std::array<float, 2>& frame_size)
{
ImGuiWindow* window = ImGui::GetCurrentWindow();
@ -418,7 +418,7 @@ int GCodeViewer::SequentialView::ActualSpeedImguiWidget::plot(const char* label,
return idx_hovered;
}
#endif // ENABLE_ET_SPE1872_DEBUG
#endif // ENABLE_ACTUAL_SPEED_DEBUG
void GCodeViewer::SequentialView::Marker::init()
{
@ -610,7 +610,7 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
const std::string text = std::string(buff);
imgui.text(text);
});
#if !ENABLE_ET_SPE1872_DEBUG
#if !ENABLE_ACTUAL_SPEED_DEBUG
append_table_row(_u8L("Speed") + " (" + _u8L("mm/s") + ")", [&imgui, &vertex, &buff]() {
std::string text;
if (vertex.is_extrusion()) {
@ -621,9 +621,6 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
text = _u8L("N/A");
imgui.text(text);
});
#endif // !ENABLE_ET_SPE1872_DEBUG
#if ENABLE_ET_SPE1872
#if !ENABLE_ET_SPE1872_DEBUG
append_table_row(_u8L("Actual speed") + " (" + _u8L("mm/s") + ")", [&imgui, &vertex, &buff]() {
std::string text;
if (vertex.is_extrusion()) {
@ -634,8 +631,7 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
text = _u8L("N/A");
imgui.text(text);
});
#endif // !ENABLE_ET_SPE1872_DEBUG
#endif // ENABLE_ET_SPE1872
#endif // !ENABLE_ACTUAL_SPEED_DEBUG
append_table_row(_u8L("Fan speed") + " (" + _u8L("%") + ")", [&imgui, &vertex, &buff]() {
std::string text;
if (vertex.is_extrusion()) {
@ -660,7 +656,7 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
ImGui::EndTable();
}
#if ENABLE_ET_SPE1872_DEBUG
#if ENABLE_ACTUAL_SPEED_DEBUG
if (vertex.is_extrusion() || vertex.is_travel() || vertex.is_wipe()) {
ImGui::Spacing();
imgui.text(_u8L("Actual speed profile"));
@ -710,7 +706,7 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
imgui.end();
}
}
#endif // ENABLE_ET_SPE1872_DEBUG
#endif // ENABLE_ACTUAL_SPEED_DEBUG
}
// force extra frame to automatically update window size
@ -1305,102 +1301,99 @@ void GCodeViewer::load_as_gcode(const GCodeProcessorResult& gcode_result, const
// convert data from PrusaSlicer format to libvgcode format
libvgcode::GCodeInputData data = libvgcode::convert(gcode_result, str_tool_colors, str_color_print_colors, m_viewer);
//#define ENABLE_DATA_EXPORT 1
//#if ENABLE_DATA_EXPORT
// auto extrusion_role_to_string = [](libvgcode::EGCodeExtrusionRole role) {
// switch (role) {
// case libvgcode::EGCodeExtrusionRole::None: { return "EGCodeExtrusionRole::None"; }
// case libvgcode::EGCodeExtrusionRole::Perimeter: { return "EGCodeExtrusionRole::Perimeter"; }
// case libvgcode::EGCodeExtrusionRole::ExternalPerimeter: { return "EGCodeExtrusionRole::ExternalPerimeter"; }
// case libvgcode::EGCodeExtrusionRole::OverhangPerimeter: { return "EGCodeExtrusionRole::OverhangPerimeter"; }
// case libvgcode::EGCodeExtrusionRole::InternalInfill: { return "EGCodeExtrusionRole::InternalInfill"; }
// case libvgcode::EGCodeExtrusionRole::SolidInfill: { return "EGCodeExtrusionRole::SolidInfill"; }
// case libvgcode::EGCodeExtrusionRole::TopSolidInfill: { return "EGCodeExtrusionRole::TopSolidInfill"; }
// case libvgcode::EGCodeExtrusionRole::Ironing: { return "EGCodeExtrusionRole::Ironing"; }
// case libvgcode::EGCodeExtrusionRole::BridgeInfill: { return "EGCodeExtrusionRole::BridgeInfill"; }
// case libvgcode::EGCodeExtrusionRole::GapFill: { return "EGCodeExtrusionRole::GapFill"; }
// case libvgcode::EGCodeExtrusionRole::Skirt: { return "EGCodeExtrusionRole::Skirt"; }
// case libvgcode::EGCodeExtrusionRole::SupportMaterial: { return "EGCodeExtrusionRole::SupportMaterial"; }
// case libvgcode::EGCodeExtrusionRole::SupportMaterialInterface: { return "EGCodeExtrusionRole::SupportMaterialInterface"; }
// case libvgcode::EGCodeExtrusionRole::WipeTower: { return "EGCodeExtrusionRole::WipeTower"; }
// case libvgcode::EGCodeExtrusionRole::Custom: { return "EGCodeExtrusionRole::Custom"; }
// case libvgcode::EGCodeExtrusionRole::COUNT: { return "EGCodeExtrusionRole::COUNT"; }
// }
// };
//
// auto move_type_to_string = [](libvgcode::EMoveType type) {
// switch (type) {
// case libvgcode::EMoveType::Noop: { return "EMoveType::Noop"; }
// case libvgcode::EMoveType::Retract: { return "EMoveType::Retract"; }
// case libvgcode::EMoveType::Unretract: { return "EMoveType::Unretract"; }
// case libvgcode::EMoveType::Seam: { return "EMoveType::Seam"; }
// case libvgcode::EMoveType::ToolChange: { return "EMoveType::ToolChange"; }
// case libvgcode::EMoveType::ColorChange: { return "EMoveType::ColorChange"; }
// case libvgcode::EMoveType::PausePrint: { return "EMoveType::PausePrint"; }
// case libvgcode::EMoveType::CustomGCode: { return "EMoveType::CustomGCode"; }
// case libvgcode::EMoveType::Travel: { return "EMoveType::Travel"; }
// case libvgcode::EMoveType::Wipe: { return "EMoveType::Wipe"; }
// case libvgcode::EMoveType::Extrude: { return "EMoveType::Extrude"; }
// case libvgcode::EMoveType::COUNT: { return "EMoveType::COUNT"; }
// }
// };
//
// FilePtr out{ boost::nowide::fopen("C:/prusa/slicer/test_output/spe1872/test.data", "wb") };
// if (out.f != nullptr) {
// const size_t vertices_count = data.vertices.size();
// fwrite((void*)&vertices_count, 1, sizeof(size_t), out.f);
// for (const libvgcode::PathVertex& v : data.vertices) {
// fwrite((void*)&v.position[0], 1, sizeof(float), out.f);
// fwrite((void*)&v.position[1], 1, sizeof(float), out.f);
// fwrite((void*)&v.position[2], 1, sizeof(float), out.f);
// fwrite((void*)&v.height, 1, sizeof(float), out.f);
// fwrite((void*)&v.width, 1, sizeof(float), out.f);
// fwrite((void*)&v.feedrate, 1, sizeof(float), out.f);
//#if ENABLE_ET_SPE1872
// fwrite((void*)&v.actual_feedrate, 1, sizeof(float), out.f);
// fwrite((void*)&v.mm3_per_mm, 1, sizeof(float), out.f);
//#endif // ENABLE_ET_SPE1872
// fwrite((void*)&v.fan_speed, 1, sizeof(float), out.f);
// fwrite((void*)&v.temperature, 1, sizeof(float), out.f);
//#if !ENABLE_ET_SPE1872
// fwrite((void*)&v.volumetric_rate, 1, sizeof(float), out.f);
//#endif // !ENABLE_ET_SPE1872
// fwrite((void*)&v.role, 1, sizeof(uint8_t), out.f);
// fwrite((void*)&v.type, 1, sizeof(uint8_t), out.f);
// fwrite((void*)&v.gcode_id, 1, sizeof(uint32_t), out.f);
// fwrite((void*)&v.layer_id, 1, sizeof(uint32_t), out.f);
// fwrite((void*)&v.extruder_id, 1, sizeof(uint32_t), out.f);
// fwrite((void*)&v.color_id, 1, sizeof(uint32_t), out.f);
// fwrite((void*)&v.times[0], 1, sizeof(float), out.f);
// fwrite((void*)&v.times[1], 1, sizeof(float), out.f);
//#if VGCODE_ENABLE_COG_AND_TOOL_MARKERS
// const float weight = v.weight;
//#else
// const float weight = 0.0f;
//#endif // VGCODE_ENABLE_COG_AND_TOOL_MARKERS
// fwrite((void*)&weight, 1, sizeof(float), out.f);
// }
//
// const uint8_t spiral_vase_mode = data.spiral_vase_mode ? 1 : 0;
// fwrite((void*)&spiral_vase_mode, 1, sizeof(uint8_t), out.f);
//
// const size_t tool_colors_count = data.tools_colors.size();
// fwrite((void*)&tool_colors_count, 1, sizeof(size_t), out.f);
// for (const libvgcode::Color& c : data.tools_colors) {
// fwrite((void*)&c[0], 1, sizeof(uint8_t), out.f);
// fwrite((void*)&c[1], 1, sizeof(uint8_t), out.f);
// fwrite((void*)&c[2], 1, sizeof(uint8_t), out.f);
// }
//
// const size_t color_print_colors_count = data.color_print_colors.size();
// fwrite((void*)&color_print_colors_count, 1, sizeof(size_t), out.f);
// for (const libvgcode::Color& c : data.color_print_colors) {
// fwrite((void*)&c[0], 1, sizeof(uint8_t), out.f);
// fwrite((void*)&c[1], 1, sizeof(uint8_t), out.f);
// fwrite((void*)&c[2], 1, sizeof(uint8_t), out.f);
// }
// }
//#endif // ENABLE_DATA_EXPORT
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#define ENABLE_DATA_EXPORT 1
#if ENABLE_DATA_EXPORT
auto extrusion_role_to_string = [](libvgcode::EGCodeExtrusionRole role) {
switch (role) {
case libvgcode::EGCodeExtrusionRole::None: { return "EGCodeExtrusionRole::None"; }
case libvgcode::EGCodeExtrusionRole::Perimeter: { return "EGCodeExtrusionRole::Perimeter"; }
case libvgcode::EGCodeExtrusionRole::ExternalPerimeter: { return "EGCodeExtrusionRole::ExternalPerimeter"; }
case libvgcode::EGCodeExtrusionRole::OverhangPerimeter: { return "EGCodeExtrusionRole::OverhangPerimeter"; }
case libvgcode::EGCodeExtrusionRole::InternalInfill: { return "EGCodeExtrusionRole::InternalInfill"; }
case libvgcode::EGCodeExtrusionRole::SolidInfill: { return "EGCodeExtrusionRole::SolidInfill"; }
case libvgcode::EGCodeExtrusionRole::TopSolidInfill: { return "EGCodeExtrusionRole::TopSolidInfill"; }
case libvgcode::EGCodeExtrusionRole::Ironing: { return "EGCodeExtrusionRole::Ironing"; }
case libvgcode::EGCodeExtrusionRole::BridgeInfill: { return "EGCodeExtrusionRole::BridgeInfill"; }
case libvgcode::EGCodeExtrusionRole::GapFill: { return "EGCodeExtrusionRole::GapFill"; }
case libvgcode::EGCodeExtrusionRole::Skirt: { return "EGCodeExtrusionRole::Skirt"; }
case libvgcode::EGCodeExtrusionRole::SupportMaterial: { return "EGCodeExtrusionRole::SupportMaterial"; }
case libvgcode::EGCodeExtrusionRole::SupportMaterialInterface: { return "EGCodeExtrusionRole::SupportMaterialInterface"; }
case libvgcode::EGCodeExtrusionRole::WipeTower: { return "EGCodeExtrusionRole::WipeTower"; }
case libvgcode::EGCodeExtrusionRole::Custom: { return "EGCodeExtrusionRole::Custom"; }
case libvgcode::EGCodeExtrusionRole::COUNT: { return "EGCodeExtrusionRole::COUNT"; }
}
};
auto move_type_to_string = [](libvgcode::EMoveType type) {
switch (type) {
case libvgcode::EMoveType::Noop: { return "EMoveType::Noop"; }
case libvgcode::EMoveType::Retract: { return "EMoveType::Retract"; }
case libvgcode::EMoveType::Unretract: { return "EMoveType::Unretract"; }
case libvgcode::EMoveType::Seam: { return "EMoveType::Seam"; }
case libvgcode::EMoveType::ToolChange: { return "EMoveType::ToolChange"; }
case libvgcode::EMoveType::ColorChange: { return "EMoveType::ColorChange"; }
case libvgcode::EMoveType::PausePrint: { return "EMoveType::PausePrint"; }
case libvgcode::EMoveType::CustomGCode: { return "EMoveType::CustomGCode"; }
case libvgcode::EMoveType::Travel: { return "EMoveType::Travel"; }
case libvgcode::EMoveType::Wipe: { return "EMoveType::Wipe"; }
case libvgcode::EMoveType::Extrude: { return "EMoveType::Extrude"; }
case libvgcode::EMoveType::COUNT: { return "EMoveType::COUNT"; }
}
};
FilePtr out{ boost::nowide::fopen("C:/prusa/slicer/test_output/spe1872/test.data", "wb") };
if (out.f != nullptr) {
const size_t vertices_count = data.vertices.size();
fwrite((void*)&vertices_count, 1, sizeof(size_t), out.f);
for (const libvgcode::PathVertex& v : data.vertices) {
fwrite((void*)&v.position[0], 1, sizeof(float), out.f);
fwrite((void*)&v.position[1], 1, sizeof(float), out.f);
fwrite((void*)&v.position[2], 1, sizeof(float), out.f);
fwrite((void*)&v.height, 1, sizeof(float), out.f);
fwrite((void*)&v.width, 1, sizeof(float), out.f);
fwrite((void*)&v.feedrate, 1, sizeof(float), out.f);
fwrite((void*)&v.actual_feedrate, 1, sizeof(float), out.f);
fwrite((void*)&v.mm3_per_mm, 1, sizeof(float), out.f);
fwrite((void*)&v.fan_speed, 1, sizeof(float), out.f);
fwrite((void*)&v.temperature, 1, sizeof(float), out.f);
fwrite((void*)&v.role, 1, sizeof(uint8_t), out.f);
fwrite((void*)&v.type, 1, sizeof(uint8_t), out.f);
fwrite((void*)&v.gcode_id, 1, sizeof(uint32_t), out.f);
fwrite((void*)&v.layer_id, 1, sizeof(uint32_t), out.f);
fwrite((void*)&v.extruder_id, 1, sizeof(uint32_t), out.f);
fwrite((void*)&v.color_id, 1, sizeof(uint32_t), out.f);
fwrite((void*)&v.times[0], 1, sizeof(float), out.f);
fwrite((void*)&v.times[1], 1, sizeof(float), out.f);
#if VGCODE_ENABLE_COG_AND_TOOL_MARKERS
const float weight = v.weight;
#else
const float weight = 0.0f;
#endif // VGCODE_ENABLE_COG_AND_TOOL_MARKERS
fwrite((void*)&weight, 1, sizeof(float), out.f);
}
const uint8_t spiral_vase_mode = data.spiral_vase_mode ? 1 : 0;
fwrite((void*)&spiral_vase_mode, 1, sizeof(uint8_t), out.f);
const size_t tool_colors_count = data.tools_colors.size();
fwrite((void*)&tool_colors_count, 1, sizeof(size_t), out.f);
for (const libvgcode::Color& c : data.tools_colors) {
fwrite((void*)&c[0], 1, sizeof(uint8_t), out.f);
fwrite((void*)&c[1], 1, sizeof(uint8_t), out.f);
fwrite((void*)&c[2], 1, sizeof(uint8_t), out.f);
}
const size_t color_print_colors_count = data.color_print_colors.size();
fwrite((void*)&color_print_colors_count, 1, sizeof(size_t), out.f);
for (const libvgcode::Color& c : data.color_print_colors) {
fwrite((void*)&c[0], 1, sizeof(uint8_t), out.f);
fwrite((void*)&c[1], 1, sizeof(uint8_t), out.f);
fwrite((void*)&c[2], 1, sizeof(uint8_t), out.f);
}
}
#endif // ENABLE_DATA_EXPORT
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// send data to the viewer
m_viewer.reset_default_extrusion_roles_colors();
@ -1419,11 +1412,7 @@ void GCodeViewer::load_as_gcode(const GCodeProcessorResult& gcode_result, const
curr.role != libvgcode::EGCodeExtrusionRole::Custom) {
const Vec3d curr_pos = libvgcode::convert(curr.position).cast<double>();
const Vec3d prev_pos = libvgcode::convert(m_viewer.get_vertex_at(i - 1).position).cast<double>();
#if ENABLE_ET_SPE1872
m_cog.add_segment(curr_pos, prev_pos, gcode_result.filament_densities[curr.extruder_id] * curr.mm3_per_mm * (curr_pos - prev_pos).norm());
#else
m_cog.add_segment(curr_pos, prev_pos, gcode_result.filament_densities[curr.extruder_id] * curr.volumetric_rate / curr.feedrate * (curr_pos - prev_pos).norm());
#endif // ENABLE_ET_SPE1872
}
}
#endif // !VGCODE_ENABLE_COG_AND_TOOL_MARKERS
@ -1806,7 +1795,7 @@ void GCodeViewer::update_sequential_view_current(unsigned int first, unsigned in
const libvgcode::Interval& enabled_range = m_viewer.get_view_enabled_range();
wxGetApp().plater()->enable_preview_moves_slider(enabled_range[1] > enabled_range[0]);
#if ENABLE_ET_SPE1872_DEBUG
#if ENABLE_ACTUAL_SPEED_DEBUG
if (enabled_range[1] != m_viewer.get_view_visible_range()[1]) {
const libvgcode::PathVertex& curr_vertex = m_viewer.get_current_vertex();
if (curr_vertex.is_extrusion() || curr_vertex.is_travel() || curr_vertex.is_wipe() ||
@ -1857,7 +1846,7 @@ void GCodeViewer::update_sequential_view_current(unsigned int first, unsigned in
m_sequential_view.marker.set_actual_speed_levels(levels);
}
}
#endif // ENABLE_ET_SPE1872_DEBUG
#endif // ENABLE_ACTUAL_SPEED_DEBUG
#else
auto is_visible = [this](unsigned int id) {
for (const TBuffer& buffer : m_buffers) {
@ -5196,10 +5185,6 @@ void GCodeViewer::render_legend(float& legend_height)
#if ENABLE_NEW_GCODE_VIEWER
const std::vector<float> layers_times = get_layers_times();
if (!layers_times.empty() && layers_times.size() == m_viewer.get_layers_count()) {
#else
if (!m_layers_times.empty() && m_layers.size() == m_layers_times.front().size()) {
#endif // ENABLE_NEW_GCODE_VIEWER
#if ENABLE_ET_SPE1872
view_options = { _u8L("Feature type"), _u8L("Height (mm)"), _u8L("Width (mm)"), _u8L("Speed (mm/s)"), _u8L("Actual speed (mm/s)"),
_u8L("Fan speed (%)"), _u8L("Temperature (°C)"), _u8L("Volumetric flow rate (mm³/s)"), _u8L("Actual volumetric flow rate (mm³/s)"),
_u8L("Layer time (linear)"), _u8L("Layer time (logarithmic)"), _u8L("Tool"), _u8L("Color Print") };
@ -5217,14 +5202,15 @@ void GCodeViewer::render_legend(float& legend_height)
static_cast<int>(libvgcode::EViewType::Tool),
static_cast<int>(libvgcode::EViewType::ColorPrint) };
#else
if (!m_layers_times.empty() && m_layers.size() == m_layers_times.front().size()) {
view_options = { _u8L("Feature type"), _u8L("Height (mm)"), _u8L("Width (mm)"), _u8L("Speed (mm/s)"), _u8L("Fan speed (%)"),
_u8L("Temperature (°C)"), _u8L("Volumetric flow rate (mm³/s)"), _u8L("Layer time (linear)"), _u8L("Layer time (logarithmic)"),
_u8L("Tool"), _u8L("Color Print") };
view_options_id = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
#endif // ENABLE_ET_SPE1872
#endif // ENABLE_NEW_GCODE_VIEWER
}
else {
#if ENABLE_ET_SPE1872
#if ENABLE_NEW_GCODE_VIEWER
view_options = { _u8L("Feature type"), _u8L("Height (mm)"), _u8L("Width (mm)"), _u8L("Speed (mm/s)"), _u8L("Actual speed (mm/s)"),
_u8L("Fan speed (%)"), _u8L("Temperature (°C)"), _u8L("Volumetric flow rate (mm³/s)"), _u8L("Actual volumetric flow rate (mm³/s)"),
_u8L("Tool"), _u8L("Color Print") };
@ -5239,26 +5225,16 @@ void GCodeViewer::render_legend(float& legend_height)
static_cast<int>(libvgcode::EViewType::ActualVolumetricFlowRate),
static_cast<int>(libvgcode::EViewType::Tool),
static_cast<int>(libvgcode::EViewType::ColorPrint) };
#if ENABLE_NEW_GCODE_VIEWER
if (new_view_type_i == static_cast<int>(libvgcode::EViewType::LayerTimeLinear) ||
new_view_type_i == static_cast<int>(libvgcode::EViewType::LayerTimeLogarithmic))
new_view_type_i = 0;
#else
if (view_type == 8 || view_type == 8)
view_type = 0;
#endif // ENABLE_NEW_GCODE_VIEWER
#else
view_options = { _u8L("Feature type"), _u8L("Height (mm)"), _u8L("Width (mm)"), _u8L("Speed (mm/s)"), _u8L("Fan speed (%)"),
_u8L("Temperature (°C)"), _u8L("Volumetric flow rate (mm³/s)"), _u8L("Tool"), _u8L("Color Print") };
view_options_id = { 0, 1, 2, 3, 4, 5, 6, 9, 10 };
#if ENABLE_NEW_GCODE_VIEWER
if (new_view_type_i == 7 || new_view_type_i == 8)
new_view_type_i = 0;
#else
if (view_type == 7 || view_type == 8)
view_type = 0;
#endif // ENABLE_NEW_GCODE_VIEWER
#endif // ENABLE_ET_SPE1872
}
#if ENABLE_NEW_GCODE_VIEWER
auto new_view_type_it = std::find(view_options_id.begin(), view_options_id.end(), new_view_type_i);
@ -5375,15 +5351,11 @@ void GCodeViewer::render_legend(float& legend_height)
case libvgcode::EViewType::Height: { append_range(m_viewer.get_color_range(libvgcode::EViewType::Height), 3); break; }
case libvgcode::EViewType::Width: { append_range(m_viewer.get_color_range(libvgcode::EViewType::Width), 3); break; }
case libvgcode::EViewType::Speed: { append_range(m_viewer.get_color_range(libvgcode::EViewType::Speed), 1); break; }
#if ENABLE_ET_SPE1872
case libvgcode::EViewType::ActualSpeed: { append_range(m_viewer.get_color_range(libvgcode::EViewType::ActualSpeed), 1); break; }
#endif // ENABLE_ET_SPE1872
case libvgcode::EViewType::FanSpeed: { append_range(m_viewer.get_color_range(libvgcode::EViewType::FanSpeed), 0); break; }
case libvgcode::EViewType::Temperature: { append_range(m_viewer.get_color_range(libvgcode::EViewType::Temperature), 0); break; }
case libvgcode::EViewType::VolumetricFlowRate: { append_range(m_viewer.get_color_range(libvgcode::EViewType::VolumetricFlowRate), 3); break; }
#if ENABLE_ET_SPE1872
case libvgcode::EViewType::ActualVolumetricFlowRate: { append_range(m_viewer.get_color_range(libvgcode::EViewType::ActualVolumetricFlowRate), 3); break; }
#endif // ENABLE_ET_SPE1872
case libvgcode::EViewType::LayerTimeLinear: { append_time_range(m_viewer.get_color_range(libvgcode::EViewType::LayerTimeLinear)); break; }
case libvgcode::EViewType::LayerTimeLogarithmic: { append_time_range(m_viewer.get_color_range(libvgcode::EViewType::LayerTimeLogarithmic)); break; }
case libvgcode::EViewType::Tool: {
@ -5784,12 +5756,8 @@ void GCodeViewer::render_legend(float& legend_height)
}
#if ENABLE_NEW_GCODE_VIEWER
#if ENABLE_ET_SPE1872
if (new_view_type == libvgcode::EViewType::Width || new_view_type == libvgcode::EViewType::VolumetricFlowRate ||
new_view_type == libvgcode::EViewType::ActualVolumetricFlowRate) {
#else
if (new_view_type == libvgcode::EViewType::Width || new_view_type == libvgcode::EViewType::VolumetricFlowRate) {
#endif // ENABLE_ET_SPE1872
const std::vector<libvgcode::EGCodeExtrusionRole>& roles = m_viewer.get_extrusion_roles();
const auto custom_it = std::find(roles.begin(), roles.end(), libvgcode::EGCodeExtrusionRole::Custom);
if (custom_it != roles.end()) {

View File

@ -700,7 +700,7 @@ class GCodeViewer
public:
struct SequentialView
{
#if ENABLE_ET_SPE1872_DEBUG
#if ENABLE_ACTUAL_SPEED_DEBUG
struct ActualSpeedImguiWidget
{
std::pair<float, float> y_range = { 0.0f, 0.0f };
@ -714,7 +714,7 @@ public:
std::vector<Item> data;
int plot(const char* label, const std::array<float, 2>& frame_size = { 0.0f, 0.0f });
};
#endif // ENABLE_ET_SPE1872_DEBUG
#endif // ENABLE_ACTUAL_SPEED_DEBUG
class Marker
{
@ -731,9 +731,9 @@ public:
bool m_visible{ true };
bool m_fixed_screen_size{ false };
float m_scale_factor{ 1.0f };
#if ENABLE_ET_SPE1872_DEBUG
#if ENABLE_ACTUAL_SPEED_DEBUG
ActualSpeedImguiWidget m_actual_speed_imgui_widget;
#endif // ENABLE_ET_SPE1872_DEBUG
#endif // ENABLE_ACTUAL_SPEED_DEBUG
public:
void init();
@ -744,7 +744,7 @@ public:
void set_world_offset(const Vec3f& offset) { m_world_offset = offset; }
void set_z_offset(float z_offset) { m_z_offset = z_offset; }
#if ENABLE_ET_SPE1872_DEBUG
#if ENABLE_ACTUAL_SPEED_DEBUG
void set_actual_speed_y_range(const std::pair<float, float>& y_range) {
m_actual_speed_imgui_widget.y_range = y_range;
}
@ -754,7 +754,7 @@ public:
void set_actual_speed_data(const std::vector<ActualSpeedImguiWidget::Item>& data) {
m_actual_speed_imgui_widget.data = data;
}
#endif // ENABLE_ET_SPE1872_DEBUG
#endif // ENABLE_ACTUAL_SPEED_DEBUG
bool is_visible() const { return m_visible; }
void set_visible(bool visible) { m_visible = visible; }

View File

@ -212,7 +212,6 @@ GCodeInputData convert(const Slic3r::GCodeProcessorResult& result, const std::ve
// to allow libvgcode to properly detect the start/end of a path we need to add a 'phantom' vertex
// equal to the current one with the exception of the position, which should match the previous move position,
// and the times, which are set to zero
#if ENABLE_ET_SPE1872
#if VGCODE_ENABLE_COG_AND_TOOL_MARKERS
const libvgcode::PathVertex vertex = { convert(prev.position), height, width, curr.feedrate, prev.actual_feedrate,
curr.mm3_per_mm, curr.fan_speed, curr.temperature, 0.0f, convert(curr.extrusion_role), curr_type,
@ -224,24 +223,10 @@ GCodeInputData convert(const Slic3r::GCodeProcessorResult& result, const std::ve
static_cast<uint32_t>(curr.gcode_id), static_cast<uint32_t>(curr.layer_id),
static_cast<uint8_t>(curr.extruder_id), static_cast<uint8_t>(curr.cp_color_id), { 0.0f, 0.0f } };
#endif // VGCODE_ENABLE_COG_AND_TOOL_MARKERS
#else
#if VGCODE_ENABLE_COG_AND_TOOL_MARKERS
const libvgcode::PathVertex vertex = { convert(prev.position), height, width, curr.feedrate, curr.fan_speed,
curr.temperature, curr.volumetric_rate(), 0.0f, convert(curr.extrusion_role), curr_type,
static_cast<uint32_t>(curr.gcode_id), static_cast<uint32_t>(curr.layer_id),
static_cast<uint8_t>(curr.extruder_id), static_cast<uint8_t>(curr.cp_color_id), { 0.0f, 0.0f } };
#else
const libvgcode::PathVertex vertex = { convert(prev.position), height, width, curr.feedrate, curr.fan_speed,
curr.temperature, curr.volumetric_rate(), convert(curr.extrusion_role), curr_type,
static_cast<uint32_t>(curr.gcode_id), static_cast<uint32_t>(curr.layer_id),
static_cast<uint8_t>(curr.extruder_id), static_cast<uint8_t>(curr.cp_color_id), { 0.0f, 0.0f } };
#endif // VGCODE_ENABLE_COG_AND_TOOL_MARKERS
#endif // ENABLE_ET_SPE1872
ret.vertices.emplace_back(vertex);
}
}
#if ENABLE_ET_SPE1872
#if VGCODE_ENABLE_COG_AND_TOOL_MARKERS
const libvgcode::PathVertex vertex = { convert(curr.position), height, width, curr.feedrate, curr.actual_feedrate,
curr.mm3_per_mm, curr.fan_speed, curr.temperature,
@ -254,18 +239,6 @@ GCodeInputData convert(const Slic3r::GCodeProcessorResult& result, const std::ve
static_cast<uint32_t>(curr.gcode_id), static_cast<uint32_t>(curr.layer_id),
static_cast<uint8_t>(curr.extruder_id), static_cast<uint8_t>(curr.cp_color_id), curr.time };
#endif // VGCODE_ENABLE_COG_AND_TOOL_MARKERS
#else
#if VGCODE_ENABLE_COG_AND_TOOL_MARKERS
const libvgcode::PathVertex vertex = { convert(curr.position), height, width, curr.feedrate, curr.fan_speed,
curr.temperature, curr.volumetric_rate(), result.filament_densities[curr.extruder_id] * curr.mm3_per_mm * (curr.position - prev.position).norm(),
convert(curr.extrusion_role), curr_type, static_cast<uint32_t>(curr.gcode_id), static_cast<uint32_t>(curr.layer_id),
static_cast<uint8_t>(curr.extruder_id), static_cast<uint8_t>(curr.cp_color_id), curr.time };
#else
const libvgcode::PathVertex vertex = { convert(curr.position), height, width, curr.feedrate, curr.fan_speed,
curr.temperature, curr.volumetric_rate(), convert(curr.extrusion_role), curr_type, static_cast<uint32_t>(curr.gcode_id),
static_cast<uint32_t>(curr.layer_id), static_cast<uint8_t>(curr.extruder_id), static_cast<uint8_t>(curr.cp_color_id), curr.time };
#endif // VGCODE_ENABLE_COG_AND_TOOL_MARKERS
#endif // ENABLE_ET_SPE1872
ret.vertices.emplace_back(vertex);
}
ret.vertices.shrink_to_fit();
@ -290,7 +263,6 @@ static void convert_lines_to_vertices(const Slic3r::Lines& lines, const std::vec
if (ii == 0) {
// add a dummy vertex at the start, to separate the current line from the others
const Slic3r::Vec2f a = unscale(line.a).cast<float>();
#if ENABLE_ET_SPE1872
#if VGCODE_ENABLE_COG_AND_TOOL_MARKERS
libvgcode::PathVertex vertex = { convert(Slic3r::Vec3f(a.x(), a.y(), top_z)), heights[i], widths[i], 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, extrusion_role, EMoveType::Noop, 0, static_cast<uint32_t>(layer_id),
@ -300,17 +272,6 @@ static void convert_lines_to_vertices(const Slic3r::Lines& lines, const std::vec
0.0f, 0.0f, 0.0f, extrusion_role, EMoveType::Noop, 0, static_cast<uint32_t>(layer_id),
static_cast<uint8_t>(extruder_id), static_cast<uint8_t>(color_id), { 0.0f, 0.0f } };
#endif // VGCODE_ENABLE_COG_AND_TOOL_MARKERS
#else
#if VGCODE_ENABLE_COG_AND_TOOL_MARKERS
libvgcode::PathVertex vertex = { convert(Slic3r::Vec3f(a.x(), a.y(), top_z)), heights[i], widths[i], 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, extrusion_role, EMoveType::Noop, 0, static_cast<uint32_t>(layer_id),
static_cast<uint8_t>(extruder_id), static_cast<uint8_t>(color_id), { 0.0f, 0.0f } };
#else
libvgcode::PathVertex vertex = { convert(Slic3r::Vec3f(a.x(), a.y(), top_z)), heights[i], widths[i], 0.0f, 0.0f,
0.0f, 0.0f, extrusion_role, EMoveType::Noop, 0, static_cast<uint32_t>(layer_id),
static_cast<uint8_t>(extruder_id), static_cast<uint8_t>(color_id), { 0.0f, 0.0f } };
#endif // VGCODE_ENABLE_COG_AND_TOOL_MARKERS
#endif // ENABLE_ET_SPE187
vertices.emplace_back(vertex);
// add the starting vertex of the segment
vertex.type = EMoveType::Extrude;
@ -318,7 +279,6 @@ static void convert_lines_to_vertices(const Slic3r::Lines& lines, const std::vec
}
// add the ending vertex of the segment
const Slic3r::Vec2f b = unscale(line.b).cast<float>();
#if ENABLE_ET_SPE1872
#if VGCODE_ENABLE_COG_AND_TOOL_MARKERS
const libvgcode::PathVertex vertex = { convert(Slic3r::Vec3f(b.x(), b.y(), top_z)), heights[i], widths[i], 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, extrusion_role, EMoveType::Extrude, 0, static_cast<uint32_t>(layer_id),
@ -328,17 +288,6 @@ static void convert_lines_to_vertices(const Slic3r::Lines& lines, const std::vec
0.0f, 0.0f, 0.0f, extrusion_role, EMoveType::Extrude, 0, static_cast<uint32_t>(layer_id),
static_cast<uint8_t>(extruder_id), static_cast<uint8_t>(color_id), { 0.0f, 0.0f } };
#endif // VGCODE_ENABLE_COG_AND_TOOL_MARKERS
#else
#if VGCODE_ENABLE_COG_AND_TOOL_MARKERS
const libvgcode::PathVertex vertex = { convert(Slic3r::Vec3f(b.x(), b.y(), top_z)), heights[i], widths[i], 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, extrusion_role, EMoveType::Extrude, 0, static_cast<uint32_t>(layer_id),
static_cast<uint8_t>(extruder_id), static_cast<uint8_t>(color_id), { 0.0f, 0.0f } };
#else
const libvgcode::PathVertex vertex = { convert(Slic3r::Vec3f(b.x(), b.y(), top_z)), heights[i], widths[i], 0.0f, 0.0f,
0.0f, 0.0f, extrusion_role, EMoveType::Extrude, 0, static_cast<uint32_t>(layer_id),
static_cast<uint8_t>(extruder_id), static_cast<uint8_t>(color_id), { 0.0f, 0.0f } };
#endif // VGCODE_ENABLE_COG_AND_TOOL_MARKERS
#endif // ENABLE_ET_SPE1872
vertices.emplace_back(vertex);
}
}