public ToolLayerReHeightControl()
        {
            InitializeComponent();
            BaseOperation = new OperationLayerReHeight(SlicerFile);
            var presets = Presets;

            if (presets is null || presets.Length == 0)
            {
                App.MainWindow.MessageBoxInfo("No valid configuration to be able to re-height.\n" +
                                              "As workaround clone first or last layer and try re run this tool.", "Not possible to re-height");
                CanRun = false;
            }
        public ToolLayerReHeightControl()
        {
            InitializeComponent();
            BaseOperation = Operation = new OperationLayerReHeight();

            if (Presets.Length == 0)
            {
                App.MainWindow.MessageBoxInfo("No valid configuration to be able to re-height, closing this tool now.", "Not possible to re-height");
                CanRun = false;
            }
            else
            {
                Operation.Item = Presets[0];
            }


            DataContext = this;
        }
Пример #3
0
        public CtrlToolLayerReHeight()
        {
            InitializeComponent();
            Operation = new OperationLayerReHeight();
            SetOperation(Operation);

            lbCurrent.Text = $"Current layers: {Program.SlicerFile.LayerCount} at {Program.SlicerFile.LayerHeight}mm";

            if (Presets.Length > 0)
            {
                cbMultiplier.Items.AddRange(Presets);
                cbMultiplier.SelectedIndex = 0;
            }
            else
            {
                GUIExtensions.MessageBoxInformation("Not possible to re-height", "No valid configuration to be able to re-height, closing this tool now.");
                CanRun = false;
            }
        }
Пример #4
0
        public FrmToolLayerReHeight(uint layerCount, float layerHeight)
        {
            InitializeComponent();
            DialogResult = DialogResult.Cancel;

            LayerCount  = layerCount;
            LayerHeight = (decimal)layerHeight;

            lbCurrent.Text = $"Current layers: {LayerCount} at {layerHeight}mm";

            for (byte i = 2; i < 255; i++) // Lower
            {
                if (LayerHeight / i < 0.01m)
                {
                    break;
                }
                var countStr = (LayerCount / (decimal)i).ToString(CultureInfo.InvariantCulture);
                if (countStr.IndexOf(".", StringComparison.Ordinal) >= 0)
                {
                    continue;                                                       // Cant multiply layers
                }
                countStr = (LayerHeight / i).ToString(CultureInfo.InvariantCulture);
                int decimalCount = countStr.Substring(countStr.IndexOf(".", StringComparison.Ordinal)).Length - 1;
                if (decimalCount > 2)
                {
                    continue;                   // Cant multiply height
                }
                OperationLayerReHeight operation = new OperationLayerReHeight(false, i, LayerHeight / i, LayerCount * i);
                cbMultiplier.Items.Add(operation);
            }

            for (byte i = 2; i < 255; i++) // Higher
            {
                if (LayerHeight * i > 0.2m)
                {
                    break;
                }
                var countStr = (LayerCount / (decimal)i).ToString(CultureInfo.InvariantCulture);
                if (countStr.IndexOf(".", StringComparison.Ordinal) >= 0)
                {
                    continue;                                                       // Cant multiply layers
                }
                countStr = (LayerHeight * i).ToString(CultureInfo.InvariantCulture);
                int decimalCount = countStr.Substring(countStr.IndexOf(".", StringComparison.Ordinal)).Length - 1;
                if (decimalCount > 2)
                {
                    continue;                   // Cant multiply height
                }
                OperationLayerReHeight operation = new OperationLayerReHeight(true, i, LayerHeight * i, LayerCount / i);
                cbMultiplier.Items.Add(operation);
            }

            if (cbMultiplier.Items.Count == 0)
            {
                MessageBox.Show("No valid configuration to be able to re-height, closing this tool now.", "Not possible to re-height", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Close();
            }
            else
            {
                cbMultiplier.SelectedIndex = 0;
            }
        }