Merge remote-tracking branch 'PRIVATE/master' into ys_cut
This commit is contained in:
commit
b4f38883a8
@ -71,7 +71,7 @@ is currently unsupported because some of the dependencies don't support this, mo
|
||||
Please note that the `CMAKE_OSX_DEPLOYMENT_TARGET` and `CMAKE_OSX_SYSROOT` options need to be set the same
|
||||
on both the dependencies bundle as well as PrusaSlicer itself.
|
||||
|
||||
Official Mac PrusaSlicer builds are currently built against SDK 10.9 to ensure compatibility with older Macs.
|
||||
Official macOS PrusaSlicer builds are currently (as of PrusaSlicer 2.5) built against SDK 10.12 to ensure compatibility with older Macs.
|
||||
|
||||
_Warning:_ XCode may be set such that it rejects SDKs bellow some version (silently, more or less).
|
||||
This is set in the property list file
|
||||
|
@ -1,2 +1,3 @@
|
||||
min_slic3r_version = 2.4.1-alpha0
|
||||
1.0.1 Various fixes and improvements. Commented filament sensor initialisation for v-Minion (optional HW).
|
||||
1.0.0 Initial RatRig bundle
|
@ -9,7 +9,7 @@
|
||||
name = RatRig
|
||||
# Configuration version of this file. Config file will only be installed, if the config_version differs.
|
||||
# This means, the server may force the Slic3r configuration to be downgraded.
|
||||
config_version = 1.0.0
|
||||
config_version = 1.0.1
|
||||
# Where to get the updates from?
|
||||
config_update_url = https://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/RatRig/
|
||||
# The printer models will be shown by the Configuration Wizard in this order,
|
||||
@ -25,7 +25,7 @@ technology = FFF
|
||||
family = V-Core-3
|
||||
bed_model = rr-vc-300.stl
|
||||
bed_texture = rr-vc-300.svg
|
||||
default_materials = Generic PETG V6 @RatRig; Generic PETG HF @RatRig; Generic PLA @RatRig; Esun ePA-CF @RatRig; Generic ABS @RatRig
|
||||
default_materials = Generic PETG V6 @RatRig; Generic PETG HF @RatRig; Generic PLA @RatRig; Esun ePA-CF @RatRig; Generic ABS @RatRig; Generic TPU @RatRig
|
||||
|
||||
[printer_model:VC3_400]
|
||||
name = RatRig V-Core-3 400mm
|
||||
@ -33,7 +33,7 @@ variants = 0.4
|
||||
family = V-Core-3
|
||||
bed_model = rr-vc-400.stl
|
||||
bed_texture = rr-vc-400.svg
|
||||
default_materials = Generic PETG V6 @RatRig; Generic PETG HF @RatRig; Generic PLA @RatRig; Esun ePA-CF @RatRig; Generic ABS @RatRig
|
||||
default_materials = Generic PETG V6 @RatRig; Generic PETG HF @RatRig; Generic PLA @RatRig; Esun ePA-CF @RatRig; Generic ABS @RatRig; Generic TPU @RatRig
|
||||
|
||||
[printer_model:VC3_500]
|
||||
name = RatRig V-Core-3 500mm
|
||||
@ -41,7 +41,7 @@ variants = 0.4
|
||||
family = V-Core-3
|
||||
bed_model = rr-vc-500.stl
|
||||
bed_texture = rr-vc-500.svg
|
||||
default_materials = Generic PETG V6 @RatRig; Generic PETG HF @RatRig; Generic PLA @RatRig; Esun ePA-CF @RatRig; Generic ABS @RatRig
|
||||
default_materials = Generic PETG V6 @RatRig; Generic PETG HF @RatRig; Generic PLA @RatRig; Esun ePA-CF @RatRig; Generic ABS @RatRig; Generic TPU @RatRig
|
||||
|
||||
[printer_model:VMINION]
|
||||
name = RatRig V-Minion
|
||||
@ -50,7 +50,7 @@ technology = FFF
|
||||
family = V-Minion
|
||||
bed_model = rr-vminion.stl
|
||||
bed_texture = rr-vminion.svg
|
||||
default_materials = Generic PETG V6 @RatRig; Generic PETG HF @RatRig; Generic PLA @RatRig; @Esun ePA-CF RatRig; Generic ABS @RatRig
|
||||
default_materials = Generic PETG V6 @RatRig; Generic PETG HF @RatRig; Generic PLA @RatRig; @Esun ePA-CF RatRig; Generic ABS @RatRig; Generic TPU @RatRig
|
||||
|
||||
[print:*common*]
|
||||
compatible_printers_condition = printer_model=~/.*VC3_.*/ and nozzle_diameter[0]==0.4
|
||||
@ -75,7 +75,6 @@ dont_support_bridges = 1
|
||||
draft_shield = 0
|
||||
ensure_vertical_shell_thickness = 1
|
||||
exact_last_layer_height = 0
|
||||
external_infill_margin = 150%
|
||||
external_perimeter_extrusion_width = 0.4
|
||||
external_perimeter_speed = 90%
|
||||
extruder_clearance_height = 25
|
||||
@ -116,7 +115,6 @@ notes =
|
||||
only_retract_when_crossing_perimeters = 0
|
||||
ooze_prevention = 0
|
||||
output_filename_format = {input_filename_base}_{layer_height}mm_{filament_type[0]}_{print_time}.gcode
|
||||
over_bridge_flow_ratio = 100%
|
||||
perimeter_acceleration = 3000
|
||||
perimeter_extruder = 1
|
||||
perimeter_extrusion_width = 0.4
|
||||
@ -163,7 +161,6 @@ support_material_threshold = 65
|
||||
support_material_with_sheath = 0
|
||||
support_material_xy_spacing = 60%
|
||||
thin_walls = 0
|
||||
threads = 4
|
||||
top_fill_pattern = monotonic
|
||||
top_infill_extrusion_width = 0.4
|
||||
top_solid_infill_speed = 60%
|
||||
@ -437,7 +434,7 @@ retract_speed = 40
|
||||
silent_mode = 0
|
||||
single_extruder_multi_material = 0
|
||||
start_gcode = M190 S0 ; Prevents prusaslicer from prepending m190 to the gcode interfering with the macro\nM109 S0 ; Prevents prusaslicer from prepending m109 to the gcode interfering with the macro\nSTART_PRINT EXTRUDER_TEMP=[first_layer_temperature] BED_TEMP=[first_layer_bed_temperature]\n;enable this if you have a BTT Smart Filament Sensor\nSET_FILAMENT_SENSOR SENSOR=my_sensor ENABLE=0\n
|
||||
thumbnails = 16x16,220x220
|
||||
thumbnails = 64x64,400x300
|
||||
toolchange_gcode =
|
||||
use_firmware_retraction = 0
|
||||
use_relative_e_distances = 1
|
||||
@ -499,10 +496,10 @@ retract_restart_extra_toolchange = 0
|
||||
retract_speed = 40
|
||||
silent_mode = 0
|
||||
single_extruder_multi_material = 0
|
||||
start_gcode = M190 S0 ; Prevents prusaslicer from prepending m190 to the gcode interfering with the macro\nM109 S0 ; Prevents prusaslicer from prepending m109 to the gcode interfering with the macro\nSTART_PRINT EXTRUDER_TEMP=[first_layer_temperature] BED_TEMP=[first_layer_bed_temperature]\n;enable this if you have a BTT Smart Filament Sensor\nSET_FILAMENT_SENSOR SENSOR=my_sensor ENABLE=0\n
|
||||
start_gcode = M190 S0 ; Prevents prusaslicer from prepending m190 to the gcode interfering with the macro\nM109 S0 ; Prevents prusaslicer from prepending m109 to the gcode interfering with the macro\nSTART_PRINT EXTRUDER_TEMP=[first_layer_temperature] BED_TEMP=[first_layer_bed_temperature]\n;enable this if you have a BTT Smart Filament Sensor\n; SET_FILAMENT_SENSOR SENSOR=my_sensor ENABLE=0\n
|
||||
start_gcode_manual = 0
|
||||
template_custom_gcode =
|
||||
thumbnails = 16x16,220x220
|
||||
thumbnails = 64x64,400x300
|
||||
thumbnails_color = #018aff
|
||||
thumbnails_custom_color = 0
|
||||
thumbnails_with_bed = 1
|
||||
@ -744,4 +741,87 @@ min_fan_speed = 0
|
||||
min_print_speed = 15
|
||||
slowdown_below_layer_time = 10
|
||||
start_filament_gcode = "; Filament gcode\nSET_GCODE_OFFSET Z=0.0\n\n{if nozzle_diameter[0]==0.4} SET_PRESSURE_ADVANCE ADVANCE=0.045{elsif nozzle_diameter[0]==0.6}SET_PRESSURE_ADVANCE ADVANCE=0.02{endif}\n\n"
|
||||
temperature = 270
|
||||
temperature = 270
|
||||
|
||||
[filament:Generic TPU @RatRig]
|
||||
inherits = Generic PLA @RatRig
|
||||
bed_temperature = 30
|
||||
bridge_fan_speed = 100
|
||||
bridge_internal_fan_speed = -1
|
||||
chamber_temperature = 0
|
||||
compatible_printers =
|
||||
compatible_printers_condition =
|
||||
compatible_prints =
|
||||
compatible_prints_condition =
|
||||
cooling = 1
|
||||
disable_fan_first_layers = 2
|
||||
end_filament_gcode = "; Filament-specific end gcode \n;END gcode for filament\n"
|
||||
external_perimeter_fan_speed = -1
|
||||
extrusion_multiplier = 0.89
|
||||
fan_always_on = 1
|
||||
fan_below_layer_time = 100
|
||||
filament_colour = #FF00FF
|
||||
filament_cooling_final_speed = 3.4
|
||||
filament_cooling_initial_speed = 2.2
|
||||
filament_cooling_moves = 4
|
||||
filament_cooling_zone_pause = 0
|
||||
filament_cost = 20
|
||||
filament_custom_variables = ""
|
||||
filament_density = 1.24
|
||||
filament_deretract_speed = nil
|
||||
filament_diameter = 1.75
|
||||
filament_dip_extraction_speed = 70
|
||||
filament_dip_insertion_speed = 33
|
||||
filament_enable_toolchange_part_fan = 0
|
||||
filament_enable_toolchange_temp = 0
|
||||
filament_load_time = 0
|
||||
filament_loading_speed = 28
|
||||
filament_loading_speed_start = 3
|
||||
filament_max_overlap = 100%
|
||||
filament_max_speed = 0
|
||||
filament_max_volumetric_speed = 5
|
||||
filament_max_wipe_tower_speed = 0
|
||||
filament_melt_zone_pause = 0
|
||||
filament_minimal_purge_on_wipe_tower = 15
|
||||
filament_notes = "This is a profile for TPU95A. It was tested with Anycubic TPU95A, but most of the economy TPU filaments behave pretty similar.\n\nYou will want to optimize the temperature. Even different colors of the same brand can require 10° more or less.\n\nIf you experience clogs or grinding, reduce the maximum volumetric speed!"
|
||||
filament_ramming_parameters = "120 100 6.6 6.8 7.2 7.6 7.9 8.2 8.7 9.4 9.9 10.0| 0.05 6.6 0.45 6.8 0.95 7.8 1.45 8.3 1.95 9.7 2.45 10 2.95 7.6 3.45 7.6 3.95 7.6 4.45 7.6 4.95 7.6"
|
||||
filament_retract_before_travel = nil
|
||||
filament_retract_before_wipe = nil
|
||||
filament_retract_layer_change = nil
|
||||
filament_retract_length = 1
|
||||
filament_retract_lift = 0.1
|
||||
filament_retract_lift_above = nil
|
||||
filament_retract_lift_below = nil
|
||||
filament_retract_restart_extra = nil
|
||||
filament_retract_speed = nil
|
||||
filament_seam_gap = nil
|
||||
filament_shrink = 100%
|
||||
filament_skinnydip_distance = 31
|
||||
filament_soluble = 0
|
||||
filament_spool_weight = 0
|
||||
filament_toolchange_delay = 0
|
||||
filament_toolchange_part_fan_speed = 50
|
||||
filament_toolchange_temp = 200
|
||||
filament_type = FLEX
|
||||
filament_unload_time = 0
|
||||
filament_unloading_speed = 90
|
||||
filament_unloading_speed_start = 100
|
||||
filament_use_fast_skinnydip = 0
|
||||
filament_use_skinnydip = 0
|
||||
filament_vendor = Generic
|
||||
filament_wipe = nil
|
||||
filament_wipe_advanced_pigment = 0.5
|
||||
filament_wipe_extra_perimeter = nil
|
||||
filament_wipe_only_crossing = nil
|
||||
filament_wipe_speed = nil
|
||||
first_layer_bed_temperature = 30
|
||||
first_layer_temperature = 220
|
||||
full_fan_speed_layer = 4
|
||||
max_fan_speed = 100
|
||||
max_speed_reduction = 95%
|
||||
min_fan_speed = 100
|
||||
min_print_speed = 10
|
||||
slowdown_below_layer_time = 8
|
||||
start_filament_gcode = "; Filament gcode\nSET_GCODE_OFFSET Z=0\nSET_PRESSURE_ADVANCE ADVANCE=0.1"
|
||||
temperature = 220
|
||||
top_fan_speed = -1
|
||||
|
@ -83,6 +83,13 @@ public:
|
||||
// to split around.
|
||||
template<typename SourceNode>
|
||||
void build(std::vector<SourceNode> &&input)
|
||||
{
|
||||
this->build_modify_input(input);
|
||||
input.clear();
|
||||
}
|
||||
|
||||
template<typename SourceNode>
|
||||
void build_modify_input(std::vector<SourceNode> &input)
|
||||
{
|
||||
if (input.empty())
|
||||
clear();
|
||||
@ -91,7 +98,6 @@ public:
|
||||
m_nodes.assign(next_highest_power_of_2(input.size()) * 2 - 1, Node());
|
||||
build_recursive(input, 0, 0, input.size() - 1);
|
||||
}
|
||||
input.clear();
|
||||
}
|
||||
|
||||
const std::vector<Node>& nodes() const { return m_nodes; }
|
||||
|
@ -710,6 +710,8 @@ Slic3r::Polylines diff_pl(const Slic3r::Polygons &subject, const Slic3r::Polygon
|
||||
{ return _clipper_pl_closed(ClipperLib::ctDifference, ClipperUtils::PolygonsProvider(subject), ClipperUtils::PolygonsProvider(clip)); }
|
||||
Slic3r::Polylines intersection_pl(const Slic3r::Polylines &subject, const Slic3r::Polygon &clip)
|
||||
{ return _clipper_pl_open(ClipperLib::ctIntersection, ClipperUtils::PolylinesProvider(subject), ClipperUtils::SinglePathProvider(clip.points)); }
|
||||
Slic3r::Polylines intersection_pl(const Slic3r::Polyline &subject, const Slic3r::ExPolygon &clip)
|
||||
{ return _clipper_pl_open(ClipperLib::ctIntersection, ClipperUtils::SinglePathProvider(subject.points), ClipperUtils::ExPolygonProvider(clip)); }
|
||||
Slic3r::Polylines intersection_pl(const Slic3r::Polylines &subject, const Slic3r::ExPolygon &clip)
|
||||
{ return _clipper_pl_open(ClipperLib::ctIntersection, ClipperUtils::PolylinesProvider(subject), ClipperUtils::ExPolygonProvider(clip)); }
|
||||
Slic3r::Polylines intersection_pl(const Slic3r::Polyline &subject, const Slic3r::Polygons &clip)
|
||||
|
@ -437,6 +437,7 @@ Slic3r::ExPolygons intersection_ex(const Slic3r::Surfaces &subject, const Slic3r
|
||||
Slic3r::ExPolygons intersection_ex(const Slic3r::Surfaces &subject, const Slic3r::Surfaces &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No);
|
||||
Slic3r::ExPolygons intersection_ex(const Slic3r::SurfacesPtr &subject, const Slic3r::ExPolygons &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No);
|
||||
Slic3r::Polylines intersection_pl(const Slic3r::Polylines &subject, const Slic3r::Polygon &clip);
|
||||
Slic3r::Polylines intersection_pl(const Slic3r::Polyline &subject, const Slic3r::ExPolygon &clip);
|
||||
Slic3r::Polylines intersection_pl(const Slic3r::Polylines &subject, const Slic3r::ExPolygon &clip);
|
||||
Slic3r::Polylines intersection_pl(const Slic3r::Polyline &subject, const Slic3r::Polygons &clip);
|
||||
Slic3r::Polylines intersection_pl(const Slic3r::Polyline &subject, const Slic3r::ExPolygons &clip);
|
||||
|
@ -6,6 +6,66 @@
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class InfillPolylineClipper : public FillPlanePath::InfillPolylineOutput {
|
||||
public:
|
||||
InfillPolylineClipper(const BoundingBox bbox, const double scale_out) : FillPlanePath::InfillPolylineOutput(scale_out), m_bbox(bbox) {}
|
||||
|
||||
void add_point(const Vec2d &pt);
|
||||
Points&& result() { return std::move(m_out); }
|
||||
bool clips() const override { return true; }
|
||||
|
||||
private:
|
||||
enum class Side {
|
||||
Left = 1,
|
||||
Right = 2,
|
||||
Top = 4,
|
||||
Bottom = 8
|
||||
};
|
||||
|
||||
int sides(const Point &p) const {
|
||||
return int(p.x() < m_bbox.min.x()) * int(Side::Left) +
|
||||
int(p.x() > m_bbox.max.x()) * int(Side::Right) +
|
||||
int(p.y() < m_bbox.min.y()) * int(Side::Bottom) +
|
||||
int(p.y() > m_bbox.max.y()) * int(Side::Top);
|
||||
};
|
||||
|
||||
// Bounding box to clip the polyline with.
|
||||
BoundingBox m_bbox;
|
||||
|
||||
// Classification of the two last points processed.
|
||||
int m_sides_prev;
|
||||
int m_sides_this;
|
||||
};
|
||||
|
||||
void InfillPolylineClipper::add_point(const Vec2d &fpt)
|
||||
{
|
||||
const Point pt{ this->scaled(fpt) };
|
||||
|
||||
if (m_out.size() < 2) {
|
||||
// Collect the two first points and their status.
|
||||
(m_out.empty() ? m_sides_prev : m_sides_this) = sides(pt);
|
||||
m_out.emplace_back(pt);
|
||||
} else {
|
||||
// Classify the last inserted point, possibly remove it.
|
||||
int sides_next = sides(pt);
|
||||
if (// This point is inside. Take it.
|
||||
m_sides_this == 0 ||
|
||||
// Either this point is outside and previous or next is inside, or
|
||||
// the edge possibly cuts corner of the bounding box.
|
||||
(m_sides_prev & m_sides_this & sides_next) == 0) {
|
||||
// Keep the last point.
|
||||
m_sides_prev = m_sides_this;
|
||||
} else {
|
||||
// All the three points (this, prev, next) are outside at the same side.
|
||||
// Ignore the last point.
|
||||
m_out.pop_back();
|
||||
}
|
||||
// And save the current point.
|
||||
m_out.emplace_back(pt);
|
||||
m_sides_this = sides_next;
|
||||
}
|
||||
}
|
||||
|
||||
void FillPlanePath::_fill_surface_single(
|
||||
const FillParams ¶ms,
|
||||
unsigned int thickness_layers,
|
||||
@ -13,37 +73,52 @@ void FillPlanePath::_fill_surface_single(
|
||||
ExPolygon expolygon,
|
||||
Polylines &polylines_out)
|
||||
{
|
||||
expolygon.rotate(- direction.first);
|
||||
expolygon.rotate(-direction.first);
|
||||
|
||||
coord_t distance_between_lines = coord_t(scale_(this->spacing) / params.density);
|
||||
|
||||
// align infill across layers using the object's bounding box
|
||||
// Rotated bounding box of the whole object.
|
||||
BoundingBox bounding_box = this->bounding_box.rotated(- direction.first);
|
||||
|
||||
Point shift = this->_centered() ?
|
||||
//FIXME Vojtech: We are not sure whether the user expects the fill patterns on visible surfaces to be aligned across all the islands of a single layer.
|
||||
// One may align for this->centered() to align the patterns for Archimedean Chords and Octagram Spiral patterns.
|
||||
const bool align = params.density < 0.995;
|
||||
|
||||
BoundingBox snug_bounding_box = get_extents(expolygon).inflated(SCALED_EPSILON);
|
||||
|
||||
// Rotated bounding box of the area to fill in with the pattern.
|
||||
BoundingBox bounding_box = align ?
|
||||
// Sparse infill needs to be aligned across layers. Align infill across layers using the object's bounding box.
|
||||
this->bounding_box.rotated(-direction.first) :
|
||||
// Solid infill does not need to be aligned across layers, generate the infill pattern
|
||||
// around the clipping expolygon only.
|
||||
snug_bounding_box;
|
||||
|
||||
Point shift = this->centered() ?
|
||||
bounding_box.center() :
|
||||
bounding_box.min;
|
||||
expolygon.translate(-shift.x(), -shift.y());
|
||||
bounding_box.translate(-shift.x(), -shift.y());
|
||||
|
||||
Pointfs pts = _generate(
|
||||
coord_t(ceil(coordf_t(bounding_box.min.x()) / distance_between_lines)),
|
||||
coord_t(ceil(coordf_t(bounding_box.min.y()) / distance_between_lines)),
|
||||
coord_t(ceil(coordf_t(bounding_box.max.x()) / distance_between_lines)),
|
||||
coord_t(ceil(coordf_t(bounding_box.max.y()) / distance_between_lines)),
|
||||
params.resolution);
|
||||
Polyline polyline;
|
||||
{
|
||||
auto distance_between_lines = scaled<double>(this->spacing) / params.density;
|
||||
auto min_x = coord_t(ceil(coordf_t(bounding_box.min.x()) / distance_between_lines));
|
||||
auto min_y = coord_t(ceil(coordf_t(bounding_box.min.y()) / distance_between_lines));
|
||||
auto max_x = coord_t(ceil(coordf_t(bounding_box.max.x()) / distance_between_lines));
|
||||
auto max_y = coord_t(ceil(coordf_t(bounding_box.max.y()) / distance_between_lines));
|
||||
auto resolution = scaled<double>(params.resolution) / distance_between_lines;
|
||||
if (align) {
|
||||
// Filling in a bounding box over the whole object, clip generated polyline against the snug bounding box.
|
||||
snug_bounding_box.translate(-shift.x(), -shift.y());
|
||||
InfillPolylineClipper output(snug_bounding_box, distance_between_lines);
|
||||
this->generate(min_x, min_y, max_x, max_y, resolution, output);
|
||||
polyline.points = std::move(output.result());
|
||||
} else {
|
||||
// Filling in a snug bounding box, no need to clip.
|
||||
InfillPolylineOutput output(distance_between_lines);
|
||||
this->generate(min_x, min_y, max_x, max_y, resolution, output);
|
||||
polyline.points = std::move(output.result());
|
||||
}
|
||||
}
|
||||
|
||||
if (pts.size() >= 2) {
|
||||
// Convert points to a polyline, upscale.
|
||||
Polylines polylines(1, Polyline());
|
||||
Polyline &polyline = polylines.front();
|
||||
polyline.points.reserve(pts.size());
|
||||
for (const Vec2d &pt : pts)
|
||||
polyline.points.emplace_back(
|
||||
coord_t(floor(pt.x() * distance_between_lines + 0.5)),
|
||||
coord_t(floor(pt.y() * distance_between_lines + 0.5)));
|
||||
polylines = intersection_pl(polylines, expolygon);
|
||||
if (polyline.size() >= 2) {
|
||||
Polylines polylines = intersection_pl(polyline, expolygon);
|
||||
Polylines chained;
|
||||
if (params.dont_connect() || params.density > 0.5 || polylines.size() <= 1)
|
||||
chained = chain_polylines(std::move(polylines));
|
||||
@ -59,7 +134,8 @@ void FillPlanePath::_fill_surface_single(
|
||||
}
|
||||
|
||||
// Follow an Archimedean spiral, in polar coordinates: r=a+b\theta
|
||||
Pointfs FillArchimedeanChords::_generate(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, const double resolution)
|
||||
template<typename Output>
|
||||
static void generate_archimedean_chords(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, const double resolution, Output &output)
|
||||
{
|
||||
// Radius to achieve.
|
||||
coordf_t rmax = std::sqrt(coordf_t(max_x)*coordf_t(max_x)+coordf_t(max_y)*coordf_t(max_y)) * std::sqrt(2.) + 1.5;
|
||||
@ -70,15 +146,22 @@ Pointfs FillArchimedeanChords::_generate(coord_t min_x, coord_t min_y, coord_t m
|
||||
coordf_t r = 1;
|
||||
Pointfs out;
|
||||
//FIXME Vojtech: If used as a solid infill, there is a gap left at the center.
|
||||
out.emplace_back(0, 0);
|
||||
out.emplace_back(1, 0);
|
||||
output.add_point({ 0, 0 });
|
||||
output.add_point({ 1, 0 });
|
||||
while (r < rmax) {
|
||||
// Discretization angle to achieve a discretization error lower than resolution.
|
||||
theta += 2. * acos(1. - resolution / r);
|
||||
r = a + b * theta;
|
||||
out.emplace_back(r * cos(theta), r * sin(theta));
|
||||
output.add_point({ r * cos(theta), r * sin(theta) });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
void FillArchimedeanChords::generate(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, const double resolution, InfillPolylineOutput &output)
|
||||
{
|
||||
if (output.clips())
|
||||
generate_archimedean_chords(min_x, min_y, max_x, max_y, resolution, static_cast<InfillPolylineClipper&>(output));
|
||||
else
|
||||
generate_archimedean_chords(min_x, min_y, max_x, max_y, resolution, output);
|
||||
}
|
||||
|
||||
// Adapted from
|
||||
@ -126,7 +209,8 @@ static inline Point hilbert_n_to_xy(const size_t n)
|
||||
return Point(x, y);
|
||||
}
|
||||
|
||||
Pointfs FillHilbertCurve::_generate(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, const double /* resolution */)
|
||||
template<typename Output>
|
||||
static void generate_hilbert_curve(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, Output &output)
|
||||
{
|
||||
// Minimum power of two square to fit the domain.
|
||||
size_t sz = 2;
|
||||
@ -140,46 +224,59 @@ Pointfs FillHilbertCurve::_generate(coord_t min_x, coord_t min_y, coord_t max_x,
|
||||
}
|
||||
|
||||
size_t sz2 = sz * sz;
|
||||
Pointfs line;
|
||||
line.reserve(sz2);
|
||||
output.reserve(sz2);
|
||||
for (size_t i = 0; i < sz2; ++ i) {
|
||||
Point p = hilbert_n_to_xy(i);
|
||||
line.emplace_back(p.x() + min_x, p.y() + min_y);
|
||||
output.add_point({ p.x() + min_x, p.y() + min_y });
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
Pointfs FillOctagramSpiral::_generate(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, const double /* resolution */)
|
||||
void FillHilbertCurve::generate(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, const double /* resolution */, InfillPolylineOutput &output)
|
||||
{
|
||||
if (output.clips())
|
||||
generate_hilbert_curve(min_x, min_y, max_x, max_y, static_cast<InfillPolylineClipper&>(output));
|
||||
else
|
||||
generate_hilbert_curve(min_x, min_y, max_x, max_y, output);
|
||||
}
|
||||
|
||||
template<typename Output>
|
||||
static void generate_octagram_spiral(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, Output &output)
|
||||
{
|
||||
// Radius to achieve.
|
||||
coordf_t rmax = std::sqrt(coordf_t(max_x)*coordf_t(max_x)+coordf_t(max_y)*coordf_t(max_y)) * std::sqrt(2.) + 1.5;
|
||||
// Now unwind the spiral.
|
||||
coordf_t r = 0;
|
||||
coordf_t r_inc = sqrt(2.);
|
||||
Pointfs out;
|
||||
out.emplace_back(0., 0.);
|
||||
output.add_point({ 0., 0. });
|
||||
while (r < rmax) {
|
||||
r += r_inc;
|
||||
coordf_t rx = r / sqrt(2.);
|
||||
coordf_t r2 = r + rx;
|
||||
out.emplace_back( r, 0.);
|
||||
out.emplace_back( r2, rx);
|
||||
out.emplace_back( rx, rx);
|
||||
out.emplace_back( rx, r2);
|
||||
out.emplace_back( 0., r);
|
||||
out.emplace_back(-rx, r2);
|
||||
out.emplace_back(-rx, rx);
|
||||
out.emplace_back(-r2, rx);
|
||||
out.emplace_back(- r, 0.);
|
||||
out.emplace_back(-r2, -rx);
|
||||
out.emplace_back(-rx, -rx);
|
||||
out.emplace_back(-rx, -r2);
|
||||
out.emplace_back( 0., -r);
|
||||
out.emplace_back( rx, -r2);
|
||||
out.emplace_back( rx, -rx);
|
||||
out.emplace_back( r2+r_inc, -rx);
|
||||
output.add_point({ r, 0. });
|
||||
output.add_point({ r2, rx });
|
||||
output.add_point({ rx, rx });
|
||||
output.add_point({ rx, r2 });
|
||||
output.add_point({ 0., r });
|
||||
output.add_point({-rx, r2 });
|
||||
output.add_point({-rx, rx });
|
||||
output.add_point({-r2, rx });
|
||||
output.add_point({- r, 0. });
|
||||
output.add_point({-r2, -rx });
|
||||
output.add_point({-rx, -rx });
|
||||
output.add_point({-rx, -r2 });
|
||||
output.add_point({ 0., -r });
|
||||
output.add_point({ rx, -r2 });
|
||||
output.add_point({ rx, -rx });
|
||||
output.add_point({ r2+r_inc, -rx });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
void FillOctagramSpiral::generate(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, const double /* resolution */, InfillPolylineOutput &output)
|
||||
{
|
||||
if (output.clips())
|
||||
generate_octagram_spiral(min_x, min_y, max_x, max_y, static_cast<InfillPolylineClipper&>(output));
|
||||
else
|
||||
generate_octagram_spiral(min_x, min_y, max_x, max_y, output);
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
@ -27,8 +27,30 @@ protected:
|
||||
Polylines &polylines_out) override;
|
||||
|
||||
float _layer_angle(size_t idx) const override { return 0.f; }
|
||||
virtual bool _centered() const = 0;
|
||||
virtual Pointfs _generate(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, const double resolution) = 0;
|
||||
virtual bool centered() const = 0;
|
||||
|
||||
friend class InfillPolylineClipper;
|
||||
class InfillPolylineOutput {
|
||||
public:
|
||||
InfillPolylineOutput(const double scale_out) : m_scale_out(scale_out) {}
|
||||
|
||||
void reserve(size_t n) { m_out.reserve(n); }
|
||||
void add_point(const Vec2d& pt) { m_out.emplace_back(this->scaled(pt)); }
|
||||
Points&& result() { return std::move(m_out); }
|
||||
virtual bool clips() const { return false; }
|
||||
|
||||
protected:
|
||||
const Point scaled(const Vec2d &fpt) const { return { coord_t(floor(fpt.x() * m_scale_out + 0.5)), coord_t(floor(fpt.y() * m_scale_out + 0.5)) }; }
|
||||
|
||||
// Output polyline.
|
||||
Points m_out;
|
||||
|
||||
private:
|
||||
// Scaling coefficient of the generated points before tested against m_bbox and clipped by bbox.
|
||||
double m_scale_out;
|
||||
};
|
||||
|
||||
virtual void generate(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, const double resolution, InfillPolylineOutput &output) = 0;
|
||||
};
|
||||
|
||||
class FillArchimedeanChords : public FillPlanePath
|
||||
@ -38,8 +60,8 @@ public:
|
||||
~FillArchimedeanChords() override = default;
|
||||
|
||||
protected:
|
||||
bool _centered() const override { return true; }
|
||||
Pointfs _generate(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, const double resolution) override;
|
||||
bool centered() const override { return true; }
|
||||
void generate(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, const double resolution, InfillPolylineOutput &output) override;
|
||||
};
|
||||
|
||||
class FillHilbertCurve : public FillPlanePath
|
||||
@ -49,8 +71,8 @@ public:
|
||||
~FillHilbertCurve() override = default;
|
||||
|
||||
protected:
|
||||
bool _centered() const override { return false; }
|
||||
Pointfs _generate(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, const double resolution) override;
|
||||
bool centered() const override { return false; }
|
||||
void generate(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, const double resolution, InfillPolylineOutput &output) override;
|
||||
};
|
||||
|
||||
class FillOctagramSpiral : public FillPlanePath
|
||||
@ -60,8 +82,8 @@ public:
|
||||
~FillOctagramSpiral() override = default;
|
||||
|
||||
protected:
|
||||
bool _centered() const override { return true; }
|
||||
Pointfs _generate(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, const double resolution) override;
|
||||
bool centered() const override { return true; }
|
||||
void generate(coord_t min_x, coord_t min_y, coord_t max_x, coord_t max_y, const double resolution, InfillPolylineOutput &output) override;
|
||||
};
|
||||
|
||||
} // namespace Slic3r
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "GCode/WipeTower.hpp"
|
||||
#include "ShortestPath.hpp"
|
||||
#include "Print.hpp"
|
||||
#include "Thread.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "ClipperUtils.hpp"
|
||||
#include "libslic3r.h"
|
||||
@ -34,8 +35,6 @@
|
||||
#include "SVG.hpp"
|
||||
|
||||
#include <tbb/parallel_for.h>
|
||||
#include <tbb/task_scheduler_observer.h>
|
||||
#include <tbb/enumerable_thread_specific.h>
|
||||
|
||||
// Intel redesigned some TBB interface considerably when merging TBB with their oneAPI set of libraries, see GH #7332.
|
||||
// We are using quite an old TBB 2017 U7. Before we update our build servers, let's use the old API, which is deprecated in up to date TBB.
|
||||
@ -1469,32 +1468,6 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||
print.throw_if_canceled();
|
||||
}
|
||||
|
||||
// For unknown reasons and in sporadic cases when GCode export is processing, some participating thread
|
||||
// in tbb::parallel_pipeline has not set locales to "C", probably because this thread is newly spawned.
|
||||
// So in this class method on_scheduler_entry is called for every thread before it starts participating
|
||||
// in tbb::parallel_pipeline to ensure that locales are set correctly
|
||||
|
||||
// For tbb::parallel_pipeline, it seems that on_scheduler_entry is called for every layer and every filter.
|
||||
// We ensure using thread-local storage that locales will be set to "C" just once for any participating thread.
|
||||
class TBBLocalesSetter : public tbb::task_scheduler_observer
|
||||
{
|
||||
public:
|
||||
TBBLocalesSetter() { this->observe(true); }
|
||||
~TBBLocalesSetter() override { this->observe(false); };
|
||||
|
||||
void on_scheduler_entry(bool is_worker) override
|
||||
{
|
||||
if (bool &is_locales_sets = m_is_locales_sets.local(); !is_locales_sets) {
|
||||
// Set locales of the worker thread to "C".
|
||||
set_c_locales();
|
||||
is_locales_sets = true;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
tbb::enumerable_thread_specific<bool, tbb::cache_aligned_allocator<bool>, tbb::ets_key_usage_type::ets_key_per_instance> m_is_locales_sets{false};
|
||||
};
|
||||
|
||||
// Process all layers of all objects (non-sequential mode) with a parallel pipeline:
|
||||
// Generate G-code, run the filters (vase mode, cooling buffer), run the G-code analyser
|
||||
// and export G-code into file.
|
||||
|
@ -199,9 +199,7 @@ void GCodeProcessor::TimeMachine::reset()
|
||||
max_travel_acceleration = 0.0f;
|
||||
extrude_factor_override_percentage = 1.0f;
|
||||
time = 0.0f;
|
||||
#if ENABLE_TRAVEL_TIME
|
||||
travel_time = 0.0f;
|
||||
#endif // ENABLE_TRAVEL_TIME
|
||||
stop_times = std::vector<StopTime>();
|
||||
curr.reset();
|
||||
prev.reset();
|
||||
@ -317,17 +315,12 @@ void GCodeProcessor::TimeMachine::calculate_time(size_t keep_last_n_blocks, floa
|
||||
block_time += additional_time;
|
||||
|
||||
time += block_time;
|
||||
#if ENABLE_TRAVEL_TIME
|
||||
if (block.move_type == EMoveType::Travel)
|
||||
travel_time += block_time;
|
||||
else
|
||||
roles_time[static_cast<size_t>(block.role)] += block_time;
|
||||
#endif // ENABLE_TRAVEL_TIME
|
||||
gcode_time.cache += block_time;
|
||||
moves_time[static_cast<size_t>(block.move_type)] += block_time;
|
||||
#if !ENABLE_TRAVEL_TIME
|
||||
roles_time[static_cast<size_t>(block.role)] += block_time;
|
||||
#endif // !ENABLE_TRAVEL_TIME
|
||||
if (block.layer_id >= layers_time.size()) {
|
||||
const size_t curr_size = layers_time.size();
|
||||
layers_time.resize(block.layer_id);
|
||||
@ -1465,7 +1458,6 @@ std::string GCodeProcessor::get_time_dhm(PrintEstimatedStatistics::ETimeMode mod
|
||||
return (mode < PrintEstimatedStatistics::ETimeMode::Count) ? short_time(get_time_dhms(m_time_processor.machines[static_cast<size_t>(mode)].time)) : std::string("N/A");
|
||||
}
|
||||
|
||||
#if ENABLE_TRAVEL_TIME
|
||||
float GCodeProcessor::get_travel_time(PrintEstimatedStatistics::ETimeMode mode) const
|
||||
{
|
||||
return (mode < PrintEstimatedStatistics::ETimeMode::Count) ? m_time_processor.machines[static_cast<size_t>(mode)].travel_time : 0.0f;
|
||||
@ -1475,7 +1467,6 @@ std::string GCodeProcessor::get_travel_time_dhm(PrintEstimatedStatistics::ETimeM
|
||||
{
|
||||
return (mode < PrintEstimatedStatistics::ETimeMode::Count) ? short_time(get_time_dhms(m_time_processor.machines[static_cast<size_t>(mode)].travel_time)) : std::string("N/A");
|
||||
}
|
||||
#endif // ENABLE_TRAVEL_TIME
|
||||
|
||||
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> GCodeProcessor::get_custom_gcode_times(PrintEstimatedStatistics::ETimeMode mode, bool include_remaining) const
|
||||
{
|
||||
@ -1769,7 +1760,7 @@ void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line, bool
|
||||
switch (cmd[1]) {
|
||||
case '1':
|
||||
switch (cmd[2]) {
|
||||
case '0': { process_G10(line); break; } // Retract
|
||||
case '0': { process_G10(line); break; } // Retract or Set tool temperature
|
||||
case '1': { process_G11(line); break; } // Unretract
|
||||
default: break;
|
||||
}
|
||||
@ -3232,6 +3223,23 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool cloc
|
||||
|
||||
void GCodeProcessor::process_G10(const GCodeReader::GCodeLine& line)
|
||||
{
|
||||
if (m_flavor == gcfRepRapFirmware) {
|
||||
// similar to M104/M109
|
||||
float new_temp;
|
||||
if (line.has_value('S', new_temp)) {
|
||||
size_t id = m_extruder_id;
|
||||
float val;
|
||||
if (line.has_value('P', val)) {
|
||||
const size_t eid = static_cast<size_t>(val);
|
||||
if (eid < m_extruder_temps.size())
|
||||
id = eid;
|
||||
}
|
||||
|
||||
m_extruder_temps[id] = new_temp;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// stores retract move
|
||||
store_move_vertex(EMoveType::Retract);
|
||||
}
|
||||
@ -3441,18 +3449,22 @@ void GCodeProcessor::process_M108(const GCodeReader::GCodeLine& line)
|
||||
void GCodeProcessor::process_M109(const GCodeReader::GCodeLine& line)
|
||||
{
|
||||
float new_temp;
|
||||
size_t id = (size_t)-1;
|
||||
if (line.has_value('R', new_temp)) {
|
||||
float val;
|
||||
if (line.has_value('T', val)) {
|
||||
const size_t eid = static_cast<size_t>(val);
|
||||
if (eid < m_extruder_temps.size())
|
||||
m_extruder_temps[eid] = new_temp;
|
||||
id = eid;
|
||||
}
|
||||
else
|
||||
m_extruder_temps[m_extruder_id] = new_temp;
|
||||
id = m_extruder_id;
|
||||
}
|
||||
else if (line.has_value('S', new_temp))
|
||||
m_extruder_temps[m_extruder_id] = new_temp;
|
||||
id = m_extruder_id;
|
||||
|
||||
if (id != (size_t)-1)
|
||||
m_extruder_temps[id] = new_temp;
|
||||
}
|
||||
|
||||
void GCodeProcessor::process_M132(const GCodeReader::GCodeLine& line)
|
||||
@ -4306,9 +4318,7 @@ void GCodeProcessor::update_estimated_times_stats()
|
||||
auto update_mode = [this](PrintEstimatedStatistics::ETimeMode mode) {
|
||||
PrintEstimatedStatistics::Mode& data = m_result.print_statistics.modes[static_cast<size_t>(mode)];
|
||||
data.time = get_time(mode);
|
||||
#if ENABLE_TRAVEL_TIME
|
||||
data.travel_time = get_travel_time(mode);
|
||||
#endif // ENABLE_TRAVEL_TIME
|
||||
data.custom_gcode_times = get_custom_gcode_times(mode, true);
|
||||
data.moves_times = get_moves_time(mode);
|
||||
data.roles_times = get_roles_time(mode);
|
||||
|
@ -44,9 +44,7 @@ namespace Slic3r {
|
||||
struct Mode
|
||||
{
|
||||
float time;
|
||||
#if ENABLE_TRAVEL_TIME
|
||||
float travel_time;
|
||||
#endif // ENABLE_TRAVEL_TIME
|
||||
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> custom_gcode_times;
|
||||
std::vector<std::pair<EMoveType, float>> moves_times;
|
||||
std::vector<std::pair<ExtrusionRole, float>> roles_times;
|
||||
@ -54,9 +52,7 @@ namespace Slic3r {
|
||||
|
||||
void reset() {
|
||||
time = 0.0f;
|
||||
#if ENABLE_TRAVEL_TIME
|
||||
travel_time = 0.0f;
|
||||
#endif // ENABLE_TRAVEL_TIME
|
||||
custom_gcode_times.clear();
|
||||
moves_times.clear();
|
||||
roles_times.clear();
|
||||
@ -307,9 +303,7 @@ namespace Slic3r {
|
||||
float max_travel_acceleration; // mm/s^2
|
||||
float extrude_factor_override_percentage;
|
||||
float time; // s
|
||||
#if ENABLE_TRAVEL_TIME
|
||||
float travel_time; // s
|
||||
#endif // ENABLE_TRAVEL_TIME
|
||||
struct StopTime
|
||||
{
|
||||
unsigned int g1_line_id;
|
||||
@ -635,10 +629,8 @@ namespace Slic3r {
|
||||
|
||||
float get_time(PrintEstimatedStatistics::ETimeMode mode) const;
|
||||
std::string get_time_dhm(PrintEstimatedStatistics::ETimeMode mode) const;
|
||||
#if ENABLE_TRAVEL_TIME
|
||||
float get_travel_time(PrintEstimatedStatistics::ETimeMode mode) const;
|
||||
std::string get_travel_time_dhm(PrintEstimatedStatistics::ETimeMode mode) const;
|
||||
#endif // ENABLE_TRAVEL_TIME
|
||||
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> get_custom_gcode_times(PrintEstimatedStatistics::ETimeMode mode, bool include_remaining) const;
|
||||
|
||||
std::vector<std::pair<EMoveType, float>> get_moves_time(PrintEstimatedStatistics::ETimeMode mode) const;
|
||||
@ -674,7 +666,7 @@ namespace Slic3r {
|
||||
void process_G2_G3(const GCodeReader::GCodeLine& line, bool clockwise);
|
||||
#endif // ENABLE_PROCESS_G2_G3_LINES
|
||||
|
||||
// Retract
|
||||
// Retract or Set tool temperature
|
||||
void process_G10(const GCodeReader::GCodeLine& line);
|
||||
|
||||
// Unretract
|
||||
|
@ -1619,7 +1619,7 @@ void ModelObject::split(ModelObjectPtrs* new_objects)
|
||||
size_t counter = 1;
|
||||
for (TriangleMesh &mesh : meshes) {
|
||||
// FIXME: crashes if not satisfied
|
||||
if (mesh.facets_count() < 3)
|
||||
if (mesh.facets_count() < 3 || mesh.has_zero_volume())
|
||||
continue;
|
||||
|
||||
// XXX: this seems to be the only real usage of m_model, maybe refactor this so that it's not needed?
|
||||
@ -2093,7 +2093,7 @@ size_t ModelVolume::split(unsigned int max_extruders)
|
||||
const Vec3d offset = this->get_offset();
|
||||
|
||||
for (TriangleMesh &mesh : meshes) {
|
||||
if (mesh.empty())
|
||||
if (mesh.empty() || mesh.has_zero_volume())
|
||||
// Repair may have removed unconnected triangles, thus emptying the mesh.
|
||||
continue;
|
||||
|
||||
|
@ -2198,8 +2198,7 @@ void PrintObject::combine_infill()
|
||||
void PrintObject::_generate_support_material()
|
||||
{
|
||||
if (m_config.support_material_style == smsTree) {
|
||||
TreeSupport tree_support;
|
||||
tree_support.generateSupportAreas(*this);
|
||||
fff_tree_support_generate(*this, std::function<void()>([this](){ this->throw_if_canceled(); }));
|
||||
} else {
|
||||
PrintObjectSupportMaterial support_material(this, m_slicing_params);
|
||||
support_material.generate(*this);
|
||||
|
@ -39,14 +39,6 @@
|
||||
//====================
|
||||
#define ENABLE_2_5_0_ALPHA1 1
|
||||
|
||||
// Enable changes in preview layout
|
||||
#define ENABLE_PREVIEW_LAYOUT (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable drawing the items in legend toolbar using icons
|
||||
#define ENABLE_LEGEND_TOOLBAR_ICONS (1 && ENABLE_PREVIEW_LAYOUT)
|
||||
// Enable coloring of toolpaths in preview by layer time
|
||||
#define ENABLE_PREVIEW_LAYER_TIME (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable showing time estimate for travel moves in legend
|
||||
#define ENABLE_TRAVEL_TIME (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable removal of wipe tower magic object_id equal to 1000
|
||||
#define ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable removal of legacy OpenGL calls
|
||||
@ -61,8 +53,6 @@
|
||||
#define ENABLE_GLMODEL_STATISTICS (0 && ENABLE_LEGACY_OPENGL_REMOVAL)
|
||||
// Enable rework of Reload from disk command
|
||||
#define ENABLE_RELOAD_FROM_DISK_REWORK (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable recalculating toolpaths when switching to/from volumetric rate visualization
|
||||
#define ENABLE_VOLUMETRIC_RATE_TOOLPATHS_RECALC (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable editing volumes transformation in world coordinates and instances in local coordinates
|
||||
#define ENABLE_WORLD_COORDINATE (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable modified camera control using mouse
|
||||
|
@ -4,6 +4,9 @@
|
||||
#else
|
||||
// any posix system
|
||||
#include <pthread.h>
|
||||
#ifdef __APPLE__
|
||||
#include <pthread/qos.h>
|
||||
#endif // __APPLE__
|
||||
#endif
|
||||
|
||||
#include <atomic>
|
||||
@ -241,4 +244,26 @@ void name_tbb_thread_pool_threads_set_locale()
|
||||
});
|
||||
}
|
||||
|
||||
void set_current_thread_qos()
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
// OSX specific: Set Quality of Service to "user initiated", so that the threads will be scheduled to high performance
|
||||
// cores if available.
|
||||
pthread_set_qos_class_self_np(QOS_CLASS_USER_INITIATED, 0);
|
||||
#endif // __APPLE__
|
||||
}
|
||||
|
||||
void TBBLocalesSetter::on_scheduler_entry(bool is_worker)
|
||||
{
|
||||
// static std::atomic<int> cnt = 0;
|
||||
// std::cout << "TBBLocalesSetter Entering " << cnt ++ << " ID " << std::this_thread::get_id() << "\n";
|
||||
if (bool& is_locales_sets = m_is_locales_sets.local(); !is_locales_sets) {
|
||||
// Set locales of the worker thread to "C".
|
||||
set_c_locales();
|
||||
// OSX specific: Elevate QOS on Apple Silicon.
|
||||
set_current_thread_qos();
|
||||
is_locales_sets = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,9 @@
|
||||
#include <thread>
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
#include <tbb/task_scheduler_observer.h>
|
||||
#include <tbb/enumerable_thread_specific.h>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
// Set / get thread name.
|
||||
@ -26,6 +29,10 @@ inline bool set_thread_name(boost::thread &thread, const std::string &thread_nam
|
||||
bool set_current_thread_name(const char *thread_name);
|
||||
inline bool set_current_thread_name(const std::string &thread_name) { return set_current_thread_name(thread_name.c_str()); }
|
||||
|
||||
// OSX specific: Set Quality of Service to "user initiated", so that the threads will be scheduled to high performance
|
||||
// cores if available.
|
||||
void set_current_thread_qos();
|
||||
|
||||
// Returns nullopt if not supported.
|
||||
// Not supported by OSX.
|
||||
// Naming threads is only supported on newer Windows 10.
|
||||
@ -53,6 +60,25 @@ template<class Fn> inline boost::thread create_thread(Fn &&fn)
|
||||
return create_thread(attrs, std::forward<Fn>(fn));
|
||||
}
|
||||
|
||||
// For unknown reasons and in sporadic cases when GCode export is processing, some participating thread
|
||||
// in tbb::parallel_pipeline has not set locales to "C", probably because this thread is newly spawned.
|
||||
// So in this class method on_scheduler_entry is called for every thread before it starts participating
|
||||
// in tbb::parallel_pipeline to ensure that locales are set correctly
|
||||
//
|
||||
// For tbb::parallel_pipeline, it seems that on_scheduler_entry is called for every layer and every filter.
|
||||
// We ensure using thread-local storage that locales will be set to "C" just once for any participating thread.
|
||||
class TBBLocalesSetter : public tbb::task_scheduler_observer
|
||||
{
|
||||
public:
|
||||
TBBLocalesSetter() { this->observe(true); }
|
||||
~TBBLocalesSetter() override { this->observe(false); };
|
||||
|
||||
void on_scheduler_entry(bool is_worker) override;
|
||||
|
||||
private:
|
||||
tbb::enumerable_thread_specific<bool, tbb::cache_aligned_allocator<bool>, tbb::ets_key_usage_type::ets_key_per_instance> m_is_locales_sets{ false };
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // GUI_THREAD_HPP
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <tbb/parallel_for.h>
|
||||
#include <tbb/task_group.h>
|
||||
|
||||
namespace Slic3r
|
||||
namespace Slic3r::FFFTreeSupport
|
||||
{
|
||||
|
||||
// or warning
|
||||
@ -106,7 +106,10 @@ TreeModelVolumes::TreeModelVolumes(
|
||||
const PrintObject &print_object,
|
||||
const BuildVolume &build_volume,
|
||||
const coord_t max_move, const coord_t max_move_slow, size_t current_mesh_idx,
|
||||
double progress_multiplier, double progress_offset, const std::vector<Polygons>& additional_excluded_areas) :
|
||||
#ifdef SLIC3R_TREESUPPORTS_PROGRESS
|
||||
double progress_multiplier, double progress_offset,
|
||||
#endif // SLIC3R_TREESUPPORTS_PROGRESS
|
||||
const std::vector<Polygons>& additional_excluded_areas) :
|
||||
// -2 to avoid rounding errors
|
||||
m_max_move{ std::max<coord_t>(max_move - 2, 0) }, m_max_move_slow{ std::max<coord_t>(max_move_slow - 2, 0) },
|
||||
#ifdef SLIC3R_TREESUPPORTS_PROGRESS
|
||||
@ -161,7 +164,7 @@ TreeModelVolumes::TreeModelVolumes(
|
||||
m_min_resolution = std::min(m_min_resolution, data_pair.first.resolution);
|
||||
}
|
||||
|
||||
const TreeSupport::TreeSupportSettings config{ m_layer_outlines[m_current_outline_idx].first };
|
||||
const TreeSupportSettings config{ m_layer_outlines[m_current_outline_idx].first };
|
||||
m_current_min_xy_dist = config.xy_min_distance;
|
||||
m_current_min_xy_dist_delta = config.xy_distance - m_current_min_xy_dist;
|
||||
assert(m_current_min_xy_dist_delta >= 0);
|
||||
@ -206,7 +209,7 @@ void TreeModelVolumes::precalculate(const coord_t max_layer)
|
||||
// Get the config corresponding to one mesh that is in the current group. Which one has to be irrelevant.
|
||||
// Not the prettiest way to do this, but it ensures some calculations that may be a bit more complex
|
||||
// like inital layer diameter are only done in once.
|
||||
TreeSupport::TreeSupportSettings config(m_layer_outlines[m_current_outline_idx].first);
|
||||
TreeSupportSettings config(m_layer_outlines[m_current_outline_idx].first);
|
||||
|
||||
{
|
||||
// calculate which radius each layer in the tip may have.
|
||||
@ -297,7 +300,7 @@ const Polygons& TreeModelVolumes::getCollision(const coord_t orig_radius, LayerI
|
||||
return (*result).get();
|
||||
if (m_precalculated) {
|
||||
BOOST_LOG_TRIVIAL(error_level_not_in_cache) << "Had to calculate collision at radius " << radius << " and layer " << layer_idx << ", but precalculate was called. Performance may suffer!";
|
||||
TreeSupport::showError("Not precalculated Collision requested.", false);
|
||||
tree_supports_show_error("Not precalculated Collision requested.", false);
|
||||
}
|
||||
const_cast<TreeModelVolumes*>(this)->calculateCollision(radius, layer_idx);
|
||||
return getCollision(orig_radius, layer_idx, min_xy_dist);
|
||||
@ -312,7 +315,7 @@ const Polygons& TreeModelVolumes::getCollisionHolefree(coord_t radius, LayerInde
|
||||
return (*result).get();
|
||||
if (m_precalculated) {
|
||||
BOOST_LOG_TRIVIAL(error_level_not_in_cache) << "Had to calculate collision holefree at radius " << radius << " and layer " << layer_idx << ", but precalculate was called. Performance may suffer!";
|
||||
TreeSupport::showError("Not precalculated Holefree Collision requested.", false);
|
||||
tree_supports_show_error("Not precalculated Holefree Collision requested.", false);
|
||||
}
|
||||
const_cast<TreeModelVolumes*>(this)->calculateCollisionHolefree({ radius, layer_idx });
|
||||
return getCollisionHolefree(radius, layer_idx);
|
||||
@ -336,10 +339,10 @@ const Polygons& TreeModelVolumes::getAvoidance(const coord_t orig_radius, LayerI
|
||||
if (m_precalculated) {
|
||||
if (to_model) {
|
||||
BOOST_LOG_TRIVIAL(error_level_not_in_cache) << "Had to calculate Avoidance to model at radius " << radius << " and layer " << layer_idx << ", but precalculate was called. Performance may suffer!";
|
||||
TreeSupport::showError("Not precalculated Avoidance(to model) requested.", false);
|
||||
tree_supports_show_error("Not precalculated Avoidance(to model) requested.", false);
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(error_level_not_in_cache) << "Had to calculate Avoidance at radius " << radius << " and layer " << layer_idx << ", but precalculate was called. Performance may suffer!";
|
||||
TreeSupport::showError("Not precalculated Avoidance(to buildplate) requested.", false);
|
||||
tree_supports_show_error("Not precalculated Avoidance(to buildplate) requested.", false);
|
||||
}
|
||||
}
|
||||
const_cast<TreeModelVolumes*>(this)->calculateAvoidance({ radius, layer_idx }, ! to_model, to_model);
|
||||
@ -357,7 +360,7 @@ const Polygons& TreeModelVolumes::getPlaceableAreas(const coord_t orig_radius, L
|
||||
return (*result).get();
|
||||
if (m_precalculated) {
|
||||
BOOST_LOG_TRIVIAL(error_level_not_in_cache) << "Had to calculate Placeable Areas at radius " << radius << " and layer " << layer_idx << ", but precalculate was called. Performance may suffer!";
|
||||
TreeSupport::showError("Not precalculated Placeable areas requested.", false);
|
||||
tree_supports_show_error("Not precalculated Placeable areas requested.", false);
|
||||
}
|
||||
const_cast<TreeModelVolumes*>(this)->calculatePlaceables(radius, layer_idx);
|
||||
return getPlaceableAreas(orig_radius, layer_idx);
|
||||
@ -380,7 +383,7 @@ const Polygons& TreeModelVolumes::getWallRestriction(const coord_t orig_radius,
|
||||
return (*result).get();
|
||||
if (m_precalculated) {
|
||||
BOOST_LOG_TRIVIAL(error_level_not_in_cache) << "Had to calculate Wall restricions at radius " << radius << " and layer " << layer_idx << ", but precalculate was called. Performance may suffer!";
|
||||
TreeSupport::showError(
|
||||
tree_supports_show_error(
|
||||
min_xy_dist ?
|
||||
"Not precalculated Wall restriction of minimum xy distance requested )." :
|
||||
"Not precalculated Wall restriction requested )."
|
||||
@ -774,4 +777,4 @@ coord_t TreeModelVolumes::ceilRadius(const coord_t radius) const
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Slic3r::FFFTreeSupport
|
||||
|
@ -22,11 +22,14 @@
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
using LayerIndex = int;
|
||||
|
||||
class BuildVolume;
|
||||
class PrintObject;
|
||||
|
||||
namespace FFFTreeSupport
|
||||
{
|
||||
|
||||
using LayerIndex = int;
|
||||
|
||||
struct TreeSupportMeshGroupSettings {
|
||||
TreeSupportMeshGroupSettings() = default;
|
||||
explicit TreeSupportMeshGroupSettings(const PrintObject &print_object);
|
||||
@ -194,15 +197,19 @@ class TreeModelVolumes
|
||||
public:
|
||||
TreeModelVolumes() = default;
|
||||
explicit TreeModelVolumes(const PrintObject &print_object, const BuildVolume &build_volume,
|
||||
coord_t max_move, coord_t max_move_slow, size_t current_mesh_idx, double progress_multiplier,
|
||||
double progress_offset, const std::vector<Polygons> &additional_excluded_areas = {});
|
||||
coord_t max_move, coord_t max_move_slow, size_t current_mesh_idx,
|
||||
#ifdef SLIC3R_TREESUPPORTS_PROGRESS
|
||||
double progress_multiplier,
|
||||
double progress_offset,
|
||||
#endif // SLIC3R_TREESUPPORTS_PROGRESS
|
||||
const std::vector<Polygons> &additional_excluded_areas = {});
|
||||
TreeModelVolumes(TreeModelVolumes&&) = default;
|
||||
TreeModelVolumes& operator=(TreeModelVolumes&&) = default;
|
||||
|
||||
TreeModelVolumes(const TreeModelVolumes&) = delete;
|
||||
TreeModelVolumes& operator=(const TreeModelVolumes&) = delete;
|
||||
|
||||
enum class AvoidanceType
|
||||
enum class AvoidanceType : int8_t
|
||||
{
|
||||
Slow,
|
||||
FastSafe,
|
||||
@ -605,6 +612,7 @@ private:
|
||||
#endif // SLIC3R_TREESUPPORTS_PROGRESS
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace FFFTreeSupport
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif //slic3r_TreeModelVolumes_hpp
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -378,6 +378,14 @@ bool TriangleMesh::is_splittable() const
|
||||
return its_is_splittable(this->its);
|
||||
}
|
||||
|
||||
bool TriangleMesh::has_zero_volume() const
|
||||
{
|
||||
const Vec3d sz = size();
|
||||
const double volume_val = sz.x() * sz.y() * sz.z();
|
||||
|
||||
return is_approx(volume_val, 0.0);
|
||||
}
|
||||
|
||||
std::vector<TriangleMesh> TriangleMesh::split() const
|
||||
{
|
||||
std::vector<indexed_triangle_set> itss = its_split(this->its);
|
||||
|
@ -139,6 +139,7 @@ public:
|
||||
bool empty() const { return this->facets_count() == 0; }
|
||||
bool repaired() const;
|
||||
bool is_splittable() const;
|
||||
bool has_zero_volume() const;
|
||||
// Estimate of the memory occupied by this structure, important for keeping an eye on the Undo / Redo stack allocation.
|
||||
size_t memsize() const;
|
||||
|
||||
|
@ -111,7 +111,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.10</string>
|
||||
<string>10.12</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
|
@ -69,80 +69,7 @@ bool Version::is_current_slic3r_downgrade() const
|
||||
{
|
||||
return Slic3r::SEMVER < min_slic3r_version;
|
||||
}
|
||||
#if 0
|
||||
//TODO: This test should be moved to a unit test, once we have C++ unit tests in place.
|
||||
static int version_test()
|
||||
{
|
||||
Version v;
|
||||
v.config_version = *Semver::parse("1.1.2");
|
||||
v.min_slic3r_version = *Semver::parse("1.38.0");
|
||||
v.max_slic3r_version = Semver::inf();
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.38.0")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.38.0-alpha")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.37.0-alpha")));
|
||||
// Test the prerelease status.
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0")));
|
||||
v.config_version = *Semver::parse("1.1.2-alpha");
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.39.0")));
|
||||
v.config_version = *Semver::parse("1.1.2-alpha1");
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.39.0")));
|
||||
v.config_version = *Semver::parse("1.1.2-beta");
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.39.0-rc")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.39.0")));
|
||||
v.config_version = *Semver::parse("1.1.2-rc");
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-rc")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.39.0")));
|
||||
v.config_version = *Semver::parse("1.1.2-rc2");
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-rc")));
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.39.0")));
|
||||
// Test the upper boundary.
|
||||
v.config_version = *Semver::parse("1.1.2");
|
||||
v.max_slic3r_version = *Semver::parse("1.39.3-beta1");
|
||||
assert(v.is_slic3r_supported(*Semver::parse("1.38.0")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.38.0-alpha")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.38.0-alpha1")));
|
||||
assert(! v.is_slic3r_supported(*Semver::parse("1.37.0-alpha")));
|
||||
return 0;
|
||||
}
|
||||
static int version_test_run = version_test();
|
||||
#endif
|
||||
|
||||
|
||||
inline char* left_trim(char *c)
|
||||
{
|
||||
|
@ -211,6 +211,12 @@ void BackgroundSlicingProcess::thread_proc()
|
||||
set_current_thread_name("slic3r_BgSlcPcs");
|
||||
name_tbb_thread_pool_threads_set_locale();
|
||||
|
||||
// Set "C" locales and enforce OSX QoS level on all threads entering an arena.
|
||||
// The cost of the callback is quite low: The callback is called once per thread
|
||||
// entering a parallel loop and the callback is guarded with a thread local
|
||||
// variable to be executed just once.
|
||||
TBBLocalesSetter setter;
|
||||
|
||||
assert(m_print != nullptr);
|
||||
assert(m_print == m_fff_print || m_print == m_sla_print);
|
||||
std::unique_lock<std::mutex> lck(m_mutex);
|
||||
|
@ -34,8 +34,11 @@ void BitmapCache::clear()
|
||||
{
|
||||
for (std::pair<const std::string, wxBitmap*> &bitmap : m_map)
|
||||
delete bitmap.second;
|
||||
|
||||
m_map.clear();
|
||||
|
||||
for (std::pair<const std::string, wxBitmapBundle*> &bitmap_bundle : m_bndl_map)
|
||||
delete bitmap_bundle.second;
|
||||
m_bndl_map.clear();
|
||||
}
|
||||
|
||||
static wxBitmap wxImage_to_wxBitmap_with_alpha(wxImage &&image, float scale = 1.0f)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -220,11 +220,7 @@ class GCodeViewer
|
||||
unsigned char cp_color_id{ 0 };
|
||||
std::vector<Sub_Path> sub_paths;
|
||||
|
||||
#if ENABLE_VOLUMETRIC_RATE_TOOLPATHS_RECALC
|
||||
bool matches(const GCodeProcessorResult::MoveVertex& move, bool account_for_volumetric_rate) const;
|
||||
#else
|
||||
bool matches(const GCodeProcessorResult::MoveVertex& move) const;
|
||||
#endif // ENABLE_VOLUMETRIC_RATE_TOOLPATHS_RECALC
|
||||
size_t vertices_count() const {
|
||||
return sub_paths.empty() ? 0 : sub_paths.back().last.s_id - sub_paths.front().first.s_id + 1;
|
||||
}
|
||||
@ -436,13 +432,11 @@ class GCodeViewer
|
||||
{
|
||||
struct Range
|
||||
{
|
||||
#if ENABLE_PREVIEW_LAYER_TIME
|
||||
enum class EType : unsigned char
|
||||
{
|
||||
Linear,
|
||||
Logarithmic
|
||||
};
|
||||
#endif // ENABLE_PREVIEW_LAYER_TIME
|
||||
|
||||
float min;
|
||||
float max;
|
||||
@ -458,13 +452,8 @@ class GCodeViewer
|
||||
}
|
||||
void reset() { min = FLT_MAX; max = -FLT_MAX; count = 0; }
|
||||
|
||||
#if ENABLE_PREVIEW_LAYER_TIME
|
||||
float step_size(EType type = EType::Linear) const;
|
||||
ColorRGBA get_color_at(float value, EType type = EType::Linear) const;
|
||||
#else
|
||||
float step_size() const { return (max - min) / (static_cast<float>(Range_Colors.size()) - 1.0f); }
|
||||
ColorRGBA get_color_at(float value) const;
|
||||
#endif // ENABLE_PREVIEW_LAYER_TIME
|
||||
};
|
||||
|
||||
struct Ranges
|
||||
@ -481,10 +470,8 @@ class GCodeViewer
|
||||
Range volumetric_rate;
|
||||
// Color mapping by extrusion temperature.
|
||||
Range temperature;
|
||||
#if ENABLE_PREVIEW_LAYER_TIME
|
||||
// Color mapping by layer time.
|
||||
std::array<Range, static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count)> layer_time;
|
||||
#endif // ENABLE_PREVIEW_LAYER_TIME
|
||||
|
||||
void reset() {
|
||||
height.reset();
|
||||
@ -493,11 +480,9 @@ class GCodeViewer
|
||||
fan_speed.reset();
|
||||
volumetric_rate.reset();
|
||||
temperature.reset();
|
||||
#if ENABLE_PREVIEW_LAYER_TIME
|
||||
for (auto& range : layer_time) {
|
||||
range.reset();
|
||||
}
|
||||
#endif // ENABLE_PREVIEW_LAYER_TIME
|
||||
}
|
||||
};
|
||||
|
||||
@ -756,10 +741,8 @@ public:
|
||||
FanSpeed,
|
||||
Temperature,
|
||||
VolumetricRate,
|
||||
#if ENABLE_PREVIEW_LAYER_TIME
|
||||
LayerTimeLinear,
|
||||
LayerTimeLogarithmic,
|
||||
#endif // ENABLE_PREVIEW_LAYER_TIME
|
||||
Tool,
|
||||
ColorPrint,
|
||||
Count
|
||||
@ -768,9 +751,7 @@ public:
|
||||
private:
|
||||
bool m_gl_data_initialized{ false };
|
||||
unsigned int m_last_result_id{ 0 };
|
||||
#if ENABLE_VOLUMETRIC_RATE_TOOLPATHS_RECALC
|
||||
EViewType m_last_view_type{ EViewType::Count };
|
||||
#endif // ENABLE_VOLUMETRIC_RATE_TOOLPATHS_RECALC
|
||||
size_t m_moves_count{ 0 };
|
||||
std::vector<TBuffer> m_buffers{ static_cast<size_t>(EMoveType::Extrude) };
|
||||
// bounding box of toolpaths
|
||||
@ -792,14 +773,12 @@ private:
|
||||
COG m_cog;
|
||||
EViewType m_view_type{ EViewType::FeatureType };
|
||||
bool m_legend_enabled{ true };
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
struct LegendResizer
|
||||
{
|
||||
bool dirty{ true };
|
||||
void reset() { dirty = true; }
|
||||
};
|
||||
LegendResizer m_legend_resizer;
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
PrintEstimatedStatistics m_print_statistics;
|
||||
PrintEstimatedStatistics::ETimeMode m_time_estimate_mode{ PrintEstimatedStatistics::ETimeMode::Normal };
|
||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||
@ -807,9 +786,7 @@ private:
|
||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||
GCodeProcessorResult::SettingsIds m_settings_ids;
|
||||
std::array<SequentialRangeCap, 2> m_sequential_range_caps;
|
||||
#if ENABLE_PREVIEW_LAYER_TIME
|
||||
std::array<std::vector<float>, static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count)> m_layers_times;
|
||||
#endif // ENABLE_PREVIEW_LAYER_TIME
|
||||
|
||||
std::vector<CustomGCode::Item> m_custom_gcode_per_print_z;
|
||||
|
||||
@ -829,11 +806,7 @@ public:
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
// recalculate ranges in dependence of what is visible and sets tool/print colors
|
||||
void refresh(const GCodeProcessorResult& gcode_result, const std::vector<std::string>& str_tool_colors);
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
void refresh_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) const;
|
||||
#else
|
||||
void refresh_render_paths();
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
void update_shells_color_by_extruder(const DynamicPrintConfig* config);
|
||||
|
||||
void reset();
|
||||
@ -878,9 +851,7 @@ public:
|
||||
std::vector<CustomGCode::Item>& get_custom_gcode_per_print_z() { return m_custom_gcode_per_print_z; }
|
||||
size_t get_extruders_count() { return m_extruders_count; }
|
||||
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
void invalidate_legend() { m_legend_resizer.reset(); }
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
private:
|
||||
void load_toolpaths(const GCodeProcessorResult& gcode_result);
|
||||
@ -889,9 +860,6 @@ private:
|
||||
#else
|
||||
void load_shells(const Print& print, bool initialized);
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
void refresh_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) const;
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
void render_toolpaths();
|
||||
void render_shells();
|
||||
void render_legend(float& legend_height);
|
||||
|
@ -2512,21 +2512,12 @@ void GLCanvas3D::load_gcode_preview(const GCodeProcessorResult& gcode_result, co
|
||||
request_extra_frame();
|
||||
}
|
||||
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
void GLCanvas3D::refresh_gcode_preview_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last)
|
||||
{
|
||||
m_gcode_viewer.refresh_render_paths(keep_sequential_current_first, keep_sequential_current_last);
|
||||
set_as_dirty();
|
||||
request_extra_frame();
|
||||
}
|
||||
#else
|
||||
void GLCanvas3D::refresh_gcode_preview_render_paths()
|
||||
{
|
||||
m_gcode_viewer.refresh_render_paths();
|
||||
set_as_dirty();
|
||||
request_extra_frame();
|
||||
}
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
void GLCanvas3D::load_sla_preview()
|
||||
{
|
||||
@ -2833,15 +2824,8 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
||||
case 'k': { wxGetApp().plater()->get_camera().select_next_type(); m_dirty = true; break; }
|
||||
case 'L':
|
||||
case 'l': {
|
||||
if (!m_main_toolbar.is_enabled()) {
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
if (!m_main_toolbar.is_enabled())
|
||||
show_legend(!is_legend_shown());
|
||||
#else
|
||||
m_gcode_viewer.enable_legend(!m_gcode_viewer.is_legend_enabled());
|
||||
m_dirty = true;
|
||||
wxGetApp().plater()->update_preview_bottom_toolbar();
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'O':
|
||||
@ -4296,9 +4280,7 @@ void GLCanvas3D::set_cursor(ECursorType type)
|
||||
|
||||
void GLCanvas3D::msw_rescale()
|
||||
{
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
m_gcode_viewer.invalidate_legend();
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
}
|
||||
|
||||
void GLCanvas3D::update_tooltip_for_settings_item_in_main_toolbar()
|
||||
|
@ -817,11 +817,7 @@ public:
|
||||
void reload_scene(bool refresh_immediately, bool force_full_scene_refresh = false);
|
||||
|
||||
void load_gcode_preview(const GCodeProcessorResult& gcode_result, const std::vector<std::string>& str_tool_colors);
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
void refresh_gcode_preview_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last);
|
||||
#else
|
||||
void refresh_gcode_preview_render_paths();
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
void set_gcode_view_preview_type(GCodeViewer::EViewType type) { return m_gcode_viewer.set_view_type(type); }
|
||||
GCodeViewer::EViewType get_gcode_view_preview_type() const { return m_gcode_viewer.get_view_type(); }
|
||||
void load_sla_preview();
|
||||
@ -915,10 +911,8 @@ public:
|
||||
bool are_labels_shown() const { return m_labels.is_shown(); }
|
||||
void show_labels(bool show) { m_labels.show(show); }
|
||||
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
bool is_legend_shown() const { return m_gcode_viewer.is_legend_enabled(); }
|
||||
void show_legend(bool show) { m_gcode_viewer.enable_legend(show); m_dirty = true; }
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
bool is_using_slope() const { return m_slope.is_used(); }
|
||||
void use_slope(bool use) { m_slope.use(use); }
|
||||
|
@ -208,75 +208,6 @@ bool Preview::init(wxWindow* parent, Bed3D& bed, Model* model)
|
||||
m_layers_slider_sizer = create_layers_slider_sizer();
|
||||
|
||||
wxGetApp().UpdateDarkUI(m_bottom_toolbar_panel = new wxPanel(this));
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
m_label_view_type = new wxStaticText(m_bottom_toolbar_panel, wxID_ANY, _L("View"));
|
||||
#ifdef _WIN32
|
||||
wxGetApp().UpdateDarkUI(m_choice_view_type = new BitmapComboBox(m_bottom_toolbar_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY));
|
||||
#else
|
||||
m_choice_view_type = new wxComboBox(m_bottom_toolbar_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY);
|
||||
#endif
|
||||
m_choice_view_type->Append(_L("Feature type"));
|
||||
m_choice_view_type->Append(_L("Height"));
|
||||
m_choice_view_type->Append(_L("Width"));
|
||||
m_choice_view_type->Append(_L("Speed"));
|
||||
m_choice_view_type->Append(_L("Fan speed"));
|
||||
m_choice_view_type->Append(_L("Temperature"));
|
||||
m_choice_view_type->Append(_L("Volumetric flow rate"));
|
||||
#if ENABLE_PREVIEW_LAYER_TIME
|
||||
m_choice_view_type->Append(_L("Layer time (linear)"));
|
||||
m_choice_view_type->Append(_L("Layer time (logarithmic)"));
|
||||
#endif // ENABLE_PREVIEW_LAYER_TIME
|
||||
m_choice_view_type->Append(_L("Tool"));
|
||||
m_choice_view_type->Append(_L("Color Print"));
|
||||
m_choice_view_type->SetSelection(0);
|
||||
|
||||
m_label_show = new wxStaticText(m_bottom_toolbar_panel, wxID_ANY, _L("Show"));
|
||||
|
||||
#ifdef _WIN32
|
||||
long combo_style = wxCB_READONLY | wxBORDER_SIMPLE; //set border allows use default color instead of theme color wich is allways light under MSW
|
||||
#else
|
||||
long combo_style = wxCB_READONLY;
|
||||
#endif
|
||||
|
||||
m_combochecklist_features = new wxComboCtrl();
|
||||
m_combochecklist_features->Create(m_bottom_toolbar_panel, wxID_ANY, _L("Feature types"), wxDefaultPosition, wxDefaultSize, combo_style);
|
||||
std::string feature_items = GUI::into_u8(
|
||||
_L("Unknown") + "|1|" +
|
||||
_L("Perimeter") + "|1|" +
|
||||
_L("External perimeter") + "|1|" +
|
||||
_L("Overhang perimeter") + "|1|" +
|
||||
_L("Internal infill") + "|1|" +
|
||||
_L("Solid infill") + "|1|" +
|
||||
_L("Top solid infill") + "|1|" +
|
||||
_L("Ironing") + "|1|" +
|
||||
_L("Bridge infill") + "|1|" +
|
||||
_L("Gap fill") + "|1|" +
|
||||
_L("Skirt/Brim") + "|1|" +
|
||||
_L("Support material") + "|1|" +
|
||||
_L("Support material interface") + "|1|" +
|
||||
_L("Wipe tower") + "|1|" +
|
||||
_L("Custom") + "|1"
|
||||
);
|
||||
Slic3r::GUI::create_combochecklist(m_combochecklist_features, GUI::into_u8(_L("Feature types")), feature_items);
|
||||
|
||||
m_combochecklist_options = new wxComboCtrl();
|
||||
m_combochecklist_options->Create(m_bottom_toolbar_panel, wxID_ANY, _L("Options"), wxDefaultPosition, wxDefaultSize, combo_style);
|
||||
std::string options_items = GUI::into_u8(
|
||||
get_option_type_string(OptionType::Travel) + "|0|" +
|
||||
get_option_type_string(OptionType::Wipe) + "|0|" +
|
||||
get_option_type_string(OptionType::Retractions) + "|0|" +
|
||||
get_option_type_string(OptionType::Unretractions) + "|0|" +
|
||||
get_option_type_string(OptionType::Seams) + "|0|" +
|
||||
get_option_type_string(OptionType::ToolChanges) + "|0|" +
|
||||
get_option_type_string(OptionType::ColorChanges) + "|0|" +
|
||||
get_option_type_string(OptionType::PausePrints) + "|0|" +
|
||||
get_option_type_string(OptionType::CustomGCodes) + "|0|" +
|
||||
get_option_type_string(OptionType::Shells) + "|0|" +
|
||||
get_option_type_string(OptionType::ToolMarker) + "|1|" +
|
||||
get_option_type_string(OptionType::Legend) + "|1"
|
||||
);
|
||||
Slic3r::GUI::create_combochecklist(m_combochecklist_options, GUI::into_u8(_L("Options")), options_items);
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
m_left_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_left_sizer->Add(m_canvas_widget, 1, wxALL | wxEXPAND, 0);
|
||||
@ -288,19 +219,6 @@ bool Preview::init(wxWindow* parent, Bed3D& bed, Model* model)
|
||||
m_moves_slider->SetDrawMode(DoubleSlider::dmSequentialGCodeView);
|
||||
|
||||
wxBoxSizer* bottom_toolbar_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
bottom_toolbar_sizer->AddSpacer(5);
|
||||
bottom_toolbar_sizer->Add(m_label_view_type, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||
bottom_toolbar_sizer->Add(m_choice_view_type, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
bottom_toolbar_sizer->AddSpacer(5);
|
||||
bottom_toolbar_sizer->Add(m_label_show, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
|
||||
bottom_toolbar_sizer->Add(m_combochecklist_options, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
// change the following number if editing the layout of the bottom toolbar sizer. It is used into update_bottom_toolbar()
|
||||
m_combochecklist_features_pos = 6;
|
||||
bottom_toolbar_sizer->Add(m_combochecklist_features, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 5);
|
||||
bottom_toolbar_sizer->Hide(m_combochecklist_features);
|
||||
bottom_toolbar_sizer->AddSpacer(5);
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
bottom_toolbar_sizer->Add(m_moves_slider, 1, wxALL | wxEXPAND, 0);
|
||||
m_bottom_toolbar_panel->SetSizer(bottom_toolbar_sizer);
|
||||
|
||||
@ -362,9 +280,6 @@ void Preview::load_print(bool keep_z_range)
|
||||
else if (tech == ptSLA)
|
||||
load_print_as_sla();
|
||||
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
update_bottom_toolbar();
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
Layout();
|
||||
}
|
||||
|
||||
@ -407,12 +322,6 @@ void Preview::refresh_print()
|
||||
|
||||
void Preview::msw_rescale()
|
||||
{
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
#ifdef _WIN32
|
||||
m_choice_view_type->Rescale();
|
||||
m_choice_view_type->SetMinSize(m_choice_view_type->GetSize());
|
||||
#endif
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
// rescale slider
|
||||
if (m_layers_slider != nullptr) m_layers_slider->msw_rescale();
|
||||
if (m_moves_slider != nullptr) m_moves_slider->msw_rescale();
|
||||
@ -428,16 +337,8 @@ void Preview::sys_color_changed()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
wxWindowUpdateLocker noUpdates(this);
|
||||
|
||||
wxGetApp().UpdateAllStaticTextDarkUI(m_bottom_toolbar_panel);
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
wxGetApp().UpdateDarkUI(m_choice_view_type);
|
||||
wxGetApp().UpdateDarkUI(m_combochecklist_features);
|
||||
wxGetApp().UpdateDarkUI(static_cast<wxCheckListBoxComboPopup*>(m_combochecklist_features->GetPopupControl()));
|
||||
wxGetApp().UpdateDarkUI(m_combochecklist_options);
|
||||
wxGetApp().UpdateDarkUI(static_cast<wxCheckListBoxComboPopup*>(m_combochecklist_options->GetPopupControl()));
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
#endif
|
||||
#endif // _WIN32
|
||||
|
||||
if (m_layers_slider != nullptr)
|
||||
m_layers_slider->sys_color_changed();
|
||||
@ -461,22 +362,12 @@ void Preview::edit_layers_slider(wxKeyEvent& evt)
|
||||
void Preview::bind_event_handlers()
|
||||
{
|
||||
Bind(wxEVT_SIZE, &Preview::on_size, this);
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
m_choice_view_type->Bind(wxEVT_COMBOBOX, &Preview::on_choice_view_type, this);
|
||||
m_combochecklist_features->Bind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_features, this);
|
||||
m_combochecklist_options->Bind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_options, this);
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
m_moves_slider->Bind(wxEVT_SCROLL_CHANGED, &Preview::on_moves_slider_scroll_changed, this);
|
||||
}
|
||||
|
||||
void Preview::unbind_event_handlers()
|
||||
{
|
||||
Unbind(wxEVT_SIZE, &Preview::on_size, this);
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
m_choice_view_type->Unbind(wxEVT_COMBOBOX, &Preview::on_choice_view_type, this);
|
||||
m_combochecklist_features->Unbind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_features, this);
|
||||
m_combochecklist_options->Unbind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_options, this);
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
m_moves_slider->Unbind(wxEVT_SCROLL_CHANGED, &Preview::on_moves_slider_scroll_changed, this);
|
||||
}
|
||||
|
||||
@ -497,75 +388,6 @@ void Preview::on_size(wxSizeEvent& evt)
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
void Preview::on_choice_view_type(wxCommandEvent& evt)
|
||||
{
|
||||
int selection = m_choice_view_type->GetCurrentSelection();
|
||||
if (0 <= selection && selection < static_cast<int>(GCodeViewer::EViewType::Count)) {
|
||||
m_canvas->set_toolpath_view_type(static_cast<GCodeViewer::EViewType>(selection));
|
||||
m_keep_current_preview_type = true;
|
||||
}
|
||||
refresh_print();
|
||||
}
|
||||
|
||||
void Preview::on_combochecklist_features(wxCommandEvent& evt)
|
||||
{
|
||||
unsigned int flags = Slic3r::GUI::combochecklist_get_flags(m_combochecklist_features);
|
||||
m_canvas->set_toolpath_role_visibility_flags(flags);
|
||||
refresh_print();
|
||||
}
|
||||
|
||||
void Preview::on_combochecklist_options(wxCommandEvent& evt)
|
||||
{
|
||||
const unsigned int curr_flags = m_canvas->get_gcode_options_visibility_flags();
|
||||
const unsigned int new_flags = Slic3r::GUI::combochecklist_get_flags(m_combochecklist_options);
|
||||
if (curr_flags == new_flags)
|
||||
return;
|
||||
|
||||
m_canvas->set_gcode_options_visibility_from_flags(new_flags);
|
||||
if (m_canvas->get_gcode_view_type() == GCodeViewer::EViewType::Feedrate) {
|
||||
const unsigned int diff_flags = curr_flags ^ new_flags;
|
||||
if ((diff_flags & (1 << static_cast<unsigned int>(Preview::OptionType::Travel))) != 0)
|
||||
refresh_print();
|
||||
else
|
||||
m_canvas->refresh_gcode_preview_render_paths();
|
||||
}
|
||||
else
|
||||
m_canvas->refresh_gcode_preview_render_paths();
|
||||
|
||||
update_moves_slider();
|
||||
}
|
||||
|
||||
void Preview::update_bottom_toolbar()
|
||||
{
|
||||
combochecklist_set_flags(m_combochecklist_features, m_canvas->get_toolpath_role_visibility_flags());
|
||||
combochecklist_set_flags(m_combochecklist_options, m_canvas->get_gcode_options_visibility_flags());
|
||||
|
||||
// updates visibility of features combobox
|
||||
if (m_bottom_toolbar_panel->IsShown()) {
|
||||
wxSizer* sizer = m_bottom_toolbar_panel->GetSizer();
|
||||
bool show = !m_canvas->is_gcode_legend_enabled() || m_canvas->get_gcode_view_type() != GCodeViewer::EViewType::FeatureType;
|
||||
|
||||
if (show) {
|
||||
if (sizer->GetItem(m_combochecklist_features) == nullptr) {
|
||||
sizer->Insert(m_combochecklist_features_pos, m_combochecklist_features, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 5);
|
||||
sizer->Show(m_combochecklist_features);
|
||||
sizer->Layout();
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (sizer->GetItem(m_combochecklist_features) != nullptr) {
|
||||
sizer->Hide(m_combochecklist_features);
|
||||
sizer->Detach(m_combochecklist_features);
|
||||
sizer->Layout();
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
wxBoxSizer* Preview::create_layers_slider_sizer()
|
||||
{
|
||||
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
@ -1024,7 +846,6 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
||||
m_canvas->get_custom_gcode_per_print_z();
|
||||
const bool contains_color_gcodes = std::any_of(std::begin(gcodes), std::end(gcodes),
|
||||
[] (auto const& item) { return item.type == CustomGCode::Type::ColorChange; });
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
const GCodeViewer::EViewType choice = contains_color_gcodes ?
|
||||
GCodeViewer::EViewType::ColorPrint :
|
||||
(number_extruders > 1) ? GCodeViewer::EViewType::Tool : GCodeViewer::EViewType::FeatureType;
|
||||
@ -1034,21 +855,6 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
||||
m_keep_current_preview_type = true;
|
||||
refresh_print();
|
||||
}
|
||||
#else
|
||||
const wxString choice = contains_color_gcodes ?
|
||||
_L("Color Print") :
|
||||
(number_extruders > 1) ? _L("Tool") : _L("Feature type");
|
||||
int type = m_choice_view_type->FindString(choice);
|
||||
if (m_choice_view_type->GetSelection() != type) {
|
||||
if (0 <= type && type < static_cast<int>(GCodeViewer::EViewType::Count)) {
|
||||
m_choice_view_type->SetSelection(type);
|
||||
m_canvas->set_gcode_view_preview_type(static_cast<GCodeViewer::EViewType>(type));
|
||||
if (wxGetApp().is_gcode_viewer())
|
||||
m_keep_current_preview_type = true;
|
||||
refresh_print();
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
}
|
||||
|
||||
if (zs.empty()) {
|
||||
@ -1123,27 +929,5 @@ void Preview::on_moves_slider_scroll_changed(wxCommandEvent& event)
|
||||
m_canvas->render();
|
||||
}
|
||||
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
wxString Preview::get_option_type_string(OptionType type) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case OptionType::Travel: { return _L("Travel"); }
|
||||
case OptionType::Wipe: { return _L("Wipe"); }
|
||||
case OptionType::Retractions: { return _L("Retractions"); }
|
||||
case OptionType::Unretractions: { return _L("Deretractions"); }
|
||||
case OptionType::Seams: { return _L("Seams"); }
|
||||
case OptionType::ToolChanges: { return _L("Tool changes"); }
|
||||
case OptionType::ColorChanges: { return _L("Color changes"); }
|
||||
case OptionType::PausePrints: { return _L("Print pauses"); }
|
||||
case OptionType::CustomGCodes: { return _L("Custom G-codes"); }
|
||||
case OptionType::Shells: { return _L("Shells"); }
|
||||
case OptionType::ToolMarker: { return _L("Tool marker"); }
|
||||
case OptionType::Legend: { return _L("Legend/Estimated printing time"); }
|
||||
default: { return ""; }
|
||||
}
|
||||
}
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
@ -80,18 +80,6 @@ class Preview : public wxPanel
|
||||
wxBoxSizer* m_left_sizer { nullptr };
|
||||
wxBoxSizer* m_layers_slider_sizer { nullptr };
|
||||
wxPanel* m_bottom_toolbar_panel { nullptr };
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
wxStaticText* m_label_view_type { nullptr };
|
||||
#ifdef _WIN32
|
||||
BitmapComboBox* m_choice_view_type { nullptr };
|
||||
#else
|
||||
wxComboBox* m_choice_view_type { nullptr };
|
||||
#endif
|
||||
wxStaticText* m_label_show{ nullptr };
|
||||
wxComboCtrl* m_combochecklist_features { nullptr };
|
||||
size_t m_combochecklist_features_pos { 0 };
|
||||
wxComboCtrl* m_combochecklist_options { nullptr };
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
DynamicPrintConfig* m_config;
|
||||
BackgroundSlicingProcess* m_process;
|
||||
@ -129,9 +117,6 @@ public:
|
||||
CenterOfGravity,
|
||||
Shells,
|
||||
ToolMarker,
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
Legend
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
};
|
||||
|
||||
Preview(wxWindow* parent, Bed3D& bed, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process,
|
||||
@ -159,17 +144,12 @@ public:
|
||||
|
||||
bool is_loaded() const { return m_loaded; }
|
||||
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
void update_bottom_toolbar();
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
void update_moves_slider();
|
||||
void enable_moves_slider(bool enable);
|
||||
void move_moves_slider(wxKeyEvent& evt);
|
||||
void hide_layers_slider();
|
||||
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
void set_keep_current_preview_type(bool value) { m_keep_current_preview_type = value; }
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
private:
|
||||
bool init(wxWindow* parent, Bed3D& bed, Model* model);
|
||||
@ -178,11 +158,6 @@ private:
|
||||
void unbind_event_handlers();
|
||||
|
||||
void on_size(wxSizeEvent& evt);
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
void on_choice_view_type(wxCommandEvent& evt);
|
||||
void on_combochecklist_features(wxCommandEvent& evt);
|
||||
void on_combochecklist_options(wxCommandEvent& evt);
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
// Create/Update/Reset double slider on 3dPreview
|
||||
wxBoxSizer* create_layers_slider_sizer();
|
||||
@ -199,9 +174,6 @@ private:
|
||||
|
||||
void on_layers_slider_scroll_changed(wxCommandEvent& event);
|
||||
void on_moves_slider_scroll_changed(wxCommandEvent& event);
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
wxString get_option_type_string(OptionType type) const;
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
};
|
||||
|
||||
} // namespace GUI
|
||||
|
@ -64,20 +64,18 @@ static const std::map<const wchar_t, std::string> font_icons = {
|
||||
};
|
||||
|
||||
static const std::map<const wchar_t, std::string> font_icons_large = {
|
||||
#if ENABLE_LEGEND_TOOLBAR_ICONS
|
||||
{ImGui::LegendTravel , "legend_travel" },
|
||||
{ImGui::LegendWipe , "legend_wipe" },
|
||||
{ImGui::LegendRetract , "legend_retract" },
|
||||
{ImGui::LegendDeretract , "legend_deretract" },
|
||||
{ImGui::LegendSeams , "legend_seams" },
|
||||
{ImGui::LegendToolChanges , "legend_toolchanges" },
|
||||
{ImGui::LegendColorChanges , "legend_colorchanges" },
|
||||
{ImGui::LegendPausePrints , "legend_pauseprints" },
|
||||
{ImGui::LegendCustomGCodes , "legend_customgcodes" },
|
||||
{ImGui::LegendCOG , "legend_cog" },
|
||||
{ImGui::LegendShells , "legend_shells" },
|
||||
{ImGui::LegendToolMarker , "legend_toolmarker" },
|
||||
#endif // ENABLE_LEGEND_TOOLBAR_ICONS
|
||||
{ImGui::LegendTravel , "legend_travel" },
|
||||
{ImGui::LegendWipe , "legend_wipe" },
|
||||
{ImGui::LegendRetract , "legend_retract" },
|
||||
{ImGui::LegendDeretract , "legend_deretract" },
|
||||
{ImGui::LegendSeams , "legend_seams" },
|
||||
{ImGui::LegendToolChanges , "legend_toolchanges" },
|
||||
{ImGui::LegendColorChanges , "legend_colorchanges" },
|
||||
{ImGui::LegendPausePrints , "legend_pauseprints" },
|
||||
{ImGui::LegendCustomGCodes , "legend_customgcodes" },
|
||||
{ImGui::LegendCOG , "legend_cog" },
|
||||
{ImGui::LegendShells , "legend_shells" },
|
||||
{ImGui::LegendToolMarker , "legend_toolmarker" },
|
||||
{ImGui::CloseNotifButton , "notification_close" },
|
||||
{ImGui::CloseNotifHoverButton , "notification_close_hover" },
|
||||
{ImGui::EjectButton , "notification_eject_sd" },
|
||||
@ -396,7 +394,6 @@ bool ImGuiWrapper::radio_button(const wxString &label, bool active)
|
||||
return ImGui::RadioButton(label_utf8.c_str(), active);
|
||||
}
|
||||
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
bool ImGuiWrapper::draw_radio_button(const std::string& name, float size, bool active,
|
||||
std::function<void(ImGuiWindow& window, const ImVec2& pos, float size)> draw_callback)
|
||||
{
|
||||
@ -430,7 +427,6 @@ bool ImGuiWrapper::draw_radio_button(const std::string& name, float size, bool a
|
||||
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window.DC.LastItemStatusFlags);
|
||||
return pressed;
|
||||
}
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
bool ImGuiWrapper::input_double(const std::string &label, const double &value, const std::string &format)
|
||||
{
|
||||
@ -575,7 +571,6 @@ bool ImGuiWrapper::slider_float(const char* label, float* v, float v_min, float
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, { 1, style.ItemSpacing.y });
|
||||
ImGui::SameLine();
|
||||
|
||||
#if ENABLE_LEGEND_TOOLBAR_ICONS
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
assert(io.Fonts->TexWidth > 0 && io.Fonts->TexHeight > 0);
|
||||
float inv_tex_w = 1.0f / float(io.Fonts->TexWidth);
|
||||
@ -585,13 +580,11 @@ bool ImGuiWrapper::slider_float(const char* label, float* v, float v_min, float
|
||||
const ImVec2 size = { float(rect->Width), float(rect->Height) };
|
||||
const ImVec2 uv0 = ImVec2(float(rect->X) * inv_tex_w, float(rect->Y) * inv_tex_h);
|
||||
const ImVec2 uv1 = ImVec2(float(rect->X + rect->Width) * inv_tex_w, float(rect->Y + rect->Height) * inv_tex_h);
|
||||
#endif // ENABLE_LEGEND_TOOLBAR_ICONS
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, { 0.25f, 0.25f, 0.25f, 0.0f });
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 0.4f, 0.4f, 0.4f, 1.0f });
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 0.4f, 0.4f, 0.4f, 1.0f });
|
||||
|
||||
#if ENABLE_LEGEND_TOOLBAR_ICONS
|
||||
const ImTextureID tex_id = io.Fonts->TexID;
|
||||
if (image_button(tex_id, size, uv0, uv1, -1, ImVec4(0.0, 0.0, 0.0, 0.0), ImVec4(1.0, 1.0, 1.0, 1.0), ImGuiButtonFlags_PressedOnClick)) {
|
||||
if (!slider_editing)
|
||||
@ -600,13 +593,6 @@ bool ImGuiWrapper::slider_float(const char* label, float* v, float v_min, float
|
||||
ImGui::ClearActiveID();
|
||||
this->set_requires_extra_frame();
|
||||
}
|
||||
#else
|
||||
std::wstring btn_name = ImGui::SliderFloatEditBtnIcon + boost::nowide::widen(str_label);
|
||||
if (ImGui::Button(into_u8(btn_name).c_str())) {
|
||||
ImGui::SetKeyboardFocusHere(-1);
|
||||
this->set_requires_extra_frame();
|
||||
}
|
||||
#endif // ENABLE_LEGEND_TOOLBAR_ICONS
|
||||
|
||||
ImGui::PopStyleColor(3);
|
||||
|
||||
@ -688,14 +674,10 @@ bool ImGuiWrapper::image_button(ImTextureID user_texture_id, const ImVec2& size,
|
||||
bool ImGuiWrapper::combo(const wxString& label, const std::vector<std::string>& options, int& selection, ImGuiComboFlags flags)
|
||||
{
|
||||
// this is to force the label to the left of the widget:
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
if (!label.empty()) {
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
text(label);
|
||||
ImGui::SameLine();
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
}
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
int selection_out = selection;
|
||||
bool res = false;
|
||||
@ -1145,13 +1127,11 @@ bool ImGuiWrapper::want_any_input() const
|
||||
return io.WantCaptureMouse || io.WantCaptureKeyboard || io.WantTextInput;
|
||||
}
|
||||
|
||||
#if ENABLE_LEGEND_TOOLBAR_ICONS
|
||||
ImFontAtlasCustomRect* ImGuiWrapper::GetTextureCustomRect(const wchar_t& tex_id)
|
||||
{
|
||||
auto item = m_custom_glyph_rects_ids.find(tex_id);
|
||||
return (item != m_custom_glyph_rects_ids.end()) ? ImGui::GetIO().Fonts->GetCustomRectByIndex(m_custom_glyph_rects_ids[tex_id]) : nullptr;
|
||||
}
|
||||
#endif // ENABLE_LEGEND_TOOLBAR_ICONS
|
||||
|
||||
ImU32 ImGuiWrapper::to_ImU32(const ColorRGBA& color)
|
||||
{
|
||||
@ -1270,7 +1250,6 @@ void ImGuiWrapper::init_font(bool compress)
|
||||
|
||||
int rect_id = io.Fonts->CustomRects.Size; // id of the rectangle added next
|
||||
// add rectangles for the icons to the font atlas
|
||||
#if ENABLE_LEGEND_TOOLBAR_ICONS
|
||||
for (auto& icon : font_icons) {
|
||||
m_custom_glyph_rects_ids[icon.first] =
|
||||
io.Fonts->AddCustomRectFontGlyph(font, icon.first, icon_sz, icon_sz, 3.0 * font_scale + icon_sz);
|
||||
@ -1282,15 +1261,7 @@ void ImGuiWrapper::init_font(bool compress)
|
||||
for (auto& icon : font_icons_extra_large) {
|
||||
m_custom_glyph_rects_ids[icon.first] =
|
||||
io.Fonts->AddCustomRectFontGlyph(font, icon.first, icon_sz * 4, icon_sz * 4, 3.0 * font_scale + icon_sz * 4);
|
||||
}
|
||||
#else
|
||||
for (auto& icon : font_icons)
|
||||
io.Fonts->AddCustomRectFontGlyph(font, icon.first, icon_sz, icon_sz, 3.0 * font_scale + icon_sz);
|
||||
for (auto& icon : font_icons_large)
|
||||
io.Fonts->AddCustomRectFontGlyph(font, icon.first, icon_sz * 2, icon_sz * 2, 3.0 * font_scale + icon_sz * 2);
|
||||
for (auto& icon : font_icons_extra_large)
|
||||
io.Fonts->AddCustomRectFontGlyph(font, icon.first, icon_sz * 4, icon_sz * 4, 3.0 * font_scale + icon_sz * 4);
|
||||
#endif // ENABLE_LEGEND_TOOLBAR_ICONS
|
||||
}
|
||||
|
||||
// Build texture atlas
|
||||
unsigned char* pixels;
|
||||
|
@ -21,9 +21,7 @@ class wxString;
|
||||
class wxMouseEvent;
|
||||
class wxKeyEvent;
|
||||
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
struct IMGUI_API ImGuiWindow;
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
@ -40,9 +38,7 @@ class ImGuiWrapper
|
||||
bool m_disabled{ false };
|
||||
bool m_new_frame_open{ false };
|
||||
bool m_requires_extra_frame{ false };
|
||||
#if ENABLE_LEGEND_TOOLBAR_ICONS
|
||||
std::map<wchar_t, int> m_custom_glyph_rects_ids;
|
||||
#endif // ENABLE_LEGEND_TOOLBAR_ICONS
|
||||
std::string m_clipboard_text;
|
||||
|
||||
public:
|
||||
@ -92,9 +88,7 @@ public:
|
||||
bool button(const wxString &label);
|
||||
bool button(const wxString& label, float width, float height);
|
||||
bool radio_button(const wxString &label, bool active);
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
bool draw_radio_button(const std::string& name, float size, bool active, std::function<void(ImGuiWindow& window, const ImVec2& pos, float size)> draw_callback);
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
bool input_double(const std::string &label, const double &value, const std::string &format = "%.3f");
|
||||
bool input_double(const wxString &label, const double &value, const std::string &format = "%.3f");
|
||||
bool input_vec3(const std::string &label, const Vec3d &value, float width, const std::string &format = "%.3f");
|
||||
@ -143,9 +137,7 @@ public:
|
||||
static ColorRGBA from_ImU32(const ImU32& color);
|
||||
static ColorRGBA from_ImVec4(const ImVec4& color);
|
||||
|
||||
#if ENABLE_LEGEND_TOOLBAR_ICONS
|
||||
ImFontAtlasCustomRect* GetTextureCustomRect(const wchar_t& tex_id);
|
||||
#endif // ENABLE_LEGEND_TOOLBAR_ICONS
|
||||
|
||||
static const ImVec4 COL_GREY_DARK;
|
||||
static const ImVec4 COL_GREY_LIGHT;
|
||||
|
@ -1494,11 +1494,9 @@ void MainFrame::init_menubar_as_editor()
|
||||
append_menu_check_item(viewMenu, wxID_ANY, _L("Show &Labels") + sep + "E", _L("Show object/instance labels in 3D scene"),
|
||||
[this](wxCommandEvent&) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); }, this,
|
||||
[this]() { return m_plater->is_view3D_shown(); }, [this]() { return m_plater->are_view3D_labels_shown(); }, this);
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
append_menu_check_item(viewMenu, wxID_ANY, _L("Show Legen&d") + sep + "L", _L("Show legend in preview"),
|
||||
[this](wxCommandEvent&) { m_plater->show_legend(!m_plater->is_legend_shown()); }, this,
|
||||
[this]() { return m_plater->is_preview_shown(); }, [this]() { return m_plater->is_legend_shown(); }, this);
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
append_menu_check_item(viewMenu, wxID_ANY, _L("&Collapse Sidebar") + sep + "Shift+" + sep_space + "Tab", _L("Collapse sidebar"),
|
||||
[this](wxCommandEvent&) { m_plater->collapse_sidebar(!m_plater->is_sidebar_collapsed()); }, this,
|
||||
[]() { return true; }, [this]() { return m_plater->is_sidebar_collapsed(); }, this);
|
||||
@ -1616,12 +1614,10 @@ void MainFrame::init_menubar_as_gcodeviewer()
|
||||
if (m_plater != nullptr) {
|
||||
viewMenu = new wxMenu();
|
||||
add_common_view_menu_items(viewMenu, this, std::bind(&MainFrame::can_change_view, this));
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
viewMenu->AppendSeparator();
|
||||
append_menu_check_item(viewMenu, wxID_ANY, _L("Show legen&d") + sep + "L", _L("Show legend"),
|
||||
[this](wxCommandEvent&) { m_plater->show_legend(!m_plater->is_legend_shown()); }, this,
|
||||
[this]() { return m_plater->is_preview_shown(); }, [this]() { return m_plater->is_legend_shown(); }, this);
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
}
|
||||
|
||||
// helpmenu
|
||||
|
@ -1768,10 +1768,8 @@ struct Plater::priv
|
||||
bool are_view3D_labels_shown() const { return (current_panel == view3D) && view3D->get_canvas3d()->are_labels_shown(); }
|
||||
void show_view3D_labels(bool show) { if (current_panel == view3D) view3D->get_canvas3d()->show_labels(show); }
|
||||
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
bool is_legend_shown() const { return (current_panel == preview) && preview->get_canvas3d()->is_legend_shown(); }
|
||||
void show_legend(bool show) { if (current_panel == preview) preview->get_canvas3d()->show_legend(show); }
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
bool is_sidebar_collapsed() const { return sidebar->is_collapsed(); }
|
||||
void collapse_sidebar(bool collapse);
|
||||
@ -1786,9 +1784,6 @@ struct Plater::priv
|
||||
bool init_view_toolbar();
|
||||
bool init_collapse_toolbar();
|
||||
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
void update_preview_bottom_toolbar();
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
void update_preview_moves_slider();
|
||||
void enable_preview_moves_slider(bool enable);
|
||||
|
||||
@ -4762,13 +4757,6 @@ bool Plater::priv::init_collapse_toolbar()
|
||||
return true;
|
||||
}
|
||||
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
void Plater::priv::update_preview_bottom_toolbar()
|
||||
{
|
||||
preview->update_bottom_toolbar();
|
||||
}
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
void Plater::priv::update_preview_moves_slider()
|
||||
{
|
||||
preview->update_moves_slider();
|
||||
@ -5747,10 +5735,8 @@ bool Plater::is_view3D_shown() const { return p->is_view3D_shown(); }
|
||||
bool Plater::are_view3D_labels_shown() const { return p->are_view3D_labels_shown(); }
|
||||
void Plater::show_view3D_labels(bool show) { p->show_view3D_labels(show); }
|
||||
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
bool Plater::is_legend_shown() const { return p->is_legend_shown(); }
|
||||
void Plater::show_legend(bool show) { p->show_legend(show); }
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
bool Plater::is_sidebar_collapsed() const { return p->is_sidebar_collapsed(); }
|
||||
void Plater::collapse_sidebar(bool show) { p->collapse_sidebar(show); }
|
||||
@ -7117,13 +7103,6 @@ GLToolbar& Plater::get_collapse_toolbar()
|
||||
return p->collapse_toolbar;
|
||||
}
|
||||
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
void Plater::update_preview_bottom_toolbar()
|
||||
{
|
||||
p->update_preview_bottom_toolbar();
|
||||
}
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
void Plater::update_preview_moves_slider()
|
||||
{
|
||||
p->update_preview_moves_slider();
|
||||
@ -7232,12 +7211,10 @@ bool Plater::is_render_statistic_dialog_visible() const
|
||||
return p->show_render_statistic_dialog;
|
||||
}
|
||||
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
void Plater::set_keep_current_preview_type(bool value)
|
||||
{
|
||||
p->preview->set_keep_current_preview_type(value);
|
||||
}
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
Plater::TakeSnapshot::TakeSnapshot(Plater *plater, const std::string &snapshot_name)
|
||||
: TakeSnapshot(plater, from_u8(snapshot_name)) {}
|
||||
|
@ -225,10 +225,8 @@ public:
|
||||
bool are_view3D_labels_shown() const;
|
||||
void show_view3D_labels(bool show);
|
||||
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
bool is_legend_shown() const;
|
||||
void show_legend(bool show);
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
bool is_sidebar_collapsed() const;
|
||||
void collapse_sidebar(bool show);
|
||||
@ -390,9 +388,6 @@ public:
|
||||
const GLToolbar& get_collapse_toolbar() const;
|
||||
GLToolbar& get_collapse_toolbar();
|
||||
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
void update_preview_bottom_toolbar();
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
void update_preview_moves_slider();
|
||||
void enable_preview_moves_slider(bool enable);
|
||||
|
||||
@ -458,9 +453,7 @@ public:
|
||||
void toggle_render_statistic_dialog();
|
||||
bool is_render_statistic_dialog_visible() const;
|
||||
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
void set_keep_current_preview_type(bool value);
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
// Wrapper around wxWindow::PopupMenu to suppress error messages popping out while tracking the popup menu.
|
||||
bool PopupMenu(wxMenu *menu, const wxPoint& pos = wxDefaultPosition);
|
||||
|
@ -66,7 +66,7 @@ SCENARIO("Various Clipper operations - xs/t/11_clipper.t", "[ClipperUtils]") {
|
||||
GIVEN("polyline") {
|
||||
Polyline polyline { { 50, 150 }, { 300, 150 } };
|
||||
WHEN("intersection_pl") {
|
||||
Polylines result = Slic3r::intersection_pl({ polyline }, { square, hole_in_square });
|
||||
Polylines result = Slic3r::intersection_pl(polyline, ExPolygon{ square, hole_in_square });
|
||||
THEN("correct number of result lines") {
|
||||
REQUIRE(result.size() == 2);
|
||||
}
|
||||
@ -99,7 +99,7 @@ SCENARIO("Various Clipper operations - xs/t/11_clipper.t", "[ClipperUtils]") {
|
||||
{ 74730000, 74730000 }, { 55270000, 74730000 }, { 55270000, 68063296 }, { 44730000, 68063296 }, { 44730000, 74730000 }, { 25270000, 74730000 }, { 25270000, 55270000 }, { 31936670, 55270000 },
|
||||
{ 31936670, 44730000 }, { 25270000, 44730000 }, { 25270000, 25270000 }, { 44730000, 25270000 }, { 44730000, 31936670 } };
|
||||
Slic3r::Polygon clip { {75200000, 45200000}, {54800000, 45200000}, {54800000, 24800000}, {75200000, 24800000} };
|
||||
Slic3r::Polylines result = Slic3r::intersection_pl(subject, { clip });
|
||||
Slic3r::Polylines result = Slic3r::intersection_pl(subject, ExPolygon{ clip });
|
||||
THEN("intersection_pl - result is not empty") {
|
||||
REQUIRE(result.size() == 1);
|
||||
}
|
||||
@ -117,7 +117,7 @@ SCENARIO("Various Clipper operations - xs/t/11_clipper.t", "[ClipperUtils]") {
|
||||
GIVEN("Clipper bug #126") {
|
||||
Slic3r::Polyline subject { { 200000, 19799999 }, { 200000, 200000 }, { 24304692, 200000 }, { 15102879, 17506106 }, { 13883200, 19799999 }, { 200000, 19799999 } };
|
||||
Slic3r::Polygon clip { { 15257205, 18493894 }, { 14350057, 20200000 }, { -200000, 20200000 }, { -200000, -200000 }, { 25196917, -200000 } };
|
||||
Slic3r::Polylines result = Slic3r::intersection_pl(subject, { clip });
|
||||
Slic3r::Polylines result = Slic3r::intersection_pl(subject, ExPolygon{ clip });
|
||||
THEN("intersection_pl - result is not empty") {
|
||||
REQUIRE(result.size() == 1);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
|
||||
add_executable(${_TEST_NAME}_tests
|
||||
${_TEST_NAME}_tests_main.cpp
|
||||
slic3r_jobs_tests.cpp
|
||||
slic3r_version_tests.cpp
|
||||
)
|
||||
|
||||
# mold linker for successful linking needs also to link TBB library and link it before libslic3r.
|
||||
|
83
tests/slic3rutils/slic3r_version_tests.cpp
Normal file
83
tests/slic3rutils/slic3r_version_tests.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
#include "catch2/catch.hpp"
|
||||
|
||||
#include "slic3r/Config/Version.hpp"
|
||||
|
||||
|
||||
TEST_CASE("Check parsing and comparing of config versions", "[Version]") {
|
||||
using namespace Slic3r;
|
||||
|
||||
GUI::Config::Version v;
|
||||
|
||||
v.config_version = *Semver::parse("1.1.2");
|
||||
v.min_slic3r_version = *Semver::parse("1.38.0");
|
||||
v.max_slic3r_version = Semver::inf();
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.38.0")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.38.0-alpha")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.37.0-alpha")));
|
||||
|
||||
// Test the prerelease status.
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0")));
|
||||
|
||||
v.config_version = *Semver::parse("1.1.2-alpha");
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0")));
|
||||
|
||||
v.config_version = *Semver::parse("1.1.2-alpha1");
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0")));
|
||||
|
||||
v.config_version = *Semver::parse("1.1.2-beta");
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-rc")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0")));
|
||||
|
||||
v.config_version = *Semver::parse("1.1.2-rc");
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-rc")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0")));
|
||||
|
||||
v.config_version = *Semver::parse("1.1.2-rc2");
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-rc")));
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0")));
|
||||
|
||||
// Test the upper boundary.
|
||||
v.config_version = *Semver::parse("1.1.2");
|
||||
v.max_slic3r_version = *Semver::parse("1.39.3-beta1");
|
||||
REQUIRE(v.is_slic3r_supported(*Semver::parse("1.38.0")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.38.0-alpha")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.38.0-alpha1")));
|
||||
REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.37.0-alpha")));
|
||||
}
|
Loading…
Reference in New Issue
Block a user