mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 00:52:04 +00:00
Tool Position window improve reading of vertex info (#12614)
* Update GCodeViewer.cpp * improve reading feature types and enable actual flow rate * Update GCodeViewer.cpp * Update GCodeViewer.cpp * Update GCodeViewer.cpp * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * hide actual speed and actual flow --------- Co-authored-by: Rodrigo Faselli <162915171+RF47@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -326,7 +326,7 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
|
|||||||
// ImGui::SameLine();
|
// ImGui::SameLine();
|
||||||
libvgcode::PathVertex vertex = viewer->get_current_vertex();
|
libvgcode::PathVertex vertex = viewer->get_current_vertex();
|
||||||
size_t vertex_id = viewer->get_current_vertex_id();
|
size_t vertex_id = viewer->get_current_vertex_id();
|
||||||
if (vertex.type == libvgcode::EMoveType::Seam) {
|
if (view_type != libvgcode::EViewType::FeatureType && vertex.type == libvgcode::EMoveType::Seam) { // exclude FeatureType for proper type readings
|
||||||
vertex_id = static_cast<size_t>(viewer->get_view_visible_range()[1]) - 1;
|
vertex_id = static_cast<size_t>(viewer->get_view_visible_range()[1]) - 1;
|
||||||
vertex = viewer->get_vertex_at(vertex_id);
|
vertex = viewer->get_vertex_at(vertex_id);
|
||||||
}
|
}
|
||||||
@@ -574,17 +574,26 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
|
|||||||
ImGui::Dummy({0,0});
|
ImGui::Dummy({0,0});
|
||||||
|
|
||||||
const bool is_extrusion = vertex.is_extrusion();
|
const bool is_extrusion = vertex.is_extrusion();
|
||||||
char buf[1024]; char valBuf[32]; char spdBuf[128];
|
char buf[1024] = ""; char valBuf[32]; char spdBuf[128];
|
||||||
sprintf(spdBuf, "%s%.0f ", _u8L("Speed: ").c_str(), vertex.feedrate);
|
sprintf(spdBuf, "%s%.0f ", _u8L("Speed: ").c_str(), vertex.feedrate);
|
||||||
const float speed_width = ImGui::CalcTextSize((_u8L("Speed: ") + "9999 ").c_str()).x;
|
const float speed_width = ImGui::CalcTextSize((_u8L("Speed: ") + "9999 ").c_str()).x;
|
||||||
ImGuiWrapper::text(std::string(spdBuf)); // render Speed as differrent item to keep next item in same place
|
ImGuiWrapper::text(std::string(spdBuf)); // render Speed as differrent item to keep next item in same place
|
||||||
switch (view_type) {
|
switch (view_type) {
|
||||||
|
case libvgcode::EViewType::FeatureType: {
|
||||||
|
if (is_extrusion && !vertex.is_option()) // ORCA show more types on FeatureType
|
||||||
|
sprintf(buf, "%s", to_string(vertex.role).c_str());
|
||||||
|
else if(vertex.is_travel() || vertex.is_option() || vertex.is_wipe())
|
||||||
|
sprintf(buf, "%s", to_string(vertex.type).c_str());
|
||||||
|
else
|
||||||
|
sprintf(buf, "%s", NA_CSTR);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case libvgcode::EViewType::Height: {
|
case libvgcode::EViewType::Height: {
|
||||||
if (is_extrusion)
|
if (is_extrusion)
|
||||||
sprintf(valBuf, "%.2f", vertex.height);
|
sprintf(valBuf, "%.2f", vertex.height);
|
||||||
else
|
else
|
||||||
sprintf(valBuf, "%s", NA_CSTR);
|
sprintf(valBuf, "%s", NA_CSTR);
|
||||||
sprintf(buf, "%s %s%s", buf, _u8L("Height: ").c_str(), valBuf);
|
sprintf(buf, "%s%s", _u8L("Height: ").c_str(), valBuf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case libvgcode::EViewType::Width: {
|
case libvgcode::EViewType::Width: {
|
||||||
@@ -592,7 +601,7 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
|
|||||||
sprintf(valBuf, "%.2f", vertex.width);
|
sprintf(valBuf, "%.2f", vertex.width);
|
||||||
else
|
else
|
||||||
sprintf(valBuf, "%s", NA_CSTR);
|
sprintf(valBuf, "%s", NA_CSTR);
|
||||||
sprintf(buf, "%s %s%s", buf, _u8L("Width: ").c_str(), valBuf);
|
sprintf(buf, "%s%s", _u8L("Width: ").c_str(), valBuf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case libvgcode::EViewType::VolumetricFlowRate: {
|
case libvgcode::EViewType::VolumetricFlowRate: {
|
||||||
@@ -600,38 +609,42 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
|
|||||||
sprintf(valBuf, "%.2f", vertex.volumetric_rate());
|
sprintf(valBuf, "%.2f", vertex.volumetric_rate());
|
||||||
else
|
else
|
||||||
sprintf(valBuf, "%s", NA_CSTR);
|
sprintf(valBuf, "%s", NA_CSTR);
|
||||||
sprintf(buf, "%s %s%s", buf, _u8L("Flow: ").c_str(), valBuf);
|
sprintf(buf, "%s%s", _u8L("Flow: ").c_str(), valBuf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case libvgcode::EViewType::FanSpeed: {
|
case libvgcode::EViewType::FanSpeed: {
|
||||||
sprintf(buf, "%s %s%.0f", buf, _u8L("Fan: ").c_str(), vertex.fan_speed);
|
sprintf(buf, "%s%.0f", _u8L("Fan: ").c_str(), vertex.fan_speed);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case libvgcode::EViewType::Temperature: {
|
case libvgcode::EViewType::Temperature: {
|
||||||
sprintf(buf, "%s %s%.0f", buf, _u8L("Temperature: ").c_str(), vertex.temperature);
|
sprintf(buf, "%s%.0f", _u8L("Temperature: ").c_str(), vertex.temperature);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case libvgcode::EViewType::LayerTimeLinear:
|
case libvgcode::EViewType::LayerTimeLinear:
|
||||||
case libvgcode::EViewType::LayerTimeLogarithmic: {
|
case libvgcode::EViewType::LayerTimeLogarithmic: {
|
||||||
sprintf(buf, "%s %s%.1f", buf, _u8L("Layer Time: ").c_str(), vertex.layer_duration);
|
sprintf(buf, "%s%.1f", _u8L("Layer Time: ").c_str(), vertex.layer_duration);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case libvgcode::EViewType::Tool: {
|
case libvgcode::EViewType::Tool: {
|
||||||
sprintf(buf, "%s %s%d", buf, _u8L("Tool: ").c_str(), vertex.extruder_id + 1);
|
sprintf(buf, "%s%d", _u8L("Tool: ").c_str(), vertex.extruder_id + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case libvgcode::EViewType::ColorPrint: {
|
case libvgcode::EViewType::ColorPrint: {
|
||||||
sprintf(buf, "%s %s%d", buf, _u8L("Color: ").c_str(), vertex.color_id + 1);
|
sprintf(buf, "%s%d", _u8L("Color: ").c_str(), vertex.color_id + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case libvgcode::EViewType::ActualVolumetricFlowRate: {
|
case libvgcode::EViewType::ActualVolumetricFlowRate: {
|
||||||
// Don't display the actual flow, since it only gives data for the end of a segment
|
// Don't display the actual flow, since it only gives data for the end of a segment
|
||||||
// sprintf(buf, "%s %s%.2f", buf, _u8L("Actual Flow: ").c_str(), vertex.actual_volumetric_rate());
|
//if (is_extrusion)
|
||||||
sprintf(buf, "%s %s", buf, " ");
|
// sprintf(valBuf, "%.2f", vertex.actual_volumetric_rate());
|
||||||
|
//else
|
||||||
|
// sprintf(valBuf, "%s", NA_CSTR);
|
||||||
|
//sprintf(buf, "%s%s", _u8L("Actual Flow: ").c_str(), valBuf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case libvgcode::EViewType::ActualSpeed: {
|
case libvgcode::EViewType::ActualSpeed: {
|
||||||
sprintf(buf, "%s %s%.1f", buf, _u8L("Actual Speed: ").c_str(), vertex.actual_feedrate);
|
// Don't display the actual flow, since it only gives data for the end of a segment
|
||||||
|
//sprintf(buf, "%s%.1f", _u8L("Actual Speed: ").c_str(), vertex.actual_feedrate);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case libvgcode::EViewType::Acceleration: {
|
case libvgcode::EViewType::Acceleration: {
|
||||||
@@ -644,19 +657,16 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
|
|||||||
}
|
}
|
||||||
// ORCA: Add Pressure Advance visualization support
|
// ORCA: Add Pressure Advance visualization support
|
||||||
case libvgcode::EViewType::PressureAdvance: {
|
case libvgcode::EViewType::PressureAdvance: {
|
||||||
sprintf(buf, "%s %s%.4f", buf, _u8L("PA: ").c_str(), vertex.pressure_advance);
|
sprintf(buf, "%s%.4f", _u8L("PA: ").c_str(), vertex.pressure_advance);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SameLine(speed_width);
|
|
||||||
if (view_type == libvgcode::EViewType::FeatureType) {
|
|
||||||
ImGuiWrapper::text(vertex.is_extrusion() ? to_string(vertex.role).c_str() : NA_CSTR);
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
if (buf[0] != '\0') { // dont render if buffer empty
|
||||||
|
ImGui::SameLine(speed_width);
|
||||||
ImGuiWrapper::text(std::string(buf));
|
ImGuiWrapper::text(std::string(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user