PrintConfig.hpp 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. #ifndef slic3r_PrintConfig_hpp_
  2. #define slic3r_PrintConfig_hpp_
  3. #include "Config.hpp"
  4. namespace Slic3r {
  5. enum GCodeFlavor {
  6. gcfRepRap, gcfTeacup, gcfMakerWare, gcfSailfish, gcfMach3, gcfNoExtrusion,
  7. };
  8. enum InfillPattern {
  9. ipRectilinear, ipLine, ipConcentric, ipHoneycomb, ip3DHoneycomb,
  10. ipHilbertCurve, ipArchimedeanChords, ipOctagramSpiral,
  11. };
  12. enum SupportMaterialPattern {
  13. smpRectilinear, smpRectilinearGrid, smpHoneycomb, smpPillars,
  14. };
  15. enum SeamPosition {
  16. spRandom, spNearest, spAligned
  17. };
  18. template<> inline t_config_enum_values ConfigOptionEnum<GCodeFlavor>::get_enum_values() {
  19. t_config_enum_values keys_map;
  20. keys_map["reprap"] = gcfRepRap;
  21. keys_map["teacup"] = gcfTeacup;
  22. keys_map["makerware"] = gcfMakerWare;
  23. keys_map["sailfish"] = gcfSailfish;
  24. keys_map["mach3"] = gcfMach3;
  25. keys_map["no-extrusion"] = gcfNoExtrusion;
  26. return keys_map;
  27. }
  28. template<> inline t_config_enum_values ConfigOptionEnum<InfillPattern>::get_enum_values() {
  29. t_config_enum_values keys_map;
  30. keys_map["rectilinear"] = ipRectilinear;
  31. keys_map["line"] = ipLine;
  32. keys_map["concentric"] = ipConcentric;
  33. keys_map["honeycomb"] = ipHoneycomb;
  34. keys_map["3dhoneycomb"] = ip3DHoneycomb;
  35. keys_map["hilbertcurve"] = ipHilbertCurve;
  36. keys_map["archimedeanchords"] = ipArchimedeanChords;
  37. keys_map["octagramspiral"] = ipOctagramSpiral;
  38. return keys_map;
  39. }
  40. template<> inline t_config_enum_values ConfigOptionEnum<SupportMaterialPattern>::get_enum_values() {
  41. t_config_enum_values keys_map;
  42. keys_map["rectilinear"] = smpRectilinear;
  43. keys_map["rectilinear-grid"] = smpRectilinearGrid;
  44. keys_map["honeycomb"] = smpHoneycomb;
  45. keys_map["pillars"] = smpPillars;
  46. return keys_map;
  47. }
  48. template<> inline t_config_enum_values ConfigOptionEnum<SeamPosition>::get_enum_values() {
  49. t_config_enum_values keys_map;
  50. keys_map["random"] = spRandom;
  51. keys_map["nearest"] = spNearest;
  52. keys_map["aligned"] = spAligned;
  53. return keys_map;
  54. }
  55. class PrintConfigDef
  56. {
  57. public:
  58. static t_optiondef_map def;
  59. static t_optiondef_map build_def();
  60. };
  61. class DynamicPrintConfig : public DynamicConfig
  62. {
  63. public:
  64. DynamicPrintConfig() {
  65. this->def = &PrintConfigDef::def;
  66. };
  67. void normalize() {
  68. if (this->has("extruder")) {
  69. int extruder = this->option("extruder")->getInt();
  70. this->erase("extruder");
  71. if (extruder != 0) {
  72. if (!this->has("infill_extruder"))
  73. this->option("infill_extruder", true)->setInt(extruder);
  74. if (!this->has("perimeter_extruder"))
  75. this->option("perimeter_extruder", true)->setInt(extruder);
  76. if (!this->has("support_material_extruder"))
  77. this->option("support_material_extruder", true)->setInt(extruder);
  78. if (!this->has("support_material_interface_extruder"))
  79. this->option("support_material_interface_extruder", true)->setInt(extruder);
  80. }
  81. }
  82. if (this->has("spiral_vase") && this->opt<ConfigOptionBool>("spiral_vase", true)->value) {
  83. {
  84. // this should be actually done only on the spiral layers instead of all
  85. ConfigOptionBools* opt = this->opt<ConfigOptionBools>("retract_layer_change", true);
  86. opt->values.assign(opt->values.size(), false); // set all values to false
  87. }
  88. {
  89. this->opt<ConfigOptionInt>("perimeters", true)->value = 1;
  90. this->opt<ConfigOptionInt>("top_solid_layers", true)->value = 0;
  91. this->opt<ConfigOptionPercent>("fill_density", true)->value = 0;
  92. }
  93. }
  94. };
  95. };
  96. class StaticPrintConfig : public virtual StaticConfig
  97. {
  98. public:
  99. StaticPrintConfig() {
  100. this->def = &PrintConfigDef::def;
  101. };
  102. };
  103. class PrintObjectConfig : public virtual StaticPrintConfig
  104. {
  105. public:
  106. ConfigOptionBool dont_support_bridges;
  107. ConfigOptionFloatOrPercent extrusion_width;
  108. ConfigOptionFloatOrPercent first_layer_height;
  109. ConfigOptionBool infill_only_where_needed;
  110. ConfigOptionBool interface_shells;
  111. ConfigOptionFloat layer_height;
  112. ConfigOptionInt raft_layers;
  113. ConfigOptionEnum<SeamPosition> seam_position;
  114. ConfigOptionBool support_material;
  115. ConfigOptionInt support_material_angle;
  116. ConfigOptionInt support_material_enforce_layers;
  117. ConfigOptionInt support_material_extruder;
  118. ConfigOptionFloatOrPercent support_material_extrusion_width;
  119. ConfigOptionInt support_material_interface_extruder;
  120. ConfigOptionInt support_material_interface_layers;
  121. ConfigOptionFloat support_material_interface_spacing;
  122. ConfigOptionFloatOrPercent support_material_interface_speed;
  123. ConfigOptionEnum<SupportMaterialPattern> support_material_pattern;
  124. ConfigOptionFloat support_material_spacing;
  125. ConfigOptionFloat support_material_speed;
  126. ConfigOptionInt support_material_threshold;
  127. ConfigOptionFloat xy_size_compensation;
  128. PrintObjectConfig() : StaticPrintConfig() {
  129. this->dont_support_bridges.value = true;
  130. this->extrusion_width.value = 0;
  131. this->extrusion_width.percent = false;
  132. this->first_layer_height.value = 0.35;
  133. this->first_layer_height.percent = false;
  134. this->infill_only_where_needed.value = false;
  135. this->interface_shells.value = false;
  136. this->layer_height.value = 0.3;
  137. this->raft_layers.value = 0;
  138. this->seam_position.value = spAligned;
  139. this->support_material.value = false;
  140. this->support_material_angle.value = 0;
  141. this->support_material_enforce_layers.value = 0;
  142. this->support_material_extruder.value = 1;
  143. this->support_material_extrusion_width.value = 0;
  144. this->support_material_extrusion_width.percent = false;
  145. this->support_material_interface_extruder.value = 1;
  146. this->support_material_interface_layers.value = 3;
  147. this->support_material_interface_spacing.value = 0;
  148. this->support_material_interface_speed.value = 100;
  149. this->support_material_interface_speed.percent = true;
  150. this->support_material_pattern.value = smpPillars;
  151. this->support_material_spacing.value = 2.5;
  152. this->support_material_speed.value = 60;
  153. this->support_material_threshold.value = 0;
  154. this->xy_size_compensation.value = 0;
  155. };
  156. ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
  157. if (opt_key == "dont_support_bridges") return &this->dont_support_bridges;
  158. if (opt_key == "extrusion_width") return &this->extrusion_width;
  159. if (opt_key == "first_layer_height") return &this->first_layer_height;
  160. if (opt_key == "infill_only_where_needed") return &this->infill_only_where_needed;
  161. if (opt_key == "interface_shells") return &this->interface_shells;
  162. if (opt_key == "layer_height") return &this->layer_height;
  163. if (opt_key == "raft_layers") return &this->raft_layers;
  164. if (opt_key == "seam_position") return &this->seam_position;
  165. if (opt_key == "support_material") return &this->support_material;
  166. if (opt_key == "support_material_angle") return &this->support_material_angle;
  167. if (opt_key == "support_material_enforce_layers") return &this->support_material_enforce_layers;
  168. if (opt_key == "support_material_extruder") return &this->support_material_extruder;
  169. if (opt_key == "support_material_extrusion_width") return &this->support_material_extrusion_width;
  170. if (opt_key == "support_material_interface_extruder") return &this->support_material_interface_extruder;
  171. if (opt_key == "support_material_interface_layers") return &this->support_material_interface_layers;
  172. if (opt_key == "support_material_interface_spacing") return &this->support_material_interface_spacing;
  173. if (opt_key == "support_material_interface_speed") return &this->support_material_interface_speed;
  174. if (opt_key == "support_material_pattern") return &this->support_material_pattern;
  175. if (opt_key == "support_material_spacing") return &this->support_material_spacing;
  176. if (opt_key == "support_material_speed") return &this->support_material_speed;
  177. if (opt_key == "support_material_threshold") return &this->support_material_threshold;
  178. if (opt_key == "xy_size_compensation") return &this->xy_size_compensation;
  179. return NULL;
  180. };
  181. };
  182. class PrintRegionConfig : public virtual StaticPrintConfig
  183. {
  184. public:
  185. ConfigOptionInt bottom_solid_layers;
  186. ConfigOptionFloat bridge_flow_ratio;
  187. ConfigOptionFloat bridge_speed;
  188. ConfigOptionFloatOrPercent external_perimeter_extrusion_width;
  189. ConfigOptionFloatOrPercent external_perimeter_speed;
  190. ConfigOptionBool external_perimeters_first;
  191. ConfigOptionBool extra_perimeters;
  192. ConfigOptionInt fill_angle;
  193. ConfigOptionPercent fill_density;
  194. ConfigOptionEnum<InfillPattern> fill_pattern;
  195. ConfigOptionFloat gap_fill_speed;
  196. ConfigOptionInt infill_extruder;
  197. ConfigOptionFloatOrPercent infill_extrusion_width;
  198. ConfigOptionInt infill_every_layers;
  199. ConfigOptionFloat infill_speed;
  200. ConfigOptionBool overhangs;
  201. ConfigOptionInt perimeter_extruder;
  202. ConfigOptionFloatOrPercent perimeter_extrusion_width;
  203. ConfigOptionFloat perimeter_speed;
  204. ConfigOptionInt perimeters;
  205. ConfigOptionFloatOrPercent small_perimeter_speed;
  206. ConfigOptionEnum<InfillPattern> solid_fill_pattern;
  207. ConfigOptionFloat solid_infill_below_area;
  208. ConfigOptionFloatOrPercent solid_infill_extrusion_width;
  209. ConfigOptionInt solid_infill_every_layers;
  210. ConfigOptionFloatOrPercent solid_infill_speed;
  211. ConfigOptionBool thin_walls;
  212. ConfigOptionFloatOrPercent top_infill_extrusion_width;
  213. ConfigOptionInt top_solid_layers;
  214. ConfigOptionFloatOrPercent top_solid_infill_speed;
  215. PrintRegionConfig() : StaticPrintConfig() {
  216. this->bottom_solid_layers.value = 3;
  217. this->bridge_flow_ratio.value = 1;
  218. this->bridge_speed.value = 60;
  219. this->external_perimeter_extrusion_width.value = 0;
  220. this->external_perimeter_extrusion_width.percent = false;
  221. this->external_perimeter_speed.value = 70;
  222. this->external_perimeter_speed.percent = true;
  223. this->external_perimeters_first.value = false;
  224. this->extra_perimeters.value = true;
  225. this->fill_angle.value = 45;
  226. this->fill_density.value = 40;
  227. this->fill_pattern.value = ipHoneycomb;
  228. this->gap_fill_speed.value = 20;
  229. this->infill_extruder.value = 1;
  230. this->infill_extrusion_width.value = 0;
  231. this->infill_extrusion_width.percent = false;
  232. this->infill_every_layers.value = 1;
  233. this->infill_speed.value = 60;
  234. this->overhangs.value = true;
  235. this->perimeter_extruder.value = 1;
  236. this->perimeter_extrusion_width.value = 0;
  237. this->perimeter_extrusion_width.percent = false;
  238. this->perimeter_speed.value = 30;
  239. this->perimeters.value = 3;
  240. this->small_perimeter_speed.value = 30;
  241. this->small_perimeter_speed.percent = false;
  242. this->solid_fill_pattern.value = ipRectilinear;
  243. this->solid_infill_below_area.value = 70;
  244. this->solid_infill_extrusion_width.value = 0;
  245. this->solid_infill_extrusion_width.percent = false;
  246. this->solid_infill_every_layers.value = 0;
  247. this->solid_infill_speed.value = 60;
  248. this->solid_infill_speed.percent = false;
  249. this->thin_walls.value = true;
  250. this->top_infill_extrusion_width.value = 0;
  251. this->top_infill_extrusion_width.percent = false;
  252. this->top_solid_infill_speed.value = 50;
  253. this->top_solid_infill_speed.percent = false;
  254. this->top_solid_layers.value = 3;
  255. };
  256. ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
  257. if (opt_key == "bottom_solid_layers") return &this->bottom_solid_layers;
  258. if (opt_key == "bridge_flow_ratio") return &this->bridge_flow_ratio;
  259. if (opt_key == "bridge_speed") return &this->bridge_speed;
  260. if (opt_key == "external_perimeter_extrusion_width") return &this->external_perimeter_extrusion_width;
  261. if (opt_key == "external_perimeter_speed") return &this->external_perimeter_speed;
  262. if (opt_key == "external_perimeters_first") return &this->external_perimeters_first;
  263. if (opt_key == "extra_perimeters") return &this->extra_perimeters;
  264. if (opt_key == "fill_angle") return &this->fill_angle;
  265. if (opt_key == "fill_density") return &this->fill_density;
  266. if (opt_key == "fill_pattern") return &this->fill_pattern;
  267. if (opt_key == "gap_fill_speed") return &this->gap_fill_speed;
  268. if (opt_key == "infill_extruder") return &this->infill_extruder;
  269. if (opt_key == "infill_extrusion_width") return &this->infill_extrusion_width;
  270. if (opt_key == "infill_every_layers") return &this->infill_every_layers;
  271. if (opt_key == "infill_speed") return &this->infill_speed;
  272. if (opt_key == "overhangs") return &this->overhangs;
  273. if (opt_key == "perimeter_extruder") return &this->perimeter_extruder;
  274. if (opt_key == "perimeter_extrusion_width") return &this->perimeter_extrusion_width;
  275. if (opt_key == "perimeter_speed") return &this->perimeter_speed;
  276. if (opt_key == "perimeters") return &this->perimeters;
  277. if (opt_key == "small_perimeter_speed") return &this->small_perimeter_speed;
  278. if (opt_key == "solid_fill_pattern") return &this->solid_fill_pattern;
  279. if (opt_key == "solid_infill_below_area") return &this->solid_infill_below_area;
  280. if (opt_key == "solid_infill_extrusion_width") return &this->solid_infill_extrusion_width;
  281. if (opt_key == "solid_infill_every_layers") return &this->solid_infill_every_layers;
  282. if (opt_key == "solid_infill_speed") return &this->solid_infill_speed;
  283. if (opt_key == "thin_walls") return &this->thin_walls;
  284. if (opt_key == "top_infill_extrusion_width") return &this->top_infill_extrusion_width;
  285. if (opt_key == "top_solid_infill_speed") return &this->top_solid_infill_speed;
  286. if (opt_key == "top_solid_layers") return &this->top_solid_layers;
  287. return NULL;
  288. };
  289. };
  290. class GCodeConfig : public virtual StaticPrintConfig
  291. {
  292. public:
  293. ConfigOptionString extrusion_axis;
  294. ConfigOptionFloats extrusion_multiplier;
  295. ConfigOptionFloats filament_diameter;
  296. ConfigOptionBool gcode_comments;
  297. ConfigOptionEnum<GCodeFlavor> gcode_flavor;
  298. ConfigOptionFloat pressure_advance;
  299. ConfigOptionFloats retract_length;
  300. ConfigOptionFloats retract_length_toolchange;
  301. ConfigOptionFloats retract_lift;
  302. ConfigOptionFloats retract_restart_extra;
  303. ConfigOptionFloats retract_restart_extra_toolchange;
  304. ConfigOptionInts retract_speed;
  305. ConfigOptionFloat travel_speed;
  306. ConfigOptionBool use_firmware_retraction;
  307. ConfigOptionBool use_relative_e_distances;
  308. GCodeConfig() : StaticPrintConfig() {
  309. this->extrusion_axis.value = "E";
  310. this->extrusion_multiplier.values.resize(1);
  311. this->extrusion_multiplier.values[0] = 1;
  312. this->filament_diameter.values.resize(1);
  313. this->filament_diameter.values[0] = 3;
  314. this->gcode_comments.value = false;
  315. this->gcode_flavor.value = gcfRepRap;
  316. this->pressure_advance.value = 0;
  317. this->retract_length.values.resize(1);
  318. this->retract_length.values[0] = 1;
  319. this->retract_length_toolchange.values.resize(1);
  320. this->retract_length_toolchange.values[0] = 10;
  321. this->retract_lift.values.resize(1);
  322. this->retract_lift.values[0] = 0;
  323. this->retract_restart_extra.values.resize(1);
  324. this->retract_restart_extra.values[0] = 0;
  325. this->retract_restart_extra_toolchange.values.resize(1);
  326. this->retract_restart_extra_toolchange.values[0] = 0;
  327. this->retract_speed.values.resize(1);
  328. this->retract_speed.values[0] = 30;
  329. this->travel_speed.value = 130;
  330. this->use_firmware_retraction.value = false;
  331. this->use_relative_e_distances.value = false;
  332. };
  333. ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
  334. if (opt_key == "extrusion_axis") return &this->extrusion_axis;
  335. if (opt_key == "extrusion_multiplier") return &this->extrusion_multiplier;
  336. if (opt_key == "filament_diameter") return &this->filament_diameter;
  337. if (opt_key == "gcode_comments") return &this->gcode_comments;
  338. if (opt_key == "gcode_flavor") return &this->gcode_flavor;
  339. if (opt_key == "pressure_advance") return &this->pressure_advance;
  340. if (opt_key == "retract_length") return &this->retract_length;
  341. if (opt_key == "retract_length_toolchange") return &this->retract_length_toolchange;
  342. if (opt_key == "retract_lift") return &this->retract_lift;
  343. if (opt_key == "retract_restart_extra") return &this->retract_restart_extra;
  344. if (opt_key == "retract_restart_extra_toolchange") return &this->retract_restart_extra_toolchange;
  345. if (opt_key == "retract_speed") return &this->retract_speed;
  346. if (opt_key == "travel_speed") return &this->travel_speed;
  347. if (opt_key == "use_firmware_retraction") return &this->use_firmware_retraction;
  348. if (opt_key == "use_relative_e_distances") return &this->use_relative_e_distances;
  349. return NULL;
  350. };
  351. std::string get_extrusion_axis() const
  352. {
  353. if (this->gcode_flavor.value == gcfMach3) {
  354. return "A";
  355. } else if (this->gcode_flavor.value == gcfNoExtrusion) {
  356. return "";
  357. } else {
  358. return this->extrusion_axis.value;
  359. }
  360. };
  361. };
  362. class PrintConfig : public GCodeConfig
  363. {
  364. public:
  365. ConfigOptionBool avoid_crossing_perimeters;
  366. ConfigOptionPoints bed_shape;
  367. ConfigOptionInt bed_temperature;
  368. ConfigOptionFloat bridge_acceleration;
  369. ConfigOptionInt bridge_fan_speed;
  370. ConfigOptionFloat brim_width;
  371. ConfigOptionBool complete_objects;
  372. ConfigOptionBool cooling;
  373. ConfigOptionFloat default_acceleration;
  374. ConfigOptionInt disable_fan_first_layers;
  375. ConfigOptionFloat duplicate_distance;
  376. ConfigOptionString end_gcode;
  377. ConfigOptionFloat extruder_clearance_height;
  378. ConfigOptionFloat extruder_clearance_radius;
  379. ConfigOptionPoints extruder_offset;
  380. ConfigOptionBool fan_always_on;
  381. ConfigOptionInt fan_below_layer_time;
  382. ConfigOptionFloat first_layer_acceleration;
  383. ConfigOptionInt first_layer_bed_temperature;
  384. ConfigOptionFloatOrPercent first_layer_extrusion_width;
  385. ConfigOptionFloatOrPercent first_layer_speed;
  386. ConfigOptionInts first_layer_temperature;
  387. ConfigOptionBool gcode_arcs;
  388. ConfigOptionFloat infill_acceleration;
  389. ConfigOptionBool infill_first;
  390. ConfigOptionString layer_gcode;
  391. ConfigOptionInt max_fan_speed;
  392. ConfigOptionInt min_fan_speed;
  393. ConfigOptionInt min_print_speed;
  394. ConfigOptionFloat min_skirt_length;
  395. ConfigOptionString notes;
  396. ConfigOptionFloats nozzle_diameter;
  397. ConfigOptionBool only_retract_when_crossing_perimeters;
  398. ConfigOptionBool ooze_prevention;
  399. ConfigOptionString output_filename_format;
  400. ConfigOptionFloat perimeter_acceleration;
  401. ConfigOptionStrings post_process;
  402. ConfigOptionFloat resolution;
  403. ConfigOptionFloats retract_before_travel;
  404. ConfigOptionBools retract_layer_change;
  405. ConfigOptionFloat skirt_distance;
  406. ConfigOptionInt skirt_height;
  407. ConfigOptionInt skirts;
  408. ConfigOptionInt slowdown_below_layer_time;
  409. ConfigOptionBool spiral_vase;
  410. ConfigOptionInt standby_temperature_delta;
  411. ConfigOptionString start_gcode;
  412. ConfigOptionInts temperature;
  413. ConfigOptionInt threads;
  414. ConfigOptionString toolchange_gcode;
  415. ConfigOptionFloat vibration_limit;
  416. ConfigOptionBools wipe;
  417. ConfigOptionFloat z_offset;
  418. PrintConfig() : GCodeConfig() {
  419. this->avoid_crossing_perimeters.value = false;
  420. this->bed_shape.values.push_back(Pointf(0,0));
  421. this->bed_shape.values.push_back(Pointf(200,0));
  422. this->bed_shape.values.push_back(Pointf(200,200));
  423. this->bed_shape.values.push_back(Pointf(0,200));
  424. this->bed_temperature.value = 0;
  425. this->bridge_acceleration.value = 0;
  426. this->bridge_fan_speed.value = 100;
  427. this->brim_width.value = 0;
  428. this->complete_objects.value = false;
  429. this->cooling.value = true;
  430. this->default_acceleration.value = 0;
  431. this->disable_fan_first_layers.value = 1;
  432. this->duplicate_distance.value = 6;
  433. this->end_gcode.value = "M104 S0 ; turn off temperature\nG28 X0 ; home X axis\nM84 ; disable motors\n";
  434. this->extruder_clearance_height.value = 20;
  435. this->extruder_clearance_radius.value = 20;
  436. this->extruder_offset.values.resize(1);
  437. this->extruder_offset.values[0] = Pointf(0,0);
  438. this->fan_always_on.value = false;
  439. this->fan_below_layer_time.value = 60;
  440. this->first_layer_acceleration.value = 0;
  441. this->first_layer_bed_temperature.value = 0;
  442. this->first_layer_extrusion_width.value = 200;
  443. this->first_layer_extrusion_width.percent = true;
  444. this->first_layer_speed.value = 30;
  445. this->first_layer_speed.percent = true;
  446. this->first_layer_temperature.values.resize(1);
  447. this->first_layer_temperature.values[0] = 200;
  448. this->gcode_arcs.value = false;
  449. this->infill_acceleration.value = 0;
  450. this->infill_first.value = false;
  451. this->layer_gcode.value = "";
  452. this->max_fan_speed.value = 100;
  453. this->min_fan_speed.value = 35;
  454. this->min_print_speed.value = 10;
  455. this->min_skirt_length.value = 0;
  456. this->notes.value = "";
  457. this->nozzle_diameter.values.resize(1);
  458. this->nozzle_diameter.values[0] = 0.5;
  459. this->only_retract_when_crossing_perimeters.value = true;
  460. this->ooze_prevention.value = false;
  461. this->output_filename_format.value = "[input_filename_base].gcode";
  462. this->perimeter_acceleration.value = 0;
  463. this->resolution.value = 0;
  464. this->retract_before_travel.values.resize(1);
  465. this->retract_before_travel.values[0] = 2;
  466. this->retract_layer_change.values.resize(1);
  467. this->retract_layer_change.values[0] = true;
  468. this->skirt_distance.value = 6;
  469. this->skirt_height.value = 1;
  470. this->skirts.value = 1;
  471. this->slowdown_below_layer_time.value = 30;
  472. this->spiral_vase.value = false;
  473. this->standby_temperature_delta.value = -5;
  474. this->start_gcode.value = "G28 ; home all axes\nG1 Z5 F5000 ; lift nozzle\n";
  475. this->temperature.values.resize(1);
  476. this->temperature.values[0] = 200;
  477. this->threads.value = 2;
  478. this->toolchange_gcode.value = "";
  479. this->vibration_limit.value = 0;
  480. this->wipe.values.resize(1);
  481. this->wipe.values[0] = false;
  482. this->z_offset.value = 0;
  483. };
  484. ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
  485. if (opt_key == "avoid_crossing_perimeters") return &this->avoid_crossing_perimeters;
  486. if (opt_key == "bed_shape") return &this->bed_shape;
  487. if (opt_key == "bed_temperature") return &this->bed_temperature;
  488. if (opt_key == "bridge_acceleration") return &this->bridge_acceleration;
  489. if (opt_key == "bridge_fan_speed") return &this->bridge_fan_speed;
  490. if (opt_key == "brim_width") return &this->brim_width;
  491. if (opt_key == "complete_objects") return &this->complete_objects;
  492. if (opt_key == "cooling") return &this->cooling;
  493. if (opt_key == "default_acceleration") return &this->default_acceleration;
  494. if (opt_key == "disable_fan_first_layers") return &this->disable_fan_first_layers;
  495. if (opt_key == "duplicate_distance") return &this->duplicate_distance;
  496. if (opt_key == "end_gcode") return &this->end_gcode;
  497. if (opt_key == "extruder_clearance_height") return &this->extruder_clearance_height;
  498. if (opt_key == "extruder_clearance_radius") return &this->extruder_clearance_radius;
  499. if (opt_key == "extruder_offset") return &this->extruder_offset;
  500. if (opt_key == "fan_always_on") return &this->fan_always_on;
  501. if (opt_key == "fan_below_layer_time") return &this->fan_below_layer_time;
  502. if (opt_key == "first_layer_acceleration") return &this->first_layer_acceleration;
  503. if (opt_key == "first_layer_bed_temperature") return &this->first_layer_bed_temperature;
  504. if (opt_key == "first_layer_extrusion_width") return &this->first_layer_extrusion_width;
  505. if (opt_key == "first_layer_speed") return &this->first_layer_speed;
  506. if (opt_key == "first_layer_temperature") return &this->first_layer_temperature;
  507. if (opt_key == "gcode_arcs") return &this->gcode_arcs;
  508. if (opt_key == "infill_acceleration") return &this->infill_acceleration;
  509. if (opt_key == "infill_first") return &this->infill_first;
  510. if (opt_key == "layer_gcode") return &this->layer_gcode;
  511. if (opt_key == "max_fan_speed") return &this->max_fan_speed;
  512. if (opt_key == "min_fan_speed") return &this->min_fan_speed;
  513. if (opt_key == "min_print_speed") return &this->min_print_speed;
  514. if (opt_key == "min_skirt_length") return &this->min_skirt_length;
  515. if (opt_key == "notes") return &this->notes;
  516. if (opt_key == "nozzle_diameter") return &this->nozzle_diameter;
  517. if (opt_key == "only_retract_when_crossing_perimeters") return &this->only_retract_when_crossing_perimeters;
  518. if (opt_key == "ooze_prevention") return &this->ooze_prevention;
  519. if (opt_key == "output_filename_format") return &this->output_filename_format;
  520. if (opt_key == "perimeter_acceleration") return &this->perimeter_acceleration;
  521. if (opt_key == "post_process") return &this->post_process;
  522. if (opt_key == "resolution") return &this->resolution;
  523. if (opt_key == "retract_before_travel") return &this->retract_before_travel;
  524. if (opt_key == "retract_layer_change") return &this->retract_layer_change;
  525. if (opt_key == "skirt_distance") return &this->skirt_distance;
  526. if (opt_key == "skirt_height") return &this->skirt_height;
  527. if (opt_key == "skirts") return &this->skirts;
  528. if (opt_key == "slowdown_below_layer_time") return &this->slowdown_below_layer_time;
  529. if (opt_key == "spiral_vase") return &this->spiral_vase;
  530. if (opt_key == "standby_temperature_delta") return &this->standby_temperature_delta;
  531. if (opt_key == "start_gcode") return &this->start_gcode;
  532. if (opt_key == "temperature") return &this->temperature;
  533. if (opt_key == "threads") return &this->threads;
  534. if (opt_key == "toolchange_gcode") return &this->toolchange_gcode;
  535. if (opt_key == "vibration_limit") return &this->vibration_limit;
  536. if (opt_key == "wipe") return &this->wipe;
  537. if (opt_key == "z_offset") return &this->z_offset;
  538. // look in parent class
  539. ConfigOption* opt;
  540. if ((opt = GCodeConfig::option(opt_key, create)) != NULL) return opt;
  541. return NULL;
  542. };
  543. };
  544. class FullPrintConfig : public PrintObjectConfig, public PrintRegionConfig, public PrintConfig
  545. {
  546. public:
  547. ConfigOption* option(const t_config_option_key opt_key, bool create = false) {
  548. ConfigOption* opt;
  549. if ((opt = PrintObjectConfig::option(opt_key, create)) != NULL) return opt;
  550. if ((opt = PrintRegionConfig::option(opt_key, create)) != NULL) return opt;
  551. if ((opt = PrintConfig::option(opt_key, create)) != NULL) return opt;
  552. return NULL;
  553. };
  554. };
  555. }
  556. #endif