Ultimaker / CuraEngine

Powerful, fast and robust engine for converting 3D models into g-code instructions for 3D printers. It is part of the larger open source project Cura.
https://ultimaker.com/en/products/cura-software
GNU Affero General Public License v3.0
1.66k stars 874 forks source link

CuraEngine::LayerPlanTest/AllCombinations/AddTravelTest.NoRetractionIfDisabled/20 fails because sliceDataStorage.storage.supportLayers hasn't been initialized properly #2008

Open amorozov opened 6 months ago

amorozov commented 6 months ago

CuraEngine-5.6.0

ArchLinux

Qt version is not applicable.

PyQt version is not applicable

Display Driver is not relevant

Compile the CuraEngine with the following flags:

then run make test (or ninja test)

Actual Results the test fails with the following diagnostics:

[ RUN      ] AllCombinations/AddTravelTest.NoRetractionIfDisabled/19
[       OK ] AllCombinations/AddTravelTest.NoRetractionIfDisabled/19 (0 ms)
[ RUN      ] AllCombinations/AddTravelTest.NoRetractionIfDisabled/20
/usr/include/c++/13.2.1/bits/stl_vector.h:1144: constexpr std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = cura::SupportLayer; _Alloc = std::allocator<cura::SupportLayer>; const_reference = const cura::SupportLayer&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Aborted (core dumped)

This happens because in function SliceDataStorage::getLayerOutlines on line 320:

            const SupportLayer& support_layer = support.supportLayers[std::max(LayerIndex(0), layer_nr)];

an attempt to access a support layer is performed while support.supportLayers.size() == 0

So an assertion and a preliminary test exit happen.

Apparently this is the first test which enters the code under if on the line 318:

        if (include_support && (extruder_nr == -1 || extruder_nr == int(mesh_group_settings.get<ExtruderTrain&>("support_infill_extruder_nr").extruder_nr)))
        {

Expected results The tests should be completed without errors

Additional Information

amorozov commented 6 months ago

Probably a call to AreaSupport::generateSupportAreas(SliceDataStorage&) should be performed prior to the SliceDataStorage::getLayerOutlines(....) . However my knowledge and understanding of CuraEngine internals is pretty limited, so it's just a guess.