mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 13:35:59 +08:00
New gcode visualization library - Partial update of interface comments/documentation
This commit is contained in:
parent
028888bea5
commit
64b907e984
@ -16,9 +16,9 @@ struct GCodeInputData
|
|||||||
// Required to properly detect fictitious layer changes when spiral vase mode is enabled.
|
// Required to properly detect fictitious layer changes when spiral vase mode is enabled.
|
||||||
//
|
//
|
||||||
bool spiral_vase_mode{ false };
|
bool spiral_vase_mode{ false };
|
||||||
|
|
||||||
//
|
//
|
||||||
// List of path vertices (gcode moves)
|
// List of path vertices (gcode moves)
|
||||||
|
// See: PathVertex
|
||||||
//
|
//
|
||||||
std::vector<PathVertex> vertices;
|
std::vector<PathVertex> vertices;
|
||||||
};
|
};
|
||||||
|
@ -15,8 +15,14 @@ namespace libvgcode {
|
|||||||
|
|
||||||
static constexpr float PI = 3.141592f;
|
static constexpr float PI = 3.141592f;
|
||||||
|
|
||||||
static constexpr float DEFAULT_TRAVELS_RADIUS = 0.1f;
|
//
|
||||||
static constexpr float DEFAULT_WIPES_RADIUS = 0.1f;
|
// Default radius, in mm, of the cylinders used to render the travel moves.
|
||||||
|
//
|
||||||
|
static constexpr float DEFAULT_TRAVELS_RADIUS_MM = 0.1f;
|
||||||
|
//
|
||||||
|
// Default radius, in mm, of the cylinders used to render the wipe moves.
|
||||||
|
//
|
||||||
|
static constexpr float DEFAULT_WIPES_RADIUS_MM = 0.1f;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Vector in 3 dimensions
|
// Vector in 3 dimensions
|
||||||
@ -211,6 +217,8 @@ static const std::vector<Color> RANGES_COLORS{ {
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Mapping from EMoveType to EOptionType
|
// Mapping from EMoveType to EOptionType
|
||||||
|
// Returns EOptionType::COUNT if the given move type does not correspond
|
||||||
|
// to any option type.
|
||||||
//
|
//
|
||||||
extern EOptionType move_type_to_option(EMoveType type);
|
extern EOptionType move_type_to_option(EMoveType type);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
//
|
//
|
||||||
// Release the resources used by the viewer.
|
// Release the resources used by the viewer.
|
||||||
// This method must be called before releasing the OpenGL context if the viewer
|
// This method must be called before releasing the OpenGL context if the viewer
|
||||||
// goes out of scope after releasing the OpenGL context.
|
// goes out of scope after releasing it.
|
||||||
//
|
//
|
||||||
void shutdown();
|
void shutdown();
|
||||||
//
|
//
|
||||||
@ -51,28 +51,108 @@ public:
|
|||||||
//
|
//
|
||||||
void render(const Mat4x4& view_matrix, const Mat4x4& projection_matrix);
|
void render(const Mat4x4& view_matrix, const Mat4x4& projection_matrix);
|
||||||
|
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// Settings
|
||||||
|
// The following methods can be used to query/customize the parameters
|
||||||
|
// used to chenge the way toolpaths are rendered.
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// View type
|
||||||
|
// See: EViewType
|
||||||
|
//
|
||||||
EViewType get_view_type() const;
|
EViewType get_view_type() const;
|
||||||
void set_view_type(EViewType type);
|
void set_view_type(EViewType type);
|
||||||
|
//
|
||||||
|
// Time mode
|
||||||
|
// See: ETimeMode
|
||||||
|
//
|
||||||
ETimeMode get_time_mode() const;
|
ETimeMode get_time_mode() const;
|
||||||
void set_time_mode(ETimeMode mode);
|
void set_time_mode(ETimeMode mode);
|
||||||
|
//
|
||||||
const Interval& get_layers_view_range() const;
|
// Top layer only
|
||||||
void set_layers_view_range(const Interval& range);
|
// Whether or not the visible range is limited to the current top layer only.
|
||||||
void set_layers_view_range(Interval::value_type min, Interval::value_type max);
|
//
|
||||||
|
|
||||||
bool is_top_layer_only_view_range() const;
|
bool is_top_layer_only_view_range() const;
|
||||||
void set_top_layer_only_view_range(bool top_layer_only_view_range);
|
void set_top_layer_only_view_range(bool top_layer_only);
|
||||||
|
//
|
||||||
|
// Spiral vase mode
|
||||||
|
// Whether or not the gcode was generated with spiral vase mode enabled.
|
||||||
|
// See: GCodeInputData
|
||||||
|
//
|
||||||
bool is_spiral_vase_mode() const;
|
bool is_spiral_vase_mode() const;
|
||||||
|
|
||||||
size_t get_layers_count() const;
|
//
|
||||||
float get_layer_z(size_t layer_id) const;
|
// ************************************************************************
|
||||||
std::vector<float> get_layers_zs() const;
|
// Layers range
|
||||||
|
// The following methods can be used to query/customize the visualized
|
||||||
|
// layers range.
|
||||||
|
// Layers are detected during the call to load() method.
|
||||||
|
// Their count can be queried using get_layers_count() method.
|
||||||
|
// Their global range is [0..get_layers_count() - 1].
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the current layers range.
|
||||||
|
//
|
||||||
|
const Interval& get_layers_view_range() const;
|
||||||
|
//
|
||||||
|
// Set the current layers range with the given interval.
|
||||||
|
// Values are clamped to [0..get_layers_count() - 1].
|
||||||
|
//
|
||||||
|
void set_layers_view_range(const Interval& range);
|
||||||
|
//
|
||||||
|
// Set the current layers range with the given min and max values.
|
||||||
|
// Values are clamped to [0..get_layers_count() - 1].
|
||||||
|
//
|
||||||
|
void set_layers_view_range(Interval::value_type min, Interval::value_type max);
|
||||||
|
//
|
||||||
|
// Return the count of detected layers.
|
||||||
|
//
|
||||||
|
size_t get_layers_count() const;
|
||||||
|
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// Layers zs
|
||||||
|
// The following methods can be used to query the layers zs.
|
||||||
|
// Layers are detected during the call to load() method.
|
||||||
|
// Their count can be queried using get_layers_count() method.
|
||||||
|
// Their global range is [0..get_layers_count() - 1].
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the z of the layer with the given id
|
||||||
|
// or 0.0f if the id does not belong to [0..get_layers_count() - 1].
|
||||||
|
//
|
||||||
|
float get_layer_z(size_t layer_id) const;
|
||||||
|
//
|
||||||
|
// Return the list of zs of the detected layers.
|
||||||
|
//
|
||||||
|
std::vector<float> get_layers_zs() const;
|
||||||
|
//
|
||||||
|
// Return the id of the layer closest to the given z.
|
||||||
|
//
|
||||||
size_t get_layer_id_at(float z) const;
|
size_t get_layer_id_at(float z) const;
|
||||||
|
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// Extruders
|
||||||
|
// The following methods can be used to query informations about extruders.
|
||||||
|
// Extruders are detected during the call to load() method.
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the count of detected used extruders.
|
||||||
|
//
|
||||||
size_t get_used_extruders_count() const;
|
size_t get_used_extruders_count() const;
|
||||||
|
//
|
||||||
|
// Return the list of ids of the detected used extruders.
|
||||||
|
//
|
||||||
const std::vector<uint8_t>& get_used_extruders_ids() const;
|
const std::vector<uint8_t>& get_used_extruders_ids() const;
|
||||||
|
|
||||||
AABox get_bounding_box(EBBoxType type) const;
|
AABox get_bounding_box(EBBoxType type) const;
|
||||||
@ -88,7 +168,7 @@ public:
|
|||||||
const Interval& get_view_visible_range() const;
|
const Interval& get_view_visible_range() const;
|
||||||
|
|
||||||
//
|
//
|
||||||
// min must be smaller than max
|
// Set the current visible range.
|
||||||
// values are clamped to the current view global range
|
// values are clamped to the current view global range
|
||||||
//
|
//
|
||||||
void set_view_visible_range(uint32_t min, uint32_t max);
|
void set_view_visible_range(uint32_t min, uint32_t max);
|
||||||
@ -195,18 +275,49 @@ public:
|
|||||||
void set_option_color(EOptionType type, const Color& color);
|
void set_option_color(EOptionType type, const Color& color);
|
||||||
void reset_default_options_colors();
|
void reset_default_options_colors();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the color range for height.
|
||||||
|
//
|
||||||
const ColorRange& get_height_range() const;
|
const ColorRange& get_height_range() const;
|
||||||
|
//
|
||||||
|
// Get the color range for width.
|
||||||
|
//
|
||||||
const ColorRange& get_width_range() const;
|
const ColorRange& get_width_range() const;
|
||||||
|
//
|
||||||
|
// Get the color range for speed.
|
||||||
|
//
|
||||||
const ColorRange& get_speed_range() const;
|
const ColorRange& get_speed_range() const;
|
||||||
|
//
|
||||||
|
// Get the color range for fan speed.
|
||||||
|
//
|
||||||
const ColorRange& get_fan_speed_range() const;
|
const ColorRange& get_fan_speed_range() const;
|
||||||
|
//
|
||||||
|
// Get the color range for temperature.
|
||||||
|
//
|
||||||
const ColorRange& get_temperature_range() const;
|
const ColorRange& get_temperature_range() const;
|
||||||
|
//
|
||||||
|
// Get the color range for volumetric range.
|
||||||
|
//
|
||||||
const ColorRange& get_volumetric_rate_range() const;
|
const ColorRange& get_volumetric_rate_range() const;
|
||||||
|
//
|
||||||
|
// Get the color range for the layer time range with the given type.
|
||||||
|
//
|
||||||
const ColorRange& get_layer_time_range(EColorRangeType type) const;
|
const ColorRange& get_layer_time_range(EColorRangeType type) const;
|
||||||
|
//
|
||||||
|
// Get the radius, in mm, of the cylinders used to render the travel moves.
|
||||||
|
//
|
||||||
float get_travels_radius() const;
|
float get_travels_radius() const;
|
||||||
|
//
|
||||||
|
// Set the radius, in mm, of the cylinders used to render the travel moves.
|
||||||
|
//
|
||||||
void set_travels_radius(float radius);
|
void set_travels_radius(float radius);
|
||||||
|
//
|
||||||
|
// Get the radius, in mm, of the cylinders used to render the wipe moves.
|
||||||
|
//
|
||||||
float get_wipes_radius() const;
|
float get_wipes_radius() const;
|
||||||
|
//
|
||||||
|
// Set the radius, in mm, of the cylinders used to render the wipe moves.
|
||||||
|
//
|
||||||
void set_wipes_radius(float radius);
|
void set_wipes_radius(float radius);
|
||||||
|
|
||||||
#if ENABLE_COG_AND_TOOL_MARKERS
|
#if ENABLE_COG_AND_TOOL_MARKERS
|
||||||
|
@ -13,14 +13,23 @@ namespace libvgcode {
|
|||||||
|
|
||||||
struct Settings
|
struct Settings
|
||||||
{
|
{
|
||||||
bool update_view_full_range{ true };
|
//
|
||||||
bool update_enabled_entities{ true };
|
// Visualization parameters
|
||||||
bool update_colors{ true };
|
//
|
||||||
EViewType view_type{ EViewType::FeatureType };
|
EViewType view_type{ EViewType::FeatureType };
|
||||||
ETimeMode time_mode{ ETimeMode::Normal };
|
ETimeMode time_mode{ ETimeMode::Normal };
|
||||||
bool top_layer_only_view_range{ false };
|
bool top_layer_only_view_range{ false };
|
||||||
bool spiral_vase_mode{ false };
|
bool spiral_vase_mode{ false };
|
||||||
|
//
|
||||||
|
// Required update flags
|
||||||
|
//
|
||||||
|
bool update_view_full_range{ true };
|
||||||
|
bool update_enabled_entities{ true };
|
||||||
|
bool update_colors{ true };
|
||||||
|
|
||||||
|
//
|
||||||
|
// Visibility maps
|
||||||
|
//
|
||||||
std::map<EOptionType, bool> options_visibility{ {
|
std::map<EOptionType, bool> options_visibility{ {
|
||||||
{ EOptionType::Travels, false },
|
{ EOptionType::Travels, false },
|
||||||
{ EOptionType::Wipes, false },
|
{ EOptionType::Wipes, false },
|
||||||
|
@ -62,6 +62,21 @@ void Viewer::set_time_mode(ETimeMode mode)
|
|||||||
m_impl->set_time_mode(mode);
|
m_impl->set_time_mode(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Viewer::is_top_layer_only_view_range() const
|
||||||
|
{
|
||||||
|
return m_impl->is_top_layer_only_view_range();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Viewer::set_top_layer_only_view_range(bool top_layer_only)
|
||||||
|
{
|
||||||
|
m_impl->set_top_layer_only_view_range(top_layer_only);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Viewer::is_spiral_vase_mode() const
|
||||||
|
{
|
||||||
|
return m_impl->is_spiral_vase_mode();
|
||||||
|
}
|
||||||
|
|
||||||
const Interval& Viewer::get_layers_view_range() const
|
const Interval& Viewer::get_layers_view_range() const
|
||||||
{
|
{
|
||||||
return m_impl->get_layers_view_range();
|
return m_impl->get_layers_view_range();
|
||||||
@ -77,21 +92,6 @@ void Viewer::set_layers_view_range(Interval::value_type min, Interval::value_typ
|
|||||||
m_impl->set_layers_view_range(min, max);
|
m_impl->set_layers_view_range(min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Viewer::is_top_layer_only_view_range() const
|
|
||||||
{
|
|
||||||
return m_impl->is_top_layer_only_view_range();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Viewer::is_spiral_vase_mode() const
|
|
||||||
{
|
|
||||||
return m_impl->is_spiral_vase_mode();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Viewer::set_top_layer_only_view_range(bool top_layer_only_view_range)
|
|
||||||
{
|
|
||||||
m_impl->set_top_layer_only_view_range(top_layer_only_view_range);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t Viewer::get_layers_count() const
|
size_t Viewer::get_layers_count() const
|
||||||
{
|
{
|
||||||
return m_impl->get_layers_count();
|
return m_impl->get_layers_count();
|
||||||
|
@ -779,6 +779,8 @@ void ViewerImpl::set_time_mode(ETimeMode mode)
|
|||||||
|
|
||||||
void ViewerImpl::set_layers_view_range(Interval::value_type min, Interval::value_type max)
|
void ViewerImpl::set_layers_view_range(Interval::value_type min, Interval::value_type max)
|
||||||
{
|
{
|
||||||
|
min = std::clamp<Interval::value_type>(min, 0, m_layers.count() - 1);
|
||||||
|
max = std::clamp<Interval::value_type>(max, 0, m_layers.count() - 1);
|
||||||
m_layers.set_view_range(min, max);
|
m_layers.set_view_range(min, max);
|
||||||
// force immediate update of the full range
|
// force immediate update of the full range
|
||||||
update_view_full_range();
|
update_view_full_range();
|
||||||
|
@ -196,8 +196,8 @@ private:
|
|||||||
std::vector<EOptionType> m_options;
|
std::vector<EOptionType> m_options;
|
||||||
std::array<float, TIME_MODES_COUNT> m_travels_time{ 0.0f, 0.0f };
|
std::array<float, TIME_MODES_COUNT> m_travels_time{ 0.0f, 0.0f };
|
||||||
std::vector<uint8_t> m_used_extruders_ids;
|
std::vector<uint8_t> m_used_extruders_ids;
|
||||||
float m_travels_radius{ DEFAULT_TRAVELS_RADIUS };
|
float m_travels_radius{ DEFAULT_TRAVELS_RADIUS_MM };
|
||||||
float m_wipes_radius{ DEFAULT_WIPES_RADIUS };
|
float m_wipes_radius{ DEFAULT_WIPES_RADIUS_MM };
|
||||||
|
|
||||||
bool m_initialized{ false };
|
bool m_initialized{ false };
|
||||||
bool m_loading{ false };
|
bool m_loading{ false };
|
||||||
|
@ -55,8 +55,8 @@ extern ETimeMode convert(const Slic3r::PrintEstimatedStatistics::ETimeMode& mode
|
|||||||
extern Slic3r::PrintEstimatedStatistics::ETimeMode convert(const ETimeMode& mode);
|
extern Slic3r::PrintEstimatedStatistics::ETimeMode convert(const ETimeMode& mode);
|
||||||
|
|
||||||
// mapping from Slic3r::GCodeProcessorResult to libvgcode::GCodeInputData
|
// mapping from Slic3r::GCodeProcessorResult to libvgcode::GCodeInputData
|
||||||
extern GCodeInputData convert(const Slic3r::GCodeProcessorResult& result, float travels_radius = DEFAULT_TRAVELS_RADIUS,
|
extern GCodeInputData convert(const Slic3r::GCodeProcessorResult& result, float travels_radius = DEFAULT_TRAVELS_RADIUS_MM,
|
||||||
float wipes_radius = DEFAULT_WIPES_RADIUS);
|
float wipes_radius = DEFAULT_WIPES_RADIUS_MM);
|
||||||
|
|
||||||
// mapping from Slic3r::Print to libvgcode::GCodeInputData
|
// mapping from Slic3r::Print to libvgcode::GCodeInputData
|
||||||
extern GCodeInputData convert(const Slic3r::Print& print, const std::vector<std::string>& str_tool_colors,
|
extern GCodeInputData convert(const Slic3r::Print& print, const std::vector<std::string>& str_tool_colors,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user