freq_sla.as 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // quick settings support
  2. int s_support_sla_get(string &out get_val)
  3. {
  4. bool supports_enable = get_bool("supports_enable");
  5. if (!supports_enable) { // None
  6. return 0;
  7. }
  8. bool support_enforcers_only = get_bool("support_enforcers_only");
  9. if (support_enforcers_only) { // Support on enforcer only
  10. return 2;
  11. }
  12. bool support_buildplate_only = get_bool("support_buildplate_only");
  13. if (support_buildplate_only) { // Support on build plate only
  14. return 1;
  15. }
  16. // everywhere
  17. return 3;
  18. }
  19. void s_support_sla_set(string &in new_val, int idx)
  20. {
  21. if(idx == 0) { // None
  22. back_initial_value("support_enforcers_only");
  23. back_initial_value("support_buildplate_only");
  24. set_bool("supports_enable", false);
  25. } else if(idx == 1) { // Support on build plate only
  26. set_bool("support_buildplate_only", true);
  27. set_bool("support_enforcers_only", false);
  28. set_bool("supports_enable", true);
  29. } else if(idx == 2) { // For support enforcers only
  30. set_bool("support_buildplate_only", false);
  31. set_bool("support_enforcers_only", true);
  32. set_bool("support_material", true);
  33. } else { // everywhere
  34. set_bool("support_buildplate_only", false);
  35. set_bool("support_enforcers_only", false);
  36. set_bool("supports_enable", true);
  37. }
  38. }
  39. // quick settings pad
  40. int s_pad_get(string &out get_val)
  41. {
  42. bool pad_enable = get_bool("pad_enable");
  43. if (!pad_enable) { // None
  44. return 0;
  45. }
  46. bool pad_around_object = get_bool("pad_around_object");
  47. if (!pad_around_object) { // Below object
  48. return 1;
  49. }
  50. // Around object
  51. return 2;
  52. }
  53. void s_pad_set(string &in new_val, int idx)
  54. {
  55. if(idx == 0) { // None
  56. back_initial_value("pad_around_object");
  57. set_bool("pad_enable", false);
  58. } else if(idx == 1) { // Below object
  59. set_bool("pad_around_object", false);
  60. set_bool("pad_enable", true);
  61. } else { // Around object
  62. set_bool("pad_around_object", true);
  63. set_bool("pad_enable", true);
  64. }
  65. }