mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
Add Kinematics (Jerk & Accel) visualization support (#13169)
* Acceleration preview Co-Authored-By: Rodrigo Faselli <162915171+RF47@users.noreply.github.com> * Jerk visualization * JD --------- Co-authored-by: Rodrigo Faselli <162915171+RF47@users.noreply.github.com>
This commit is contained in:
@@ -91,6 +91,16 @@ struct PathVertex
|
||||
// Pressure advance value
|
||||
//
|
||||
float pressure_advance{ 0.0f };
|
||||
//
|
||||
// ORCA: Add Acceleration visualization support
|
||||
// Acceleration value
|
||||
//
|
||||
float acceleration{ 0.0f };
|
||||
//
|
||||
// ORCA: Add Jerk visualization support
|
||||
// Jerk value
|
||||
//
|
||||
float jerk{ 0.0f };
|
||||
|
||||
//
|
||||
// Return true if the segment is an extrusion move
|
||||
|
||||
@@ -94,6 +94,10 @@ enum class EViewType : uint8_t
|
||||
Temperature,
|
||||
// ORCA: Add Pressure Advance visualization support
|
||||
PressureAdvance,
|
||||
// ORCA: Add Acceleration visualization support
|
||||
Acceleration,
|
||||
// ORCA: Add Jerk visualization support
|
||||
Jerk,
|
||||
Tool,
|
||||
COUNT
|
||||
};
|
||||
|
||||
@@ -171,6 +171,10 @@ public:
|
||||
// EViewType::Temperature
|
||||
// ORCA: Add Pressure Advance visualization support
|
||||
// EViewType::PressureAdvance
|
||||
// ORCA: Add Acceleration visualization support
|
||||
// EViewType::Acceleration
|
||||
// ORCA: Add Jerk visualization support
|
||||
// EViewType::Jerk
|
||||
// EViewType::VolumetricFlowRate
|
||||
// EViewType::ActualVolumetricFlowRate
|
||||
// EViewType::LayerTimeLinear
|
||||
@@ -189,6 +193,10 @@ public:
|
||||
// EViewType::Temperature
|
||||
// ORCA: Add Pressure Advance visualization support
|
||||
// EViewType::PressureAdvance
|
||||
// ORCA: Add Acceleration visualization support
|
||||
// EViewType::Acceleration
|
||||
// ORCA: Add Jerk visualization support
|
||||
// EViewType::Jerk
|
||||
// EViewType::VolumetricFlowRate
|
||||
// EViewType::ActualVolumetricFlowRate
|
||||
// EViewType::LayerTimeLinear
|
||||
|
||||
@@ -1469,7 +1469,7 @@ Color ViewerImpl::get_vertex_color(const PathVertex& v) const
|
||||
if (v.type == EMoveType::Noop)
|
||||
return DUMMY_COLOR;
|
||||
|
||||
if ((v.is_wipe() && (m_settings.view_type != EViewType::Speed && m_settings.view_type != EViewType::ActualSpeed)) || v.is_option())
|
||||
if ((v.is_wipe() && (m_settings.view_type != EViewType::Speed && m_settings.view_type != EViewType::ActualSpeed && m_settings.view_type != EViewType::Acceleration && m_settings.view_type != EViewType::Jerk)) || v.is_option())
|
||||
return get_option_color(move_type_to_option(v.type));
|
||||
|
||||
switch (m_settings.view_type)
|
||||
@@ -1507,6 +1507,16 @@ Color ViewerImpl::get_vertex_color(const PathVertex& v) const
|
||||
{
|
||||
return v.is_travel() ? get_option_color(move_type_to_option(v.type)) : m_pressure_advance_range.get_color_at(v.pressure_advance);
|
||||
}
|
||||
// ORCA: Add Acceleration visualization support
|
||||
case EViewType::Acceleration:
|
||||
{
|
||||
return m_acceleration_range.get_color_at(v.acceleration);
|
||||
}
|
||||
// ORCA: Add Jerk visualization support
|
||||
case EViewType::Jerk:
|
||||
{
|
||||
return m_jerk_range.get_color_at(v.jerk);
|
||||
}
|
||||
case EViewType::VolumetricFlowRate:
|
||||
{
|
||||
return v.is_travel() ? get_option_color(move_type_to_option(v.type)) : m_volumetric_rate_range.get_color_at(v.volumetric_rate());
|
||||
@@ -1598,6 +1608,10 @@ const ColorRange& ViewerImpl::get_color_range(EViewType type) const
|
||||
case EViewType::Temperature: { return m_temperature_range; }
|
||||
// ORCA: Add Pressure Advance visualization support
|
||||
case EViewType::PressureAdvance: { return m_pressure_advance_range; }
|
||||
// ORCA: Add Acceleration visualization support
|
||||
case EViewType::Acceleration: { return m_acceleration_range; }
|
||||
// ORCA: Add Jerk visualization support
|
||||
case EViewType::Jerk: { return m_jerk_range; }
|
||||
case EViewType::VolumetricFlowRate: { return m_volumetric_rate_range; }
|
||||
case EViewType::ActualVolumetricFlowRate: { return m_actual_volumetric_rate_range; }
|
||||
case EViewType::LayerTimeLinear: { return m_layer_time_range[0]; }
|
||||
@@ -1618,6 +1632,10 @@ void ViewerImpl::set_color_range_palette(EViewType type, const Palette& palette)
|
||||
case EViewType::Temperature: { m_temperature_range.set_palette(palette); break; }
|
||||
// ORCA: Add Pressure Advance visualization support
|
||||
case EViewType::PressureAdvance: { m_pressure_advance_range.set_palette(palette); break; }
|
||||
// ORCA: Add Acceleration visualization support
|
||||
case EViewType::Acceleration: { m_acceleration_range.set_palette(palette); break; }
|
||||
// ORCA: Add Jerk visualization support
|
||||
case EViewType::Jerk: { m_jerk_range.set_palette(palette); break; }
|
||||
case EViewType::VolumetricFlowRate: { m_volumetric_rate_range.set_palette(palette); break; }
|
||||
case EViewType::ActualVolumetricFlowRate: { m_actual_volumetric_rate_range.set_palette(palette); break; }
|
||||
case EViewType::LayerTimeLinear: { m_layer_time_range[0].set_palette(palette); break; }
|
||||
@@ -1657,6 +1675,10 @@ size_t ViewerImpl::get_used_cpu_memory() const
|
||||
ret += m_temperature_range.size_in_bytes_cpu();
|
||||
// ORCA: Add Pressure Advance visualization support
|
||||
ret += m_pressure_advance_range.size_in_bytes_cpu();
|
||||
// ORCA: Add Acceleration visualization support
|
||||
ret += m_acceleration_range.size_in_bytes_cpu();
|
||||
// ORCA: Add Jerk visualization support
|
||||
ret += m_jerk_range.size_in_bytes_cpu();
|
||||
ret += m_volumetric_rate_range.size_in_bytes_cpu();
|
||||
ret += m_actual_volumetric_rate_range.size_in_bytes_cpu();
|
||||
for (size_t i = 0; i < COLOR_RANGE_TYPES_COUNT; ++i) {
|
||||
@@ -1809,6 +1831,10 @@ void ViewerImpl::update_color_ranges()
|
||||
m_temperature_range.reset();
|
||||
// ORCA: Add Pressure Advance visualization support
|
||||
m_pressure_advance_range.reset();
|
||||
// ORCA: Add Acceleration visualization support
|
||||
m_acceleration_range.reset();
|
||||
// ORCA: Add Jerk visualization support
|
||||
m_jerk_range.reset();
|
||||
m_volumetric_rate_range.reset();
|
||||
m_actual_volumetric_rate_range.reset();
|
||||
m_layer_time_range[0].reset(); // ColorRange::EType::Linear
|
||||
@@ -1834,6 +1860,10 @@ void ViewerImpl::update_color_ranges()
|
||||
v.is_extrusion()) {
|
||||
m_speed_range.update(v.feedrate);
|
||||
m_actual_speed_range.update(v.actual_feedrate);
|
||||
// ORCA: Add Acceleration visualization support
|
||||
m_acceleration_range.update(v.acceleration);
|
||||
// ORCA: Add Jerk visualization support
|
||||
m_jerk_range.update(v.jerk);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -291,6 +291,10 @@ private:
|
||||
ColorRange m_temperature_range;
|
||||
// ORCA: Add Pressure Advance visualization support
|
||||
ColorRange m_pressure_advance_range;
|
||||
// ORCA: Add Acceleration visualization support
|
||||
ColorRange m_acceleration_range;
|
||||
// ORCA: Add Jerk visualization support
|
||||
ColorRange m_jerk_range;
|
||||
ColorRange m_volumetric_rate_range;
|
||||
ColorRange m_actual_volumetric_rate_range;
|
||||
std::array<ColorRange, COLOR_RANGE_TYPES_COUNT> m_layer_time_range{
|
||||
|
||||
Reference in New Issue
Block a user