From 0c82c00e157e60eeb69c05147fbe1a631c256ec4 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 27 Jul 2016 11:56:56 +0200 Subject: [PATCH 1/4] Improve documentation for generateSkirtBrim Contributes to issue CURA-1678. --- src/SkirtBrim.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SkirtBrim.h b/src/SkirtBrim.h index 74a93fae..b3a293de 100644 --- a/src/SkirtBrim.h +++ b/src/SkirtBrim.h @@ -8,9 +8,10 @@ namespace cura { /*! - * Generate skirt or brim (depending on parameters); when \p distance > 0 and - * \p count == 1 the skirt is generated, which has slightly different - * configuration. + * Generate skirt or brim (depending on parameters). + * + * When \p distance > 0 and \p count == 1 a skirt is generated, which has + * slightly different configuration. Otherwise, a brim is generated. * * \param storage Storage containing the parts at the first layer. * \param distance The distance of the first outset from the parts at the first From 0bc373e93582edd24f50edd6d22706952e3241b0 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 27 Jul 2016 15:19:31 +0200 Subject: [PATCH 2/4] Remove whitespace at end of line As per our code style rules. Contributes to issue CURA-1981. --- tests/utils/PolygonTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/utils/PolygonTest.cpp b/tests/utils/PolygonTest.cpp index 9ef68daa..119b755b 100644 --- a/tests/utils/PolygonTest.cpp +++ b/tests/utils/PolygonTest.cpp @@ -61,7 +61,7 @@ void PolygonTest::isOutsideTest() { Polygons test_triangle; test_triangle.add(triangle); - + CPPUNIT_ASSERT_MESSAGE("Point is calculated as inside while it's outside!", !test_triangle.inside(Point(0, 100))); } From 39efcf56807f99357464afbc9d8a490f21627652 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 27 Jul 2016 15:25:37 +0200 Subject: [PATCH 3/4] Add more asserts for isOutsideTest This also tests other cases where the point happens to be on other edge cases for other sides of the triangle. Contributes to issue CURA-1981. --- tests/utils/PolygonTest.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/utils/PolygonTest.cpp b/tests/utils/PolygonTest.cpp index 119b755b..20813303 100644 --- a/tests/utils/PolygonTest.cpp +++ b/tests/utils/PolygonTest.cpp @@ -62,7 +62,12 @@ void PolygonTest::isOutsideTest() Polygons test_triangle; test_triangle.add(triangle); - CPPUNIT_ASSERT_MESSAGE("Point is calculated as inside while it's outside!", !test_triangle.inside(Point(0, 100))); + CPPUNIT_ASSERT_MESSAGE("Left point is calculated as inside while it's outside!", !test_triangle.inside(Point(0, 100))); + CPPUNIT_ASSERT_MESSAGE("Middle left point is calculated as inside while it's outside!", !test_triangle.inside(Point(100, 100))); + CPPUNIT_ASSERT_MESSAGE("Middle right point is calculated as inside while it's outside!", !test_triangle.inside(Point(300, 100))); + CPPUNIT_ASSERT_MESSAGE("Right point is calculated as inside while it's outside!", !test_triangle.inside(Point(500, 100))); + CPPUNIT_ASSERT_MESSAGE("Above point is calculated as inside while it's outside!", !test_triangle.inside(Point(100, 200))); + CPPUNIT_ASSERT_MESSAGE("Below point is calculated as inside while it's outside!", !test_triangle.inside(Point(100, -100))); } From 7ea9b14a33bc7aa60ecb9bf5971f82f51321ef43 Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Wed, 27 Jul 2016 17:10:07 +0200 Subject: [PATCH 4/4] fix: retrieve globalish support settings from support extruder (CURA-2003) --- src/FffGcodeWriter.cpp | 33 +++++++++++++++++++-------------- src/FffPolygonGenerator.cpp | 3 ++- src/support.cpp | 3 ++- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/FffGcodeWriter.cpp b/src/FffGcodeWriter.cpp index e36a0d1c..9e765fb2 100644 --- a/src/FffGcodeWriter.cpp +++ b/src/FffGcodeWriter.cpp @@ -158,10 +158,11 @@ void FffGcodeWriter::initConfigs(SliceDataStorage& storage) } { // support - SettingsBase* train = storage.meshgroup->getExtruderTrain(getSettingAsIndex("support_infill_extruder_nr")); - storage.support_config.init(getSettingInMillimetersPerSecond("speed_support_infill"), getSettingInMillimetersPerSecond("acceleration_support_infill"), getSettingInMillimetersPerSecond("jerk_support_infill"), getSettingInMicrons("support_line_width"), train->getSettingInPercentage("material_flow")); - - storage.support_roof_config.init(getSettingInMillimetersPerSecond("speed_support_roof"), getSettingInMillimetersPerSecond("acceleration_support_roof"), getSettingInMillimetersPerSecond("jerk_support_roof"), getSettingInMicrons("support_roof_line_width"), train->getSettingInPercentage("material_flow")); + SettingsBase* infill_train = storage.meshgroup->getExtruderTrain(getSettingAsIndex("support_infill_extruder_nr")); + storage.support_config.init(infill_train->getSettingInMillimetersPerSecond("speed_support_infill"), infill_train->getSettingInMillimetersPerSecond("acceleration_support_infill"), infill_train->getSettingInMillimetersPerSecond("jerk_support_infill"), infill_train->getSettingInMicrons("support_line_width"), infill_train->getSettingInPercentage("material_flow")); + + SettingsBase* interface_train = storage.meshgroup->getExtruderTrain(getSettingAsIndex("support_roof_extruder_nr")); + storage.support_roof_config.init(interface_train->getSettingInMillimetersPerSecond("speed_support_roof"), interface_train->getSettingInMillimetersPerSecond("acceleration_support_roof"), interface_train->getSettingInMillimetersPerSecond("jerk_support_roof"), interface_train->getSettingInMicrons("support_roof_line_width"), interface_train->getSettingInPercentage("material_flow")); } for (SliceMeshStorage& mesh : storage.meshes) @@ -943,12 +944,14 @@ void FffGcodeWriter::addSupportInfillToGCode(SliceDataStorage& storage, GCodePla int64_t z = layer_nr * getSettingInMicrons("layer_height"); - int support_line_distance = getSettingInMicrons("support_line_distance"); + const ExtruderTrain& infill_extr = *storage.meshgroup->getExtruderTrain(getSettingAsIndex("support_infill_extruder_nr")); + int support_line_distance = infill_extr.getSettingInMicrons("support_line_distance"); // first layer line distance must be the same as the second layer line distance const int support_line_width = storage.support_config.getLineWidth(); - EFillMethod support_pattern = getSettingAsFillMethod("support_pattern"); + EFillMethod support_pattern = infill_extr.getSettingAsFillMethod("support_pattern"); // first layer pattern must be same as other layers if (layer_nr == 0 && (support_pattern == EFillMethod::LINES || support_pattern == EFillMethod::ZIG_ZAG)) { support_pattern = EFillMethod::GRID; } - int support_infill_extruder_nr = (layer_nr == 0)? getSettingAsIndex("support_extruder_nr_layer_0") : getSettingAsIndex("support_infill_extruder_nr"); + int infill_extruder_nr_here = (layer_nr == 0)? getSettingAsIndex("support_extruder_nr_layer_0") : getSettingAsIndex("support_infill_extruder_nr"); + const ExtruderTrain& infill_extr_here = *storage.meshgroup->getExtruderTrain(infill_extruder_nr_here); Polygons& support = storage.support.supportLayers[layer_nr].supportAreas; @@ -973,21 +976,21 @@ void FffGcodeWriter::addSupportInfillToGCode(SliceDataStorage& storage, GCodePla Polygons boundary = island.offset(-support_line_width / 2); if (boundary.size() > 0) { - setExtruder_addPrime(storage, gcode_layer, layer_nr, support_infill_extruder_nr); // only switch extruder if we're sure we're going to switch + setExtruder_addPrime(storage, gcode_layer, layer_nr, infill_extruder_nr_here); // only switch extruder if we're sure we're going to switch gcode_layer.addPolygonsByOptimizer(boundary, &storage.support_config); } offset_from_outline = -support_line_width; - support_infill_overlap = storage.meshgroup->getExtruderTrain(support_infill_extruder_nr)->getSettingInMicrons("infill_overlap_mm"); // support lines area should be expanded outward to overlap with the boundary polygon + support_infill_overlap = infill_extr_here.getSettingInMicrons("infill_overlap_mm"); // support lines area should be expanded outward to overlap with the boundary polygon } int extra_infill_shift = 0; - Infill infill_comp(support_pattern, island, offset_from_outline, support_line_width, support_line_distance, support_infill_overlap, 0, z, extra_infill_shift, getSettingBoolean("support_connect_zigzags"), true); + Infill infill_comp(support_pattern, island, offset_from_outline, support_line_width, support_line_distance, support_infill_overlap, 0, z, extra_infill_shift, infill_extr.getSettingBoolean("support_connect_zigzags"), true); Polygons support_polygons; Polygons support_lines; infill_comp.generate(support_polygons, support_lines); if (support_lines.size() > 0 || support_polygons.size() > 0) { - setExtruder_addPrime(storage, gcode_layer, layer_nr, support_infill_extruder_nr); // only switch extruder if we're sure we're going to switch + setExtruder_addPrime(storage, gcode_layer, layer_nr, infill_extruder_nr_here); // only switch extruder if we're sure we're going to switch gcode_layer.addPolygonsByOptimizer(support_polygons, &storage.support_config); gcode_layer.addLinesByOptimizer(support_lines, &storage.support_config, (support_pattern == EFillMethod::ZIG_ZAG)? SpaceFillType::PolyLines : SpaceFillType::Lines); } @@ -1005,10 +1008,12 @@ void FffGcodeWriter::addSupportRoofsToGCode(SliceDataStorage& storage, GCodePlan int64_t z = layer_nr * getSettingInMicrons("layer_height"); - EFillMethod pattern = getSettingAsFillMethod("support_roof_pattern"); - int support_line_distance = getSettingInMicrons("support_roof_line_distance"); - int roof_extruder_nr = getSettingAsIndex("support_roof_extruder_nr"); + const ExtruderTrain& interface_extr = *storage.meshgroup->getExtruderTrain(roof_extruder_nr); + + EFillMethod pattern = interface_extr.getSettingAsFillMethod("support_roof_pattern"); + int support_line_distance = interface_extr.getSettingInMicrons("support_roof_line_distance"); + setExtruder_addPrime(storage, gcode_layer, layer_nr, roof_extruder_nr); bool all_roofs_are_low = true; diff --git a/src/FffPolygonGenerator.cpp b/src/FffPolygonGenerator.cpp index 411b0ded..0dbdf24c 100644 --- a/src/FffPolygonGenerator.cpp +++ b/src/FffPolygonGenerator.cpp @@ -232,7 +232,8 @@ void FffPolygonGenerator::slices2polygons(SliceDataStorage& storage, TimeKeeper& for (unsigned int layer_idx = 0; layer_idx < total_layers; layer_idx++) { Polygons& support = storage.support.supportLayers[layer_idx].supportAreas; - CommandSocket::sendPolygons(PrintFeatureType::Infill, support, 100); //getSettingInMicrons("support_line_width")); + ExtruderTrain* infill_extr = storage.meshgroup->getExtruderTrain(storage.getSettingAsIndex("support_infill_extruder_nr")); + CommandSocket::sendPolygons(PrintFeatureType::Infill, support, 100); // infill_extr->getSettingInMicrons("support_line_width")); } } */ diff --git a/src/support.cpp b/src/support.cpp index 737e3624..d827abe5 100644 --- a/src/support.cpp +++ b/src/support.cpp @@ -330,7 +330,8 @@ void AreaSupport::detectOverhangPoints( int supportMinAreaSqrt ) { - const unsigned int support_line_width = storage.getSettingInMicrons("support_line_width"); + ExtruderTrain* infill_extr = storage.meshgroup->getExtruderTrain(storage.getSettingAsIndex("support_infill_extruder_nr")); + const unsigned int support_line_width = infill_extr->getSettingInMicrons("support_line_width"); for (int layer_idx = 0; layer_idx < layer_count; layer_idx++) { SliceLayer& layer = mesh.layers[layer_idx];