freq_fff.as 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // quick settings brim
  2. float last_brim_val = 5;
  3. int s_brim_get()
  4. {
  5. float bw = get_float("brim_width");
  6. if (bw > 0) {
  7. last_brim_val = bw;
  8. return 1;
  9. }
  10. return 0;
  11. }
  12. void s_brim_set(bool new_val)
  13. {
  14. if(new_val) {
  15. float bw = get_float("brim_width");
  16. set_float("brim_width", last_brim_val);
  17. } else {
  18. set_float("brim_width", 0);
  19. }
  20. }
  21. // quick settings fill_density
  22. int last_solid_every = -1;
  23. float s_fill_density_get()
  24. {
  25. float density = 100 * get_float("fill_density");
  26. int solid_every = get_int("solid_infill_every_layers");
  27. if (solid_every == 1) {
  28. density = 100;
  29. }
  30. return density;
  31. }
  32. void s_fill_density_set(float new_density)
  33. {
  34. int solid_every = get_int("solid_infill_every_layers");
  35. float density = 100 * get_float("fill_density");
  36. if (new_density > 99) {
  37. if (solid_every != 1) {
  38. last_solid_every = solid_every;
  39. }
  40. set_int("solid_infill_every_layers", 1);
  41. if (density == 0) {
  42. // don't let the density to 0, or the solid_infill_every_layers is disabled.
  43. back_initial_value("fill_density");
  44. density = 100 * get_float("fill_density");
  45. if (density == 0) {
  46. set_float("fill_density", 0.42);
  47. }
  48. }
  49. } else {
  50. set_float("fill_density", new_density * 0.01);
  51. if (last_solid_every > -1) {
  52. set_int("solid_infill_every_layers", last_solid_every);
  53. last_solid_every = -1;
  54. } else {
  55. if (solid_every == 1) {
  56. set_int("solid_infill_every_layers", 0);
  57. }
  58. }
  59. }
  60. }
  61. // quick settings support
  62. int s_support_fff_get(string &out get_val)
  63. {
  64. bool support_material = get_bool("support_material");
  65. if (!support_material) { // None
  66. return 0;
  67. }
  68. bool support_material_auto = get_bool("support_material_auto");
  69. if (!support_material_auto) { // For support enforcers only
  70. return 2;
  71. }
  72. bool support_material_buildplate_only = get_bool("support_material_buildplate_only");
  73. if (support_material_buildplate_only) { // Support on build plate only
  74. return 1;
  75. }
  76. // everywhere
  77. return 3;
  78. }
  79. void s_support_fff_set(string &in new_val, int idx)
  80. {
  81. if(idx == 0) { // None
  82. back_initial_value("support_material_buildplate_only");
  83. back_initial_value("support_material_auto");
  84. set_bool("support_material", false);
  85. } else if(idx == 1) { // Support on build plate only
  86. set_bool("support_material_buildplate_only", true);
  87. set_bool("support_material_auto", true);
  88. set_bool("support_material", true);
  89. } else if(idx == 2) { // For support enforcers only
  90. set_bool("support_material_buildplate_only", false);
  91. set_bool("support_material_auto", false);
  92. set_bool("support_material", true);
  93. } else if(idx == 3) { // everywhere
  94. set_bool("support_material_buildplate_only", false);
  95. set_bool("support_material_auto", true);
  96. set_bool("support_material", true);
  97. }
  98. }
  99. // quick settings bed type (nematx)
  100. int s_bed_fff_get(string &out get_val)
  101. {
  102. int bed_temperature = get_int("bed_temperature");
  103. int fl_bed_temperature = get_int("first_layer_bed_temperature");
  104. if (bed_temperature == fl_bed_temperature) {
  105. if (bed_temperature == 130) {
  106. return 1; //glue
  107. }
  108. if (bed_temperature == 170) {
  109. return 2; //noglue
  110. }
  111. }
  112. return 0; // custom
  113. }
  114. void s_bed_fff_set(string &in new_val, int idx)
  115. {
  116. if(idx == 0) { // custom
  117. back_initial_value("bed_temperature");
  118. back_initial_value("first_layer_bed_temperature");
  119. } else if(idx == 1) { // glue
  120. set_int("bed_temperature", 130);
  121. set_int("first_layer_bed_temperature", 130);
  122. } else if(idx == 2) { // noglue
  123. set_int("bed_temperature", 170);
  124. set_int("first_layer_bed_temperature", 170);
  125. }
  126. }