Exemple #1
0
 public void DeleteActivePreset()
 {
     if (ActivePreset != null && ActivePreset != ActiveMachine.DefaultPreset)
     {
         var deletePreset = ActivePreset;
         SelectPreset(ActiveMachine.DefaultPreset, true);
         MachineDB.DeletePreset(ActiveMachine, deletePreset);
         // refresh presets list
         OnPrinterSelectionModified?.Invoke(ActiveManufacturer, ActiveMachine);
     }
 }
Exemple #2
0
        public void SelectMachine(MachineModel machine)
        {
            if (machine != ActiveMachine)
            {
                ActiveMachine = machine;

                // [TODO] should remember this per-machine
                MachinePreset defaultPreset = MachineDB.DefaultPresetForModel(ActiveMachine);
                SelectPreset(defaultPreset);

                OnPrinterSelectionModified?.Invoke(ActiveManufacturer, ActiveMachine);
            }
        }
Exemple #3
0
        public void CreateDerivedPreset()
        {
            MachineModel activeModel = ActiveMachine;

            MachinePreset basePreset = ActivePreset.Clone();

            CC.Settings.WriteToSettings(basePreset.Settings);

            CotangentUI.GetStringFromDialog("Create New Preset",
                                            "Enter the name of new Preset to be derived from \"" + basePreset.Settings.Identifier + "\"", null,
                                            (name) => { return(string.IsNullOrEmpty(name) == false && name.Contains('\"') == false); },
                                            (name, obj) => {
                MachinePreset derived = MachineDB.CreateDerivedPreset(activeModel, basePreset, name);
                SelectPreset(derived);
                // will cause refresh of presets list
                OnPrinterSelectionModified?.Invoke(ActiveManufacturer, ActiveMachine);
            },
                                            () => {
                SelectPreset(basePreset);
            }
                                            );
        }
Exemple #4
0
        public void CreateDerivedMachine()
        {
            MachineModel activeModel = ActiveMachine;

            MachinePreset defaultPreset = MachineDB.DefaultPresetForModel(ActiveMachine);

            CotangentUI.GetStringFromDialog("Create New Machine",
                                            "Enter the name of new Machine to be derived from \"" + activeModel.Name + "\"", null,
                                            (name) => { return(string.IsNullOrEmpty(name) == false && name.Contains('\"') == false); },
                                            (name, obj) => {
                try {
                    MachineModel newModel = MachineDB.CreateDerivedMachine(ActiveManufacturer, ActiveMachine, defaultPreset, name);
                    OnPrinterSelectionModified?.Invoke(null, null);
                    SelectMachine(newModel);
                } catch (Exception e) {
                    DebugUtil.Log("CreateDerivedMachine:  " + e.Message);
                }
            },
                                            () => {
                SelectMachine(ActiveMachine);
            }
                                            );
        }
Exemple #5
0
 private static void PrinterDB_OnPrinterSelectionModified(Manufacturer newMfg, MachineModel newModel)
 {
     InvalidateToolPaths();
     update_printer_bed();
     OnPrinterSelectionModified?.Invoke(newMfg, newModel);
 }