public Filament(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum color, string codeStr, FilamentConstants.Branding brand) { this.type = type; this.color = color; this.codeStr = codeStr; this.brand = brand; }
private void SelectFilament(FilamentSpool.TypeEnum type) { switch (type) { case FilamentSpool.TypeEnum.ABS: radioButtonABS.Checked = true; break; case FilamentSpool.TypeEnum.PLA: radioButtonPLA.Checked = true; break; case FilamentSpool.TypeEnum.HIPS: radioButtonHIPS.Checked = true; break; case FilamentSpool.TypeEnum.TGH: radioButtonTGH.Checked = true; break; case FilamentSpool.TypeEnum.CAM: radioButtonCAM.Checked = true; break; case FilamentSpool.TypeEnum.ABS_R: radioButtonABSR.Checked = true; break; } options.type = type; textBoxFilamentTemp.Text = FilamentConstants.Temperature.Default(type).ToString(); }
public override JobCreateResult Create(PrinterInfo printerInfo) { try { m_sGCodeFileOnSDCard = Details.jobParams.gcodefile; } catch (Exception ex) { return(new JobCreateResult(this, ProcessReturn.FAILURE, null)); } FilamentSpool.TypeEnum filamentTypeFromName = FirmwareSDPrintJob.GetFilamentTypeFromName(Details.jobParams.gcodefile); switch (filamentTypeFromName) { case FilamentSpool.TypeEnum.NoFilament: case FilamentSpool.TypeEnum.OtherOrUnknown: return(new JobCreateResult(this, ProcessReturn.SUCCESS, null)); default: if (FilamentProfile.CreateFilamentProfile(printerInfo.filament_info, MyPrinterProfile).Type != filamentTypeFromName) { return(new JobCreateResult(null, ProcessReturn.FAILURE_FILAMENT_MISMATCH, null)); } goto case FilamentSpool.TypeEnum.NoFilament; } }
public static FilamentConstants.Branding GetBrandingFrom(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum color) { Filament filament = FilamentConstants.ProductList.Find(f => { if (f.Color == color) { return(f.Type == type); } return(false); }); if (filament == null) { filament = FilamentConstants.ProductList.Find(f => { if (f.Color == FilamentConstants.ColorsEnum.Other) { return(f.Type == type); } return(false); }); if (filament == null) { return(FilamentConstants.Branding.Other); } } return(filament.Brand); }
public static int BedDefault(FilamentSpool.TypeEnum type) { var num = 0; switch (type) { case FilamentSpool.TypeEnum.ABS: num = 100; break; case FilamentSpool.TypeEnum.PLA: case FilamentSpool.TypeEnum.HIPS: case FilamentSpool.TypeEnum.CAM: num = 85; break; case FilamentSpool.TypeEnum.FLX: case FilamentSpool.TypeEnum.TGH: num = 0; break; case FilamentSpool.TypeEnum.ABS_R: num = 90; break; } return(num); }
public JobParams(string gcodefile, string jobname, string preview_image_file_name, FilamentSpool.TypeEnum filament_type, float estimatedTime, float estimatedFilamentNeeded) { jobMode = JobParams.Mode.DirectPrinting; this.gcodefile = gcodefile; this.jobname = jobname; this.preview_image_file_name = preview_image_file_name; this.filament_type = filament_type; this.estimatedTime = estimatedTime; this.estimatedFilamentNeeded = estimatedFilamentNeeded; options = new JobOptions { use_raft_DetailOnly = true, wipe_tower = false, ooze_shield = false, autostart_ignorewarnings = false, use_wave_bonding = false, dont_use_preprocessors = false, use_support_DetailOnly = false, calibrate_before_print = false, turn_on_fan_before_print = false, bounds_check_xy = true, quality_layer_resolution_DetailOnly = 0, fill_density_DetailOnly = 0 }; filament_temperature = 0; preprocessor = new FilamentPreprocessorData(); jobGuid = Guid.NewGuid().ToString(); autoprint = false; }
public void CopyFrom(FilamentSpool other) { filament_color_code = other.filament_color_code; filament_type = other.filament_type; filament_temperature = other.filament_temperature; filament_location = other.filament_location; estimated_filament_length_printed = other.estimated_filament_length_printed; filament_size = other.filament_size; filament_uid = other.filament_uid; }
private void AddColorItems(FilamentSpool.TypeEnum type) { color_combobox.ClearItems(); foreach (FilamentConstants.ColorsEnum color in (FilamentConstants.ColorsEnum[])Enum.GetValues(typeof(FilamentConstants.ColorsEnum))) { color_combobox.AddItem(FilamentConstants.ColorsToString(color)); } color_combobox.Select = 0; }
public FilamentSpool(FilamentSpool.TypeEnum type, int temperature) { filament_color_code = FilamentSpool.DefaultColorCode; filament_type = type; filament_location = FilamentSpool.Location.External; filament_temperature = temperature; estimated_filament_length_printed = 0.0f; filament_size = FilamentSpool.SizeEnum.Micro; filament_uid = 0U; }
public CommandResult RecoveryPrintFromPowerFailure(bool bHomingRequired) { if (m_oPrinterPowerRecovery.PrintingStatus == PowerRecovery.PowerResetState.NotPrinting) { return(CommandResult.Failed_Exception); } PrinterInfo currentPrinterInfo = m_oFirmwareController.CurrentPrinterInfo; if (currentPrinterInfo.persistantData.SavedJobInformation == null || currentPrinterInfo.persistantData.SavedJobInformation.Params == null) { return(CommandResult.Failed_RequiredDataNotAvailable); } JobParams jobParams = currentPrinterInfo.persistantData.SavedJobInformation.Params; FilamentSpool filament; if (jobParams.filament_temperature > 0 && jobParams.filament_type != FilamentSpool.TypeEnum.OtherOrUnknown && jobParams.filament_type != FilamentSpool.TypeEnum.NoFilament) { filament = new FilamentSpool(jobParams.filament_type, jobParams.filament_temperature); } else if (null != currentPrinterInfo.filament_info) { filament = new FilamentSpool(currentPrinterInfo.filament_info); } else { FilamentSpool.TypeEnum filamentTypeFromName = FirmwareSDPrintJob.GetFilamentTypeFromName(jobParams.gcodefile); switch (filamentTypeFromName) { case FilamentSpool.TypeEnum.NoFilament: case FilamentSpool.TypeEnum.OtherOrUnknown: return(CommandResult.Failed_RequiredDataNotAvailable); default: filament = new FilamentSpool(filamentTypeFromName, FilamentConstants.Temperature.Default(filamentTypeFromName)); break; } } var filamentProfile = FilamentProfile.CreateFilamentProfile(currentPrinterInfo.filament_info, m_oFirmwareController.MyPrinterProfile); PrepareForPrinting(jobParams, filament, filamentProfile, bHomingRequired || float.IsNaN(m_fLocationX) || float.IsNaN(m_fLocationY)); CommandResult commandResult = PowerRecovery.PowerResetState.PowerFailureSDPrint != m_oPrinterPowerRecovery.PrintingStatus ? RecoverSpooledPrint(currentPrinterInfo.persistantData.SavedJobInformation) : RecoverSDPrint(jobParams); if (commandResult == CommandResult.Success) { var num = (int)ClearPowerRecoveryFault(true); } else { m_oFirmwareController.SendEmergencyStop(); } return(commandResult); }
public void RemoveCustomTemperature(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum color) { var key = new FilamentProfile.TypeColorKey(type, color); if (!custom_filament_values.ContainsKey(key)) { return; } custom_filament_values.TryRemove(key, out FilamentProfile.CustomOptions customOptions); }
public int GetFilamentTemperature(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum colors) { foreach (var customValue in filamentDictionary.CustomValues) { if (customValue.Key.type == type && customValue.Key.color == colors) { return(customValue.Value.temperature); } } return(FilamentConstants.Temperature.Default(type)); }
public JobParams(JobParams other) { options = new JobOptions(other.options); preprocessor = new FilamentPreprocessorData(other.preprocessor); jobGuid = other.jobGuid; jobMode = other.jobMode; outputfile = other.outputfile; autoprint = other.autoprint; estimatedFilamentNeeded = other.estimatedFilamentNeeded; estimatedTime = other.estimatedTime; filament_temperature = other.filament_temperature; filament_type = other.filament_type; gcodefile = other.gcodefile; preview_image_file_name = other.preview_image_file_name; }
public void AddCustomTemperature(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum color, int temperature) { var key = new FilamentProfile.TypeColorKey(type, color); FilamentProfile.CustomOptions customOptions; customOptions.temperature = temperature; if (custom_filament_values.ContainsKey(key)) { custom_filament_values[key] = customOptions; } else { custom_filament_values.TryAdd(key, customOptions); } }
public void UpdateProfileList(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum color) { filamentprofile_list.Items.Clear(); var index = 0; var num = 0; foreach (KeyValuePair <FilamentProfile.TypeColorKey, FilamentProfile.CustomOptions> customValue in settingsManager.FilamentDictionary.CustomValues) { if (customValue.Key.type == type && customValue.Key.color == color) { index = num; } filamentprofile_list.Items.Add(new FilamentProfilePage.FilamentOptions(customValue.Key, customValue.Value)); ++num; } SelectProfile(index); }
public static FilamentConstants.Temperature.MaxMin MaxMinForFilamentType(FilamentSpool.TypeEnum type) { var maxMin = new FilamentConstants.Temperature.MaxMin { Max = 285f, Min = 100f }; switch (type) { case FilamentSpool.TypeEnum.ABS: maxMin.Max = 285f; maxMin.Min = 240f; break; case FilamentSpool.TypeEnum.PLA: case FilamentSpool.TypeEnum.CAM: maxMin.Max = 250f; maxMin.Min = 190f; break; case FilamentSpool.TypeEnum.HIPS: maxMin.Max = 285f; maxMin.Min = 235f; break; case FilamentSpool.TypeEnum.FLX: case FilamentSpool.TypeEnum.TGH: maxMin.Max = 285f; maxMin.Min = 215f; break; case FilamentSpool.TypeEnum.ABS_R: maxMin.Max = 270f; maxMin.Min = 200f; break; default: throw new NotImplementedException("Constants.MaxMinForFilamentType is not implemented for type: " + type); } return(maxMin); }
public static int Default(FilamentSpool.TypeEnum type) { var num = 0; switch (type) { case FilamentSpool.TypeEnum.ABS: num = 275; break; case FilamentSpool.TypeEnum.PLA: case FilamentSpool.TypeEnum.CAM: num = 215; break; case FilamentSpool.TypeEnum.HIPS: num = 265; break; case FilamentSpool.TypeEnum.FLX: num = 220; break; case FilamentSpool.TypeEnum.TGH: num = 220; break; case FilamentSpool.TypeEnum.ABS_R: num = 240; break; } if (num == 0) { throw new NotImplementedException("Constants.MaxMinForFilamentType is not implemented for type: " + type); } return(num); }
public List <string> GenerateColors(FilamentSpool.TypeEnum type = FilamentSpool.TypeEnum.NoFilament) { var stringList = new List <string>(); if (type == FilamentSpool.TypeEnum.NoFilament) { for (var index = 0; index < 20; ++index) { stringList.Add(FilamentConstants.ColorsToString((FilamentConstants.ColorsEnum)index)); } stringList.Add(FilamentConstants.ColorsToString(FilamentConstants.ColorsEnum.Grey)); } else { dictionary.TryGetValue(type.ToString(), out List <Filament> filamentList); foreach (Filament filament in filamentList.FindAll(x => x.Type == type)) { stringList.Add(filament.ColorStr); } } return(stringList); }
public void MyButtonCallback(ButtonWidget button) { switch (button.ID) { case 3: FilamentSpool.TypeEnum type = ((FilamentSpool.TypeEnum[])Enum.GetValues(typeof(FilamentSpool.TypeEnum)))[type_combobox.ListBox.Selected]; FilamentConstants.ColorsEnum filamentColors = FilamentConstants.StringToFilamentColors(color_combobox.EditBox.Text); settings_manager.FilamentDictionary.AddCustomTemperature(type, filamentColors, FilamentConstants.Temperature.Default(type)); Enabled = false; Visible = false; host.GlobalChildDialog -= (this); if (manageFilamentPage != null) { manageFilamentPage.Enabled = true; } if (manageFilamentPage == null) { break; } manageFilamentPage.UpdateProfileList(type, filamentColors); break; case 4: Enabled = false; Visible = false; if (manageFilamentPage != null) { manageFilamentPage.Enabled = true; } host.GlobalChildDialog -= (this); break; } }
private static Filament CFDT(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum color, string code, FilamentConstants.Branding brand) { return(new Filament(type, color, code, brand)); }
public static void Create(string filename, FilamentSpool.TypeEnum filament_type, float XStart, float YStart) { var num1 = 215; switch (filament_type) { case FilamentSpool.TypeEnum.ABS: num1 = 270; break; case FilamentSpool.TypeEnum.HIPS: num1 = 260; break; case FilamentSpool.TypeEnum.ABS_R: num1 = 240; break; } BacklashCalibrationPrint.Direction dirXPrev = BacklashCalibrationPrint.Direction.Neither; BacklashCalibrationPrint.Direction dirYPrev = BacklashCalibrationPrint.Direction.Neither; using (var fileStream = new FileStream(filename, FileMode.Create, FileAccess.Write)) { using (var streamWriter = new StreamWriter(fileStream)) { streamWriter.WriteLine("G90"); streamWriter.WriteLine("M104 S" + num1); streamWriter.WriteLine("G28"); streamWriter.WriteLine("G0 Z2 F60"); streamWriter.WriteLine("M109 S" + num1); switch (filament_type) { case FilamentSpool.TypeEnum.ABS: streamWriter.WriteLine("M106 S1"); break; case FilamentSpool.TypeEnum.PLA: case FilamentSpool.TypeEnum.FLX: case FilamentSpool.TypeEnum.TGH: streamWriter.WriteLine("M106 S255"); break; } var backlashCompensationX = 0.0f; var backlashCompensationY = 0.0f; var points1 = 4; var num2 = 8f; var layerHeight = 0.2f; var pos = new Position { relativeX = XStart, relativeY = YStart, relativeZ = 0.4f }; streamWriter.WriteLine(PrinterCompatibleString.Format("G0 X{0:0.0000} Y{1:0.0000} F500", XStart, YStart)); var isFirstMove = false; for (var index1 = 0; index1 < 5; ++index1) { streamWriter.WriteLine(PrinterCompatibleString.Format("G0 Z{0:0.000}", (object)pos.relativeZ)); pos.relativeZ += 0.2f; for (var index2 = 0; index2 < 5; ++index2) { float EXTRUSION_PER_MM_XY; switch (index1) { case 0: EXTRUSION_PER_MM_XY = 0.2508f; break; case 1: EXTRUSION_PER_MM_XY = 0.0528f; break; default: EXTRUSION_PER_MM_XY = 0.044f; break; } var polynomialGcode = BacklashCalibrationPrint.GetPolynomialGCode(ref backlashCompensationX, ref backlashCompensationY, ref dirXPrev, ref dirYPrev, XStart, YStart, pos, points1, num2 - index2, 0.25f, 1.06f, 0.0f, EXTRUSION_PER_MM_XY, isFirstMove); isFirstMove = false; streamWriter.WriteLine(polynomialGcode); } } streamWriter.WriteLine("M106 s255"); var points2 = 96; var radius = 5f; var num3 = (int)(Math.Ceiling(30.0 / layerHeight) + 0.100000001490116); var num4 = 1f; var num5 = 2f; var num6 = num4 / num3; var num7 = num5 / num3; var X_BACKLASH = 0.0f; var Y_BACKLASH = 0.0f; var num8 = 0; while (X_BACKLASH < (double)num4 && Y_BACKLASH < (double)num5) { streamWriter.WriteLine(PrinterCompatibleString.Format("G0 Z{0:0.000}", (object)pos.relativeZ)); var polynomialGcode = BacklashCalibrationPrint.GetPolynomialGCode(ref backlashCompensationX, ref backlashCompensationY, ref dirXPrev, ref dirYPrev, XStart, YStart, pos, points2, radius, X_BACKLASH, Y_BACKLASH, layerHeight, 0.0369f, false); streamWriter.WriteLine(polynomialGcode); X_BACKLASH += num6; Y_BACKLASH += num7; ++num8; } pos.relativeZ += 4f; streamWriter.WriteLine("M104 S0"); streamWriter.WriteLine(";PrinterJob"); streamWriter.WriteLine(PrinterCompatibleString.Format("G0 Z{0:0.000}", (object)pos.relativeZ)); streamWriter.WriteLine("G91"); streamWriter.WriteLine("G0 X20 Y20"); streamWriter.WriteLine("M18"); } } }
public static string TypesToString(FilamentSpool.TypeEnum type) { return(type.ToString().Replace('_', '-')); }
public TypeColorKey(FilamentProfile.TypeColorKey other) { type = other.type; color = other.color; }
public TypeColorKey(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum color) { this.type = type; this.color = color; }
public Filament(Filament other) { type = other.type; codeStr = other.codeStr; color = other.color; }