コード例 #1
0
        private void OperationOnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(Operation.LayerIndexStart) && Operation.PerLayerOverride)
            {
                SlicerFile.RefreshPrintParametersPerLayerModifiersValues(Operation.LayerIndexStart);
                PopulateGrid();
                return;
            }
            if (e.PropertyName == nameof(Operation.PerLayerOverride))
            {
                if (Operation.PerLayerOverride)
                {
                    Operation.Modifiers = App.SlicerFile.PrintParameterPerLayerModifiers;
                    SlicerFile.RefreshPrintParametersPerLayerModifiersValues(Operation.LayerIndexStart);
                }
                else
                {
                    Operation.Modifiers = App.SlicerFile.PrintParameterModifiers;
                    SlicerFile.RefreshPrintParametersModifiersValues();
                }

                ParentWindow.LayerRangeVisible = Operation.PerLayerOverride;
                PopulateGrid();
                return;
            }
        }
コード例 #2
0
 public void OnClickRebuildGcode()
 {
     if (!HaveGCode)
     {
         return;
     }
     SlicerFile.RebuildGCode();
     RaisePropertyChanged(nameof(GCodeLines));
     RaisePropertyChanged(nameof(GCodeStr));
 }
コード例 #3
0
        public ToolDynamicLayerHeightControl()
        {
            BaseOperation = new OperationDynamicLayerHeight(SlicerFile);

            if (SlicerFile.LayerHeight * 2 > FileFormat.MaximumLayerHeight)
            {
                App.MainWindow.MessageBoxError($"This file already uses the maximum layer height possible ({SlicerFile.LayerHeight}mm).\n" +
                                               $"Layers can not be stacked, please re-slice your file with the lowest layer height of 0.01mm.",
                                               $"{BaseOperation.Title} unable to run");
                CanRun = false;
                return;
            }

            for (uint layerIndex = 1; layerIndex < SlicerFile.LayerCount; layerIndex++)
            {
                if ((decimal)Math.Round(SlicerFile[layerIndex].PositionZ - SlicerFile[layerIndex - 1].PositionZ, Layer.HeightPrecision) ==
                    (decimal)SlicerFile.LayerHeight)
                {
                    continue;
                }
                App.MainWindow.MessageBoxError($"This file contain layer(s) with modified positions, starting at layer {layerIndex}.\n" +
                                               $"This tool requires sequential layers with equal height.\n" +
                                               $"If you run this tool before, you cant re-run.",
                                               $"{BaseOperation.Title} unable to run");
                CanRun = false;
                return;
            }

            if (!SlicerFile.HavePrintParameterPerLayerModifier(FileFormat.PrintParameterModifier.ExposureSeconds))
            {
                App.MainWindow.MessageBoxWaring($"Your printer seems to not support this tool, still you are allowed to run it for analyze, packing layers or simulation.\n" +
                                                $"Do not print this file after run this tool on a not compatible printer, it will result in malformed model and height violation.\n" +
                                                $"Run this at your own risk!",
                                                BaseOperation.Title).ConfigureAwait(false);
            }


            InitializeComponent();

            ExposureTable = this.FindControl <DataGrid>("ExposureTable");
        }