Exemple #1
0
        public int LastLayerWithChange(ConfigSettings config)
        {
            if (calculatedLastLayer)
            {
                return(lastLayerWithCange);
            }

            int numLayers             = Extruders[0].Layers.Count;
            int firstExtruderWithData = -1;

            for (int checkLayer = numLayers - 1; checkLayer >= 0; checkLayer--)
            {
                for (int extruderToCheck = 0; extruderToCheck < config.ExtruderCount; extruderToCheck++)
                {
                    if ((extruderToCheck < Extruders.Count && Extruders[extruderToCheck].Layers[checkLayer].AllOutlines.Count > 0) ||
                        (config.SupportExtruder == extruderToCheck && support != null && support.HasNormalSupport(checkLayer)) ||
                        (config.SupportInterfaceExtruder == extruderToCheck && support != null && support.HasInterfaceSupport(checkLayer)))
                    {
                        if (firstExtruderWithData == -1)
                        {
                            firstExtruderWithData = extruderToCheck;
                        }
                        else
                        {
                            if (firstExtruderWithData != extruderToCheck)
                            {
                                // have to remember the layer one above this so that we can switch back
                                lastLayerWithCange  = checkLayer + 1;
                                calculatedLastLayer = true;
                                return(lastLayerWithCange);
                            }
                        }
                    }
                }
            }

            calculatedLastLayer = true;
            return(-1);
        }
        public int LastLayerWithChange(ConfigSettings config)
        {
            int numLayers             = Extruders[0].Layers.Count;
            int firstExtruderWithData = -1;

            for (int checkLayer = numLayers - 1; checkLayer >= 0; checkLayer--)
            {
                for (int extruderToCheck = 0; extruderToCheck < config.MaxExtruderCount(); extruderToCheck++)
                {
                    if ((extruderToCheck < Extruders.Count && Extruders[extruderToCheck].Layers[checkLayer].AllOutlines.Count > 0) ||
                        (config.SupportExtruder == extruderToCheck && support != null && support.HasNormalSupport(checkLayer)) ||
                        (config.SupportInterfaceExtruder == extruderToCheck && support != null && support.HasInterfaceSupport(checkLayer)))
                    {
                        if (firstExtruderWithData == -1)
                        {
                            firstExtruderWithData = extruderToCheck;
                        }
                        else
                        {
                            if (firstExtruderWithData != extruderToCheck)
                            {
                                return(checkLayer);
                            }
                        }
                    }
                }
            }

            return(-1);
        }