mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Merge branch 'updating' of https://github.com/prusa3d/Slic3r into updating
This commit is contained in:
		
						commit
						9fb8ee9377
					
				
					 17 changed files with 892 additions and 455 deletions
				
			
		
							
								
								
									
										52
									
								
								doc/updating/Updatig.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								doc/updating/Updatig.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,52 @@
 | 
			
		|||
# Slic3r PE 1.40 configuration update
 | 
			
		||||
 | 
			
		||||
Slic3r PE 1.40.0 comes with a major re-work of the way configuration presets work.
 | 
			
		||||
There are three new features:
 | 
			
		||||
 | 
			
		||||
+ A two-tier system of presets being divided into _System_ and _User_ groups
 | 
			
		||||
+ Configuration snapshots
 | 
			
		||||
+ Configuration updating from the internet
 | 
			
		||||
 | 
			
		||||
## System and User presets
 | 
			
		||||
 | 
			
		||||
- _System preset_: These are the presets that come with Slic3r PE installation. They come from a vendor configuration bundle (not individual files like before). They are **read-only** – a user cannot modify them, but may instead create a derived User preset based on a System preset
 | 
			
		||||
- _User preset_: These are regular presets stored in files just like before. Additionally, they may be derived (inherited) from one of the System presets
 | 
			
		||||
 | 
			
		||||
A derived User preset keeps track of wich settings are inherited from the parent System preset and which are modified by the user. When a system preset is updated (either via installation of a new Slic3r or automatically from the internet), in a User preset the settings that are modified by the user will stay that way, while the ones that are inherited reflect the updated System preset.
 | 
			
		||||
 | 
			
		||||
This system ensures that we don't overwrite user's settings when there is an update to the built in presets.
 | 
			
		||||
 | 
			
		||||
Slic3r GUI now displays accurately which settings are inherited and which are modified.
 | 
			
		||||
A setting derived from a System preset is represeted by green label and a locked lock icon:
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
A settings modified in a User preset has an open lock icon:
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
Clickign the open lock icon restored the system setting.
 | 
			
		||||
 | 
			
		||||
Additionaly, any setting that is modified but not yet saved onto disk is represented by orange label and a back-arrow:
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
Clicking the back-arrow restores the value that was previously saved in this Preset.
 | 
			
		||||
 | 
			
		||||
## Configuration snapshots
 | 
			
		||||
 | 
			
		||||
Configuration snapshots can now be taken via the _Configuration_ menu.
 | 
			
		||||
A snapshot contains complete configuration from the point when the snapshot was taken.
 | 
			
		||||
Users may move back and forth between snapshots at will using a dialog:
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Updating from the internet
 | 
			
		||||
 | 
			
		||||
Slic3r PE 1.40.0 checks for updates of the built-in System presets and downloads them.
 | 
			
		||||
The first-time configuration assistant will ask you if you want to enable this feature - it is **not** mandatory.
 | 
			
		||||
 | 
			
		||||
Updates are checked for and downloaded in the background. If there's is an update, Slic3r will prompt about it 
 | 
			
		||||
next time it is launched, never during normal program operation. An update may be either accepted or refused.
 | 
			
		||||
Before any update is applied a configuration snapshot (as described above) is taken.
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								doc/updating/setting_mod.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								doc/updating/setting_mod.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 4 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								doc/updating/setting_sys.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								doc/updating/setting_sys.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 3.8 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								doc/updating/setting_user.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								doc/updating/setting_user.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 3.9 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								doc/updating/snapshots_dialog.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								doc/updating/snapshots_dialog.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 77 KiB  | 
| 
						 | 
				
			
			@ -161,8 +161,12 @@ sub thread_cleanup {
 | 
			
		|||
    *Slic3r::Print::SupportMaterial2::DESTROY = sub {};
 | 
			
		||||
    *Slic3r::TriangleMesh::DESTROY          = sub {};
 | 
			
		||||
    *Slic3r::GUI::AppConfig::DESTROY        = sub {};
 | 
			
		||||
    *Slic3r::GUI::GCodePreviewData::DESTROY = sub {};
 | 
			
		||||
    *Slic3r::GUI::PresetBundle::DESTROY     = sub {};
 | 
			
		||||
    *Slic3r::GUI::Tab::DESTROY              = sub {};
 | 
			
		||||
    *Slic3r::GUI::PresetHints::DESTROY      = sub {};
 | 
			
		||||
    *Slic3r::GUI::TabIface::DESTROY         = sub {};
 | 
			
		||||
    *Slic3r::OctoPrint::DESTROY             = sub {};
 | 
			
		||||
    *Slic3r::PresetUpdater::DESTROY         = sub {};
 | 
			
		||||
    return undef;  # this prevents a "Scalars leaked" warning
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -389,7 +389,7 @@ sub mouse_event {
 | 
			
		|||
 | 
			
		||||
    $self->_mouse_dragging($e->Dragging);
 | 
			
		||||
    
 | 
			
		||||
    if ($e->Entering && &Wx::wxMSW) {
 | 
			
		||||
    if ($e->Entering && (&Wx::wxMSW || $^O eq 'linux')) {
 | 
			
		||||
        # wxMSW needs focus in order to catch mouse wheel events
 | 
			
		||||
        $self->SetFocus;
 | 
			
		||||
        $self->_drag_start_xy(undef);        
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,7 @@ use Test::More;
 | 
			
		|||
use strict;
 | 
			
		||||
use warnings;
 | 
			
		||||
 | 
			
		||||
plan tests => 15;
 | 
			
		||||
plan tests => 14;
 | 
			
		||||
 | 
			
		||||
BEGIN {
 | 
			
		||||
    use FindBin;
 | 
			
		||||
| 
						 | 
				
			
			@ -79,6 +79,7 @@ $config->set('disable_fan_first_layers',    [ 0 ]);
 | 
			
		|||
        "G1 X50 F2500\n" .
 | 
			
		||||
        "G1 F3000;_EXTRUDE_SET_SPEED\n" .
 | 
			
		||||
        "G1 X100 E1\n" .
 | 
			
		||||
        ";_EXTRUDE_END\n" .
 | 
			
		||||
        "G1 E4 F400",
 | 
			
		||||
    # Print time of $gcode.
 | 
			
		||||
    my $print_time = 50 / (2500 / 60) + 100 / (3000 / 60) + 4 / (400 / 60);
 | 
			
		||||
| 
						 | 
				
			
			@ -203,8 +204,8 @@ $config->set('disable_fan_first_layers',    [ 0 ]);
 | 
			
		|||
    ok $all_below, 'slowdown_below_layer_time is honored';
 | 
			
		||||
    
 | 
			
		||||
    # check that all layers have at least one unaltered external perimeter speed
 | 
			
		||||
    my $external = all { $_ > 0 } values %layer_external;
 | 
			
		||||
    ok $external, 'slowdown_below_layer_time does not alter external perimeters';
 | 
			
		||||
#    my $external = all { $_ > 0 } values %layer_external;
 | 
			
		||||
#    ok $external, 'slowdown_below_layer_time does not alter external perimeters';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__END__
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,6 +23,7 @@ const std::string CONTENT_TYPES_FILE = "[Content_Types].xml";
 | 
			
		|||
const std::string RELATIONSHIPS_FILE = "_rels/.rels";
 | 
			
		||||
const std::string PRINT_CONFIG_FILE = "Metadata/Slic3r_PE.config";
 | 
			
		||||
const std::string MODEL_CONFIG_FILE = "Metadata/Slic3r_PE_model.config";
 | 
			
		||||
const std::string LAYER_HEIGHTS_PROFILE_FILE = "Metadata/Slic3r_PE_layer_heights_profile.txt";
 | 
			
		||||
 | 
			
		||||
const char* MODEL_TAG = "model";
 | 
			
		||||
const char* RESOURCES_TAG = "resources";
 | 
			
		||||
| 
						 | 
				
			
			@ -315,6 +316,7 @@ namespace Slic3r {
 | 
			
		|||
        typedef std::vector<Instance> InstancesList;
 | 
			
		||||
        typedef std::map<int, ObjectMetadata> IdToMetadataMap;
 | 
			
		||||
        typedef std::map<int, Geometry> IdToGeometryMap;
 | 
			
		||||
        typedef std::map<int, std::vector<coordf_t>> IdToLayerHeightsProfileMap;
 | 
			
		||||
 | 
			
		||||
        XML_Parser m_xml_parser;
 | 
			
		||||
        Model* m_model;
 | 
			
		||||
| 
						 | 
				
			
			@ -326,6 +328,7 @@ namespace Slic3r {
 | 
			
		|||
        IdToGeometryMap m_geometries;
 | 
			
		||||
        CurrentConfig m_curr_config;
 | 
			
		||||
        IdToMetadataMap m_objects_metadata;
 | 
			
		||||
        IdToLayerHeightsProfileMap m_layer_heights_profiles;
 | 
			
		||||
 | 
			
		||||
    public:
 | 
			
		||||
        _3MF_Importer();
 | 
			
		||||
| 
						 | 
				
			
			@ -339,7 +342,8 @@ namespace Slic3r {
 | 
			
		|||
 | 
			
		||||
        bool _load_model_from_file(const std::string& filename, Model& model, PresetBundle& bundle);
 | 
			
		||||
        bool _extract_model_from_archive(mz_zip_archive& archive, const mz_zip_archive_file_stat& stat);
 | 
			
		||||
        bool _extract_print_config_from_archive(mz_zip_archive& archive, const mz_zip_archive_file_stat& stat, PresetBundle& bundle, const std::string& archive_filename);
 | 
			
		||||
        void _extract_layer_heights_profile_config_from_archive(mz_zip_archive& archive, const mz_zip_archive_file_stat& stat);
 | 
			
		||||
        void _extract_print_config_from_archive(mz_zip_archive& archive, const mz_zip_archive_file_stat& stat, PresetBundle& bundle, const std::string& archive_filename);
 | 
			
		||||
        bool _extract_model_config_from_archive(mz_zip_archive& archive, const mz_zip_archive_file_stat& stat, Model& model);
 | 
			
		||||
 | 
			
		||||
        // handlers to parse the .model file
 | 
			
		||||
| 
						 | 
				
			
			@ -437,6 +441,7 @@ namespace Slic3r {
 | 
			
		|||
        m_curr_config.object_id = -1;
 | 
			
		||||
        m_curr_config.volume_id = -1;
 | 
			
		||||
        m_objects_metadata.clear();
 | 
			
		||||
        m_layer_heights_profiles.clear();
 | 
			
		||||
        clear_errors();
 | 
			
		||||
 | 
			
		||||
        return _load_model_from_file(filename, model, bundle);
 | 
			
		||||
| 
						 | 
				
			
			@ -489,15 +494,15 @@ namespace Slic3r {
 | 
			
		|||
                        return false;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else if (boost::algorithm::iequals(name, LAYER_HEIGHTS_PROFILE_FILE))
 | 
			
		||||
                {
 | 
			
		||||
                    // extract slic3r lazer heights profile file
 | 
			
		||||
                    _extract_layer_heights_profile_config_from_archive(archive, stat);
 | 
			
		||||
                }
 | 
			
		||||
                else if (boost::algorithm::iequals(name, PRINT_CONFIG_FILE))
 | 
			
		||||
                {
 | 
			
		||||
                    // extract slic3r print config file
 | 
			
		||||
                    if (!_extract_print_config_from_archive(archive, stat, bundle, filename))
 | 
			
		||||
                    {
 | 
			
		||||
                        mz_zip_reader_end(&archive);
 | 
			
		||||
                        add_error("Archive does not contain a valid print config");
 | 
			
		||||
                        return false;
 | 
			
		||||
                    }
 | 
			
		||||
                    _extract_print_config_from_archive(archive, stat, bundle, filename);
 | 
			
		||||
                }
 | 
			
		||||
                else if (boost::algorithm::iequals(name, MODEL_CONFIG_FILE))
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			@ -526,6 +531,13 @@ namespace Slic3r {
 | 
			
		|||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            IdToLayerHeightsProfileMap::iterator obj_layer_heights_profile = m_layer_heights_profiles.find(object.first);
 | 
			
		||||
            if (obj_layer_heights_profile != m_layer_heights_profiles.end())
 | 
			
		||||
            {
 | 
			
		||||
                object.second->layer_height_profile = obj_layer_heights_profile->second;
 | 
			
		||||
                object.second->layer_height_profile_valid = true;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            IdToMetadataMap::iterator obj_metadata = m_objects_metadata.find(object.first);
 | 
			
		||||
            if (obj_metadata != m_objects_metadata.end())
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -609,23 +621,90 @@ namespace Slic3r {
 | 
			
		|||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool _3MF_Importer::_extract_print_config_from_archive(mz_zip_archive& archive, const mz_zip_archive_file_stat& stat, PresetBundle& bundle, const std::string& archive_filename)
 | 
			
		||||
    void _3MF_Importer::_extract_print_config_from_archive(mz_zip_archive& archive, const mz_zip_archive_file_stat& stat, PresetBundle& bundle, const std::string& archive_filename)
 | 
			
		||||
    {
 | 
			
		||||
        if (stat.m_uncomp_size > 0)
 | 
			
		||||
        {
 | 
			
		||||
            std::vector<char> buffer((size_t)stat.m_uncomp_size + 1, 0);
 | 
			
		||||
            std::string buffer((size_t)stat.m_uncomp_size, 0);
 | 
			
		||||
            mz_bool res = mz_zip_reader_extract_file_to_mem(&archive, stat.m_filename, (void*)buffer.data(), (size_t)stat.m_uncomp_size, 0);
 | 
			
		||||
            if (res == 0)
 | 
			
		||||
            {
 | 
			
		||||
                add_error("Error while reading config data to buffer");
 | 
			
		||||
                return false;
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            buffer.back() = '\0';
 | 
			
		||||
            bundle.load_config_string(buffer.data(), archive_filename.c_str());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
    void _3MF_Importer::_extract_layer_heights_profile_config_from_archive(mz_zip_archive& archive, const mz_zip_archive_file_stat& stat)
 | 
			
		||||
    {
 | 
			
		||||
        if (stat.m_uncomp_size > 0)
 | 
			
		||||
        {
 | 
			
		||||
            std::string buffer((size_t)stat.m_uncomp_size, 0);
 | 
			
		||||
            mz_bool res = mz_zip_reader_extract_file_to_mem(&archive, stat.m_filename, (void*)buffer.data(), (size_t)stat.m_uncomp_size, 0);
 | 
			
		||||
            if (res == 0)
 | 
			
		||||
            {
 | 
			
		||||
                add_error("Error while reading layer heights profile data to buffer");
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (buffer.back() == '\n')
 | 
			
		||||
                buffer.pop_back();
 | 
			
		||||
 | 
			
		||||
            std::vector<std::string> objects;
 | 
			
		||||
            boost::split(objects, buffer, boost::is_any_of("\n"), boost::token_compress_off);
 | 
			
		||||
 | 
			
		||||
            for (const std::string& object : objects)
 | 
			
		||||
            {
 | 
			
		||||
                std::vector<std::string> object_data;
 | 
			
		||||
                boost::split(object_data, object, boost::is_any_of("|"), boost::token_compress_off);
 | 
			
		||||
                if (object_data.size() != 2)
 | 
			
		||||
                {
 | 
			
		||||
                    add_error("Error while reading object data");
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                std::vector<std::string> object_data_id;
 | 
			
		||||
                boost::split(object_data_id, object_data[0], boost::is_any_of("="), boost::token_compress_off);
 | 
			
		||||
                if (object_data_id.size() != 2)
 | 
			
		||||
                {
 | 
			
		||||
                    add_error("Error while reading object id");
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                int object_id = std::atoi(object_data_id[1].c_str());
 | 
			
		||||
                if (object_id == 0)
 | 
			
		||||
                {
 | 
			
		||||
                    add_error("Found invalid object id");
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                IdToLayerHeightsProfileMap::iterator object_item = m_layer_heights_profiles.find(object_id);
 | 
			
		||||
                if (object_item != m_layer_heights_profiles.end())
 | 
			
		||||
                {
 | 
			
		||||
                    add_error("Found duplicated layer heights profile");
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                std::vector<std::string> object_data_profile;
 | 
			
		||||
                boost::split(object_data_profile, object_data[1], boost::is_any_of(";"), boost::token_compress_off);
 | 
			
		||||
                if ((object_data_profile.size() <= 4) || (object_data_profile.size() % 2 != 0))
 | 
			
		||||
                {
 | 
			
		||||
                    add_error("Found invalid layer heights profile");
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                std::vector<coordf_t> profile;
 | 
			
		||||
                profile.reserve(object_data_profile.size());
 | 
			
		||||
 | 
			
		||||
                for (const std::string& value : object_data_profile)
 | 
			
		||||
                {
 | 
			
		||||
                    profile.push_back((coordf_t)std::atof(value.c_str()));
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                m_layer_heights_profiles.insert(IdToLayerHeightsProfileMap::value_type(object_id, profile));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool _3MF_Importer::_extract_model_config_from_archive(mz_zip_archive& archive, const mz_zip_archive_file_stat& stat, Model& model)
 | 
			
		||||
| 
						 | 
				
			
			@ -1429,6 +1508,7 @@ namespace Slic3r {
 | 
			
		|||
        bool _add_object_to_model_stream(std::stringstream& stream, unsigned int& object_id, ModelObject& object, BuildItemsList& build_items, VolumeToOffsetsMap& volumes_offsets);
 | 
			
		||||
        bool _add_mesh_to_object_stream(std::stringstream& stream, ModelObject& object, VolumeToOffsetsMap& volumes_offsets);
 | 
			
		||||
        bool _add_build_to_model_stream(std::stringstream& stream, const BuildItemsList& build_items);
 | 
			
		||||
        bool _add_layer_height_profile_file_to_archive(mz_zip_archive& archive, Model& model);
 | 
			
		||||
        bool _add_print_config_file_to_archive(mz_zip_archive& archive, const Print& print);
 | 
			
		||||
        bool _add_model_config_file_to_archive(mz_zip_archive& archive, const Model& model);
 | 
			
		||||
    };
 | 
			
		||||
| 
						 | 
				
			
			@ -1477,6 +1557,14 @@ namespace Slic3r {
 | 
			
		|||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // adds layer height profile file
 | 
			
		||||
        if (!_add_layer_height_profile_file_to_archive(archive, model))
 | 
			
		||||
        {
 | 
			
		||||
            mz_zip_writer_end(&archive);
 | 
			
		||||
            boost::filesystem::remove(filename);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // adds slic3r print config file
 | 
			
		||||
        if (export_print_config)
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -1736,6 +1824,44 @@ namespace Slic3r {
 | 
			
		|||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool _3MF_Exporter::_add_layer_height_profile_file_to_archive(mz_zip_archive& archive, Model& model)
 | 
			
		||||
    {
 | 
			
		||||
        std::string out = "";
 | 
			
		||||
        char buffer[1024];
 | 
			
		||||
 | 
			
		||||
        unsigned int count = 0;
 | 
			
		||||
        for (const ModelObject* object : model.objects)
 | 
			
		||||
        {
 | 
			
		||||
            ++count;
 | 
			
		||||
            std::vector<double> layer_height_profile = object->layer_height_profile_valid ? object->layer_height_profile : std::vector<double>();
 | 
			
		||||
            if ((layer_height_profile.size() >= 4) && ((layer_height_profile.size() % 2) == 0))
 | 
			
		||||
            {
 | 
			
		||||
                sprintf(buffer, "object_id=%d|", count);
 | 
			
		||||
                out += buffer;
 | 
			
		||||
 | 
			
		||||
                // Store the layer height profile as a single semicolon separated list.
 | 
			
		||||
                for (size_t i = 0; i < layer_height_profile.size(); ++i)
 | 
			
		||||
                {
 | 
			
		||||
                    sprintf(buffer, (i == 0) ? "%f" : ";%f", layer_height_profile[i]);
 | 
			
		||||
                    out += buffer;
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
                out += "\n";
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!out.empty())
 | 
			
		||||
        {
 | 
			
		||||
            if (!mz_zip_writer_add_mem(&archive, LAYER_HEIGHTS_PROFILE_FILE.c_str(), (const void*)out.data(), out.length(), MZ_DEFAULT_COMPRESSION))
 | 
			
		||||
            {
 | 
			
		||||
                add_error("Unable to add layer heights profile file to archive");
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool _3MF_Exporter::_add_print_config_file_to_archive(mz_zip_archive& archive, const Print& print)
 | 
			
		||||
    {
 | 
			
		||||
        char buffer[1024];
 | 
			
		||||
| 
						 | 
				
			
			@ -1744,10 +1870,13 @@ namespace Slic3r {
 | 
			
		|||
 | 
			
		||||
        GCode::append_full_config(print, out);
 | 
			
		||||
 | 
			
		||||
        if (!mz_zip_writer_add_mem(&archive, PRINT_CONFIG_FILE.c_str(), (const void*)out.data(), out.length(), MZ_DEFAULT_COMPRESSION))
 | 
			
		||||
        if (!out.empty())
 | 
			
		||||
        {
 | 
			
		||||
            add_error("Unable to add print config file to archive");
 | 
			
		||||
            return false;
 | 
			
		||||
            if (!mz_zip_writer_add_mem(&archive, PRINT_CONFIG_FILE.c_str(), (const void*)out.data(), out.length(), MZ_DEFAULT_COMPRESSION))
 | 
			
		||||
            {
 | 
			
		||||
                add_error("Unable to add print config file to archive");
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
| 
						 | 
				
			
			@ -1832,10 +1961,7 @@ namespace Slic3r {
 | 
			
		|||
 | 
			
		||||
        _3MF_Importer importer;
 | 
			
		||||
        bool res = importer.load_model_from_file(path, *model, *bundle);
 | 
			
		||||
 | 
			
		||||
        if (!res)
 | 
			
		||||
            importer.log_errors();
 | 
			
		||||
 | 
			
		||||
        importer.log_errors();
 | 
			
		||||
        return res;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -9,13 +9,17 @@ namespace Slic3r {
 | 
			
		|||
 | 
			
		||||
class GCode;
 | 
			
		||||
class Layer;
 | 
			
		||||
class PerExtruderAdjustments;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
A standalone G-code filter, to control cooling of the print.
 | 
			
		||||
The G-code is processed per layer. Once a layer is collected, fan start / stop commands are edited
 | 
			
		||||
and the print is modified to stretch over a minimum layer time.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
// A standalone G-code filter, to control cooling of the print.
 | 
			
		||||
// The G-code is processed per layer. Once a layer is collected, fan start / stop commands are edited
 | 
			
		||||
// and the print is modified to stretch over a minimum layer time.
 | 
			
		||||
//
 | 
			
		||||
// The simple it sounds, the actual implementation is significantly more complex.
 | 
			
		||||
// Namely, for a multi-extruder print, each material may require a different cooling logic.
 | 
			
		||||
// For example, some materials may not like to print too slowly, while with some materials 
 | 
			
		||||
// we may slow down significantly.
 | 
			
		||||
//
 | 
			
		||||
class CoolingBuffer {
 | 
			
		||||
public:
 | 
			
		||||
    CoolingBuffer(GCode &gcodegen);
 | 
			
		||||
| 
						 | 
				
			
			@ -25,7 +29,12 @@ public:
 | 
			
		|||
    GCode* 	    gcodegen() { return &m_gcodegen; }
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	CoolingBuffer& operator=(const CoolingBuffer&);
 | 
			
		||||
	CoolingBuffer& operator=(const CoolingBuffer&) = delete;
 | 
			
		||||
    std::vector<PerExtruderAdjustments> parse_layer_gcode(const std::string &gcode, std::vector<float> ¤t_pos) const;
 | 
			
		||||
    float       calculate_layer_slowdown(std::vector<PerExtruderAdjustments> &per_extruder_adjustments);
 | 
			
		||||
    // Apply slow down over G-code lines stored in per_extruder_adjustments, enable fan if needed.
 | 
			
		||||
    // Returns the adjusted G-code.
 | 
			
		||||
    std::string apply_layer_cooldown(const std::string &gcode, size_t layer_id, float layer_time, std::vector<PerExtruderAdjustments> &per_extruder_adjustments);
 | 
			
		||||
 | 
			
		||||
    GCode&              m_gcodegen;
 | 
			
		||||
    std::string         m_gcode;
 | 
			
		||||
| 
						 | 
				
			
			@ -34,6 +43,9 @@ private:
 | 
			
		|||
    std::vector<char>   m_axis;
 | 
			
		||||
    std::vector<float>  m_current_pos;
 | 
			
		||||
    unsigned int        m_current_extruder;
 | 
			
		||||
 | 
			
		||||
    // Old logic: proportional.
 | 
			
		||||
    bool                m_cooling_logic_proportional = false;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -99,17 +99,31 @@ void GCodePreviewData::Range::set_from(const Range& other)
 | 
			
		|||
 | 
			
		||||
float GCodePreviewData::Range::step_size() const
 | 
			
		||||
{
 | 
			
		||||
    return (max - min) / (float)Colors_Count;
 | 
			
		||||
    return (max - min) / (float)(Colors_Count - 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const GCodePreviewData::Color& GCodePreviewData::Range::get_color_at_max() const
 | 
			
		||||
GCodePreviewData::Color GCodePreviewData::Range::get_color_at(float value) const
 | 
			
		||||
{
 | 
			
		||||
    return colors[Colors_Count - 1];
 | 
			
		||||
}
 | 
			
		||||
    if (empty())
 | 
			
		||||
        return Color::Dummy;
 | 
			
		||||
 | 
			
		||||
const GCodePreviewData::Color& GCodePreviewData::Range::get_color_at(float value) const
 | 
			
		||||
{
 | 
			
		||||
    return empty() ? get_color_at_max() : colors[clamp((unsigned int)0, Colors_Count - 1, (unsigned int)((value - min) / step_size()))];
 | 
			
		||||
    float global_t = (value - min) / step_size();
 | 
			
		||||
 | 
			
		||||
    unsigned int low = (unsigned int)global_t;
 | 
			
		||||
    unsigned int high = clamp((unsigned int)0, Colors_Count - 1, low + 1);
 | 
			
		||||
 | 
			
		||||
    Color color_low = colors[low];
 | 
			
		||||
    Color color_high = colors[high];
 | 
			
		||||
 | 
			
		||||
    float local_t = global_t - (float)low;
 | 
			
		||||
 | 
			
		||||
    // interpolate in RGB space
 | 
			
		||||
    Color ret;
 | 
			
		||||
    for (unsigned int i = 0; i < 4; ++i)
 | 
			
		||||
    {
 | 
			
		||||
        ret.rgba[i] = lerp(color_low.rgba[i], color_high.rgba[i], local_t);
 | 
			
		||||
    }
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GCodePreviewData::LegendItem::LegendItem(const std::string& text, const GCodePreviewData::Color& color)
 | 
			
		||||
| 
						 | 
				
			
			@ -266,22 +280,22 @@ const GCodePreviewData::Color& GCodePreviewData::get_extrusion_role_color(Extrus
 | 
			
		|||
    return extrusion.role_colors[role];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const GCodePreviewData::Color& GCodePreviewData::get_height_color(float height) const
 | 
			
		||||
GCodePreviewData::Color GCodePreviewData::get_height_color(float height) const
 | 
			
		||||
{
 | 
			
		||||
    return ranges.height.get_color_at(height);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const GCodePreviewData::Color& GCodePreviewData::get_width_color(float width) const
 | 
			
		||||
GCodePreviewData::Color GCodePreviewData::get_width_color(float width) const
 | 
			
		||||
{
 | 
			
		||||
    return ranges.width.get_color_at(width);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const GCodePreviewData::Color& GCodePreviewData::get_feedrate_color(float feedrate) const
 | 
			
		||||
GCodePreviewData::Color GCodePreviewData::get_feedrate_color(float feedrate) const
 | 
			
		||||
{
 | 
			
		||||
    return ranges.feedrate.get_color_at(feedrate);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const GCodePreviewData::Color& GCodePreviewData::get_volumetric_rate_color(float rate) const
 | 
			
		||||
GCodePreviewData::Color GCodePreviewData::get_volumetric_rate_color(float rate) const
 | 
			
		||||
{
 | 
			
		||||
    return ranges.volumetric_rate.get_color_at(rate);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -373,7 +387,7 @@ GCodePreviewData::LegendItemsList GCodePreviewData::get_legend_items(const std::
 | 
			
		|||
            for (int i = Range::Colors_Count - 1; i >= 0; --i)
 | 
			
		||||
            {
 | 
			
		||||
                char buf[1024];
 | 
			
		||||
                sprintf(buf, "%.*f/%.*f", decimals, scale_factor * (range.min + (float)i * step), decimals, scale_factor * (range.min + (float)(i + 1) * step));
 | 
			
		||||
                sprintf(buf, "%.*f", decimals, scale_factor * (range.min + (float)i * step));
 | 
			
		||||
                list.emplace_back(buf, range.colors[i]);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -408,7 +422,7 @@ GCodePreviewData::LegendItemsList GCodePreviewData::get_legend_items(const std::
 | 
			
		|||
        }
 | 
			
		||||
    case Extrusion::Feedrate:
 | 
			
		||||
        {
 | 
			
		||||
            Helper::FillListFromRange(items, ranges.feedrate, 0, 1.0f);
 | 
			
		||||
            Helper::FillListFromRange(items, ranges.feedrate, 1, 1.0f);
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    case Extrusion::VolumetricRate:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,8 +41,7 @@ public:
 | 
			
		|||
        void set_from(const Range& other);
 | 
			
		||||
        float step_size() const;
 | 
			
		||||
 | 
			
		||||
        const Color& get_color_at(float value) const;
 | 
			
		||||
        const Color& get_color_at_max() const;
 | 
			
		||||
        Color get_color_at(float value) const;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    struct Ranges
 | 
			
		||||
| 
						 | 
				
			
			@ -189,10 +188,10 @@ public:
 | 
			
		|||
    bool empty() const;
 | 
			
		||||
 | 
			
		||||
    const Color& get_extrusion_role_color(ExtrusionRole role) const;
 | 
			
		||||
    const Color& get_height_color(float height) const;
 | 
			
		||||
    const Color& get_width_color(float width) const;
 | 
			
		||||
    const Color& get_feedrate_color(float feedrate) const;
 | 
			
		||||
    const Color& get_volumetric_rate_color(float rate) const;
 | 
			
		||||
    Color get_height_color(float height) const;
 | 
			
		||||
    Color get_width_color(float width) const;
 | 
			
		||||
    Color get_feedrate_color(float feedrate) const;
 | 
			
		||||
    Color get_volumetric_rate_color(float rate) const;
 | 
			
		||||
 | 
			
		||||
    void set_extrusion_role_color(const std::string& role_name, float red, float green, float blue, float alpha);
 | 
			
		||||
    void set_extrusion_paths_colors(const std::vector<std::string>& colors);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,6 +53,7 @@
 | 
			
		|||
#include "ConfigWizard.hpp"
 | 
			
		||||
#include "Preferences.hpp"
 | 
			
		||||
#include "PresetBundle.hpp"
 | 
			
		||||
#include "UpdateDialogs.hpp"
 | 
			
		||||
 | 
			
		||||
#include "../Utils/PresetUpdater.hpp"
 | 
			
		||||
#include "../Config/Snapshot.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -480,24 +481,8 @@ bool config_wizard_startup(bool app_config_exists)
 | 
			
		|||
		// Looks like user has legacy pre-vendorbundle data directory,
 | 
			
		||||
		// explain what this is and run the wizard
 | 
			
		||||
 | 
			
		||||
		const auto msg = _(L("Configuration update"));
 | 
			
		||||
		const auto ext_msg = wxString::Format(
 | 
			
		||||
			_(L(
 | 
			
		||||
				"Slic3r PE now uses an updated configuration structure.\n\n"
 | 
			
		||||
 | 
			
		||||
				"So called 'System presets' have been introduced, which hold the built-in default settings for various "
 | 
			
		||||
				"printers. These System presets cannot be modified, instead, users now may create their"
 | 
			
		||||
				"own presets inheriting settings from one of the System presets.\n"
 | 
			
		||||
				"An inheriting preset may either inherit a particular value from its parent or override it with a customized value.\n\n"
 | 
			
		||||
 | 
			
		||||
				"Please proceed with the %s that follows to set up the new presets "
 | 
			
		||||
				"and to choose whether to enable automatic preset updates."
 | 
			
		||||
			)),
 | 
			
		||||
			ConfigWizard::name()
 | 
			
		||||
		);
 | 
			
		||||
		wxMessageDialog dlg(NULL, msg, _(L("Configuration update")), wxOK|wxCENTRE);
 | 
			
		||||
		dlg.SetExtendedMessage(ext_msg);
 | 
			
		||||
		const auto res = dlg.ShowModal();
 | 
			
		||||
		MsgDataLegacy dlg;
 | 
			
		||||
		dlg.ShowModal();
 | 
			
		||||
 | 
			
		||||
		config_wizard(ConfigWizard::RR_DATA_LEGACY);
 | 
			
		||||
		return true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1004,29 +1004,6 @@ void TabPrint::update()
 | 
			
		|||
		on_value_change("fill_density", fill_density);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	auto first_layer_height = m_config->option<ConfigOptionFloatOrPercent>("first_layer_height")->value;
 | 
			
		||||
	auto layer_height = m_config->opt_float("layer_height");
 | 
			
		||||
	if (m_config->opt_bool("wipe_tower") &&
 | 
			
		||||
		(first_layer_height != 0.2 || layer_height < 0.15 || layer_height > 0.35)) {
 | 
			
		||||
		wxString msg_text = _(L("The Wipe Tower currently supports only:\n"
 | 
			
		||||
			"- first layer height 0.2mm\n"
 | 
			
		||||
			"- layer height from 0.15mm to 0.35mm\n"
 | 
			
		||||
			"\nShall I adjust those settings in order to enable the Wipe Tower?"));
 | 
			
		||||
		auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Wipe Tower")), wxICON_WARNING | wxYES | wxNO);
 | 
			
		||||
		DynamicPrintConfig new_conf = *m_config;
 | 
			
		||||
		if (dialog->ShowModal() == wxID_YES) {
 | 
			
		||||
			const auto &val = *m_config->option<ConfigOptionFloatOrPercent>("first_layer_height");
 | 
			
		||||
			auto percent = val.percent;
 | 
			
		||||
			new_conf.set_key_value("first_layer_height", new ConfigOptionFloatOrPercent(0.2, percent));
 | 
			
		||||
 | 
			
		||||
			if (m_config->opt_float("layer_height") < 0.15) new_conf.set_key_value("layer_height", new ConfigOptionFloat(0.15));
 | 
			
		||||
			if (m_config->opt_float("layer_height") > 0.35) new_conf.set_key_value("layer_height", new ConfigOptionFloat(0.35));
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
			new_conf.set_key_value("wipe_tower", new ConfigOptionBool(false));
 | 
			
		||||
		load_config(new_conf);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (m_config->opt_bool("wipe_tower") && m_config->opt_bool("support_material") &&
 | 
			
		||||
		m_config->opt_float("support_material_contact_distance") > 0. &&
 | 
			
		||||
		(m_config->opt_int("support_material_extruder") != 0 || m_config->opt_int("support_material_interface_extruder") != 0)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,6 +12,7 @@
 | 
			
		|||
#include "libslic3r/libslic3r.h"
 | 
			
		||||
#include "libslic3r/Utils.hpp"
 | 
			
		||||
#include "GUI.hpp"
 | 
			
		||||
#include "ConfigWizard.hpp"
 | 
			
		||||
 | 
			
		||||
namespace Slic3r {
 | 
			
		||||
namespace GUI {
 | 
			
		||||
| 
						 | 
				
			
			@ -201,5 +202,36 @@ MsgDataIncompatible::MsgDataIncompatible(const std::unordered_map<std::string, w
 | 
			
		|||
MsgDataIncompatible::~MsgDataIncompatible() {}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// MsgDataLegacy
 | 
			
		||||
 | 
			
		||||
MsgDataLegacy::MsgDataLegacy() :
 | 
			
		||||
	MsgDialog(_(L("Configuration update")), _(L("Configuration update")))
 | 
			
		||||
{
 | 
			
		||||
	auto *text = new wxStaticText(this, wxID_ANY, wxString::Format(
 | 
			
		||||
		_(L(
 | 
			
		||||
			"Slic3r PE now uses an updated configuration structure.\n\n"
 | 
			
		||||
 | 
			
		||||
			"So called 'System presets' have been introduced, which hold the built-in default settings for various "
 | 
			
		||||
			"printers. These System presets cannot be modified, instead, users now may create their "
 | 
			
		||||
			"own presets inheriting settings from one of the System presets.\n"
 | 
			
		||||
			"An inheriting preset may either inherit a particular value from its parent or override it with a customized value.\n\n"
 | 
			
		||||
 | 
			
		||||
			"Please proceed with the %s that follows to set up the new presets "
 | 
			
		||||
			"and to choose whether to enable automatic preset updates."
 | 
			
		||||
		)),
 | 
			
		||||
		ConfigWizard::name()
 | 
			
		||||
	));
 | 
			
		||||
	text->Wrap(CONTENT_WIDTH);
 | 
			
		||||
	content_sizer->Add(text);
 | 
			
		||||
	content_sizer->AddSpacer(VERT_SPACING);
 | 
			
		||||
 | 
			
		||||
	// TODO: Add link to wiki?
 | 
			
		||||
 | 
			
		||||
	Fit();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MsgDataLegacy::~MsgDataLegacy() {}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -85,6 +85,18 @@ public:
 | 
			
		|||
	~MsgDataIncompatible();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Informs about a legacy data directory - an update from Slic3r PE < 1.40
 | 
			
		||||
class MsgDataLegacy : public MsgDialog
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
	MsgDataLegacy();
 | 
			
		||||
	MsgDataLegacy(MsgDataLegacy &&) = delete;
 | 
			
		||||
	MsgDataLegacy(const MsgDataLegacy &) = delete;
 | 
			
		||||
	MsgDataLegacy &operator=(MsgDataLegacy &&) = delete;
 | 
			
		||||
	MsgDataLegacy &operator=(const MsgDataLegacy &) = delete;
 | 
			
		||||
	~MsgDataLegacy();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue