mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Fix of Enforce support for first N layers has no effect #470
This commit is contained in:
		
							parent
							
								
									055d2321e7
								
							
						
					
					
						commit
						d2c46025c7
					
				
					 9 changed files with 18 additions and 20 deletions
				
			
		| 
						 | 
				
			
			@ -486,7 +486,7 @@ std::vector<GCode::LayerToPrint> GCode::collect_layers_to_print(const PrintObjec
 | 
			
		|||
    //FIXME should we use the printing extruders instead?
 | 
			
		||||
    double gap_over_supports = object.config().support_material_contact_distance;
 | 
			
		||||
    // FIXME should we test object.config().support_material_synchronize_layers ? Currently the support layers are synchronized with object layers iff soluble supports.
 | 
			
		||||
    assert(!object.config().support_material || gap_over_supports != 0. || object.config().support_material_synchronize_layers);
 | 
			
		||||
    assert(!object.has_support() || gap_over_supports != 0. || object.config().support_material_synchronize_layers);
 | 
			
		||||
    if (gap_over_supports != 0.) {
 | 
			
		||||
        gap_over_supports = std::max(0., gap_over_supports);
 | 
			
		||||
        // Not a soluble support,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -277,7 +277,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly
 | 
			
		|||
				double custom_angle = Geometry::deg2rad(this->region()->config().bridge_angle.value);
 | 
			
		||||
				if (bd.detect_angle(custom_angle)) {
 | 
			
		||||
                    bridges[idx_last].bridge_angle = bd.angle;
 | 
			
		||||
                    if (this->layer()->object()->config().support_material) {
 | 
			
		||||
                    if (this->layer()->object()->has_support()) {
 | 
			
		||||
//                        polygons_append(this->bridged, bd.coverage());
 | 
			
		||||
                        append(this->unsupported_bridge_edges, bd.unsupported_edges());
 | 
			
		||||
                    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -198,7 +198,8 @@ static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perime
 | 
			
		|||
            fuzzy_polygon(fuzzified, scaled<float>(perimeter_generator.config->fuzzy_skin_thickness.value), scaled<float>(perimeter_generator.config->fuzzy_skin_point_dist.value));
 | 
			
		||||
        }
 | 
			
		||||
        if (perimeter_generator.config->overhangs && perimeter_generator.layer_id > 0
 | 
			
		||||
            && !(perimeter_generator.object_config->support_material && perimeter_generator.object_config->support_material_contact_distance.value == 0)) {
 | 
			
		||||
            && ! ((perimeter_generator.object_config->support_material || perimeter_generator.object_config->support_material_enforce_layers > 0) && 
 | 
			
		||||
                  perimeter_generator.object_config->support_material_contact_distance.value == 0)) {
 | 
			
		||||
            // get non-overhang paths by intersecting this loop with the grown lower slices
 | 
			
		||||
            extrusion_paths_append(
 | 
			
		||||
                paths,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1418,7 +1418,7 @@ std::string Print::validate() const
 | 
			
		|||
			return true;
 | 
			
		||||
		};
 | 
			
		||||
        for (PrintObject *object : m_objects) {
 | 
			
		||||
            if (object->config().raft_layers > 0 || object->config().support_material.value) {
 | 
			
		||||
            if (object->has_support_material()) {
 | 
			
		||||
				if ((object->config().support_material_extruder == 0 || object->config().support_material_interface_extruder == 0) && max_nozzle_diameter - min_nozzle_diameter > EPSILON) {
 | 
			
		||||
                    // The object has some form of support and either support_material_extruder or support_material_interface_extruder
 | 
			
		||||
                    // will be printed with the current tool without a forced tool change. Play safe, assert that all object nozzles
 | 
			
		||||
| 
						 | 
				
			
			@ -1444,7 +1444,7 @@ std::string Print::validate() const
 | 
			
		|||
            // validate first_layer_height
 | 
			
		||||
            double first_layer_height = object->config().get_abs_value("first_layer_height");
 | 
			
		||||
            double first_layer_min_nozzle_diameter;
 | 
			
		||||
            if (object->config().raft_layers > 0) {
 | 
			
		||||
            if (object->has_raft()) {
 | 
			
		||||
                // if we have raft layers, only support material extruder is used on first layer
 | 
			
		||||
                size_t first_layer_extruder = object->config().raft_layers == 1
 | 
			
		||||
                    ? object->config().support_material_interface_extruder-1
 | 
			
		||||
| 
						 | 
				
			
			@ -1468,7 +1468,7 @@ std::string Print::validate() const
 | 
			
		|||
            std::string err_msg;
 | 
			
		||||
            if (! validate_extrusion_width(object->config(), "extrusion_width", layer_height, err_msg))
 | 
			
		||||
            	return err_msg;
 | 
			
		||||
            if ((object->config().support_material || object->config().raft_layers > 0) && ! validate_extrusion_width(object->config(), "support_material_extrusion_width", layer_height, err_msg))
 | 
			
		||||
            if ((object->has_support() || object->has_raft()) && ! validate_extrusion_width(object->config(), "support_material_extrusion_width", layer_height, err_msg))
 | 
			
		||||
            	return err_msg;
 | 
			
		||||
            for (const char *opt_key : { "perimeter_extrusion_width", "external_perimeter_extrusion_width", "infill_extrusion_width", "solid_infill_extrusion_width", "top_infill_extrusion_width" })
 | 
			
		||||
				for (size_t i = 0; i < object->region_volumes.size(); ++ i)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -222,6 +222,10 @@ public:
 | 
			
		|||
    const SlicingParameters&    slicing_parameters() const { return m_slicing_params; }
 | 
			
		||||
    static SlicingParameters    slicing_parameters(const DynamicPrintConfig &full_config, const ModelObject &model_object, float object_max_z);
 | 
			
		||||
 | 
			
		||||
    bool                        has_support()           const { return m_config.support_material || m_config.support_material_enforce_layers > 0; }
 | 
			
		||||
    bool                        has_raft()              const { return m_config.raft_layers > 0; }
 | 
			
		||||
    bool                        has_support_material()  const { return this->has_support() || this->has_raft(); }
 | 
			
		||||
 | 
			
		||||
    // returns 0-based indices of extruders used to print the object (without brim, support and other helper extrusions)
 | 
			
		||||
    std::vector<unsigned int>   object_extruders() const;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -270,7 +274,7 @@ private:
 | 
			
		|||
    void _slice(const std::vector<coordf_t> &layer_height_profile);
 | 
			
		||||
    std::string _fix_slicing_errors();
 | 
			
		||||
    void simplify_slices(double distance);
 | 
			
		||||
    bool has_support_material() const;
 | 
			
		||||
    // Has any support (not counting the raft).
 | 
			
		||||
    void detect_surfaces_type();
 | 
			
		||||
    void process_external_surfaces();
 | 
			
		||||
    void discover_vertical_shells();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -418,7 +418,7 @@ void PrintObject::generate_support_material()
 | 
			
		|||
{
 | 
			
		||||
    if (this->set_started(posSupportMaterial)) {
 | 
			
		||||
        this->clear_support_layers();
 | 
			
		||||
        if ((m_config.support_material || m_config.raft_layers > 0) && m_layers.size() > 1) {
 | 
			
		||||
        if (this->has_support_material() && m_layers.size() > 1) {
 | 
			
		||||
            m_print->set_status(85, L("Generating support material"));    
 | 
			
		||||
            this->_generate_support_material();
 | 
			
		||||
            m_print->throw_if_canceled();
 | 
			
		||||
| 
						 | 
				
			
			@ -713,13 +713,6 @@ bool PrintObject::invalidate_all_steps()
 | 
			
		|||
	return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool PrintObject::has_support_material() const
 | 
			
		||||
{
 | 
			
		||||
    return m_config.support_material
 | 
			
		||||
        || m_config.raft_layers > 0
 | 
			
		||||
        || m_config.support_material_enforce_layers > 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const PrintRegion* first_printing_region(const PrintObject &print_object)
 | 
			
		||||
{
 | 
			
		||||
    for (size_t idx_region = 0; idx_region < print_object.region_volumes.size(); ++ idx_region)
 | 
			
		||||
| 
						 | 
				
			
			@ -773,12 +766,12 @@ void PrintObject::detect_surfaces_type()
 | 
			
		|||
            [this, idx_region, interface_shells, &surfaces_new](const tbb::blocked_range<size_t>& range) {
 | 
			
		||||
                // If we have raft layers, consider bottom layer as a bridge just like any other bottom surface lying on the void.
 | 
			
		||||
                SurfaceType surface_type_bottom_1st =
 | 
			
		||||
                    (m_config.raft_layers.value > 0 && m_config.support_material_contact_distance.value > 0) ?
 | 
			
		||||
                    (this->has_raft() && m_config.support_material_contact_distance.value > 0) ?
 | 
			
		||||
                    stBottomBridge : stBottom;
 | 
			
		||||
                // If we have soluble support material, don't bridge. The overhang will be squished against a soluble layer separating
 | 
			
		||||
                // the support from the print.
 | 
			
		||||
                SurfaceType surface_type_bottom_other =
 | 
			
		||||
                    (m_config.support_material.value && m_config.support_material_contact_distance.value == 0) ?
 | 
			
		||||
                    (this->has_support() && m_config.support_material_contact_distance.value == 0) ?
 | 
			
		||||
                    stBottom : stBottomBridge;
 | 
			
		||||
                for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++ idx_layer) {
 | 
			
		||||
                    m_print->throw_if_canceled();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -88,7 +88,7 @@ SlicingParameters SlicingParameters::create_from_config(
 | 
			
		|||
    // Miniumum/maximum of the minimum layer height over all extruders.
 | 
			
		||||
    params.min_layer_height = MIN_LAYER_HEIGHT;
 | 
			
		||||
    params.max_layer_height = std::numeric_limits<double>::max();
 | 
			
		||||
    if (object_config.support_material.value || params.base_raft_layers > 0) {
 | 
			
		||||
    if (object_config.support_material.value || params.base_raft_layers > 0 || object_config.support_material_enforce_layers > 0) {
 | 
			
		||||
        // Has some form of support. Add the support layers to the minimum / maximum layer height limits.
 | 
			
		||||
        params.min_layer_height = std::max(
 | 
			
		||||
            min_layer_height_from_nozzle(print_config, object_config.support_material_extruder), 
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1282,7 +1282,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
 | 
			
		|||
    // Output layers, sorted by top Z.
 | 
			
		||||
    MyLayersPtr contact_out;
 | 
			
		||||
 | 
			
		||||
    const bool   support_auto  = m_object_config->support_material_auto.value;
 | 
			
		||||
    const bool   support_auto  = m_object_config->support_material.value && m_object_config->support_material_auto.value;
 | 
			
		||||
    // If user specified a custom angle threshold, convert it to radians.
 | 
			
		||||
    // Zero means automatic overhang detection.
 | 
			
		||||
    const double threshold_rad = (m_object_config->support_material_threshold.value > 0) ? 
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -151,7 +151,7 @@ public:
 | 
			
		|||
	// Is raft enabled?
 | 
			
		||||
	bool 		has_raft() 					const { return m_slicing_params.has_raft(); }
 | 
			
		||||
	// Has any support?
 | 
			
		||||
	bool 		has_support()				const { return m_object_config->support_material.value; }
 | 
			
		||||
	bool 		has_support()				const { return m_object_config->support_material.value || m_object_config->support_material_enforce_layers; }
 | 
			
		||||
	bool 		build_plate_only() 			const { return this->has_support() && m_object_config->support_material_buildplate_only.value; }
 | 
			
		||||
 | 
			
		||||
	bool 		synchronize_layers()		const { return m_slicing_params.soluble_interface && m_object_config->support_material_synchronize_layers.value; }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue