PrintConfig.hpp 95 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958
  1. ///|/ Copyright (c) Prusa Research 2016 - 2023 Vojtěch Bubník @bubnikv, Lukáš Matěna @lukasmatena, Lukáš Hejl @hejllukas, Tomáš Mészáros @tamasmeszaros, Pavel Mikuš @Godrak, David Kocík @kocikdav, Oleksandra Iushchenko @YuSanka, Vojtěch Král @vojtechkral, Enrico Turri @enricoturri1966
  2. ///|/ Copyright (c) 2023 Pedro Lamas @PedroLamas
  3. ///|/ Copyright (c) 2020 Sergey Kovalev @RandoMan70
  4. ///|/ Copyright (c) 2021 Martin Budden
  5. ///|/ Copyright (c) 2021 Ilya @xorza
  6. ///|/ Copyright (c) 2020 Paul Arden @ardenpm
  7. ///|/ Copyright (c) 2019 Spencer Owen @spuder
  8. ///|/ Copyright (c) 2019 Stephan Reichhelm @stephanr
  9. ///|/ Copyright (c) 2018 Martin Loidl @LoidlM
  10. ///|/ Copyright (c) SuperSlicer 2018 Remi Durand @supermerill
  11. ///|/ Copyright (c) 2016 - 2017 Joseph Lenox @lordofhyphens
  12. ///|/ Copyright (c) Slic3r 2013 - 2015 Alessandro Ranellucci @alranel
  13. ///|/ Copyright (c) 2015 Maksim Derbasov @ntfshard
  14. ///|/ Copyright (c) 2015 Alexander Rössler @machinekoder
  15. ///|/
  16. ///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
  17. ///|/
  18. // Configuration store of Slic3r.
  19. //
  20. // The configuration store is either static or dynamic.
  21. // DynamicPrintConfig is used mainly at the user interface. while the StaticPrintConfig is used
  22. // during the slicing and the g-code generation.
  23. //
  24. // The classes derived from StaticPrintConfig form a following hierarchy.
  25. //
  26. // class ConfigBase
  27. // class StaticConfig : public virtual ConfigBase
  28. // class StaticPrintConfig : public StaticConfig
  29. // class PrintObjectConfig : public StaticPrintConfig
  30. // class PrintRegionConfig : public StaticPrintConfig
  31. // class MachineEnvelopeConfig : public StaticPrintConfig
  32. // class GCodeConfig : public StaticPrintConfig
  33. // class : public MachineEnvelopeConfig, public GCodeConfig
  34. // class FullPrintConfig : PrintObjectConfig,PrintRegionConfig,PrintConfig
  35. // class SLAPrintObjectConfig : public StaticPrintConfig
  36. // class SLAMaterialConfig : public StaticPrintConfig
  37. // class SLAPrinterConfig : public StaticPrintConfig
  38. // class SLAFullPrintConfig : public SLAPrinterConfig, public SLAPrintConfig, public SLAPrintObjectConfig, public SLAMaterialConfig
  39. // class DynamicConfig : public virtual ConfigBase
  40. // class DynamicPrintConfig : public DynamicConfig
  41. // class DynamicPrintAndCLIConfig : public DynamicPrintConfig
  42. //
  43. //
  44. #ifndef slic3r_PrintConfig_hpp_
  45. #define slic3r_PrintConfig_hpp_
  46. #include "libslic3r.h"
  47. #include "Config.hpp"
  48. #include "SLA/SupportTreeStrategies.hpp"
  49. #include <boost/preprocessor/facilities/empty.hpp>
  50. #include <boost/preprocessor/punctuation/comma_if.hpp>
  51. #include <boost/preprocessor/seq/for_each.hpp>
  52. #include <boost/preprocessor/seq/for_each_i.hpp>
  53. #include <boost/preprocessor/stringize.hpp>
  54. #include <boost/preprocessor/tuple/elem.hpp>
  55. #include <boost/preprocessor/tuple/to_seq.hpp>
  56. namespace Slic3r {
  57. enum CompleteObjectSort {
  58. cosNearest,
  59. cosObject,
  60. cosZ,
  61. cosY,
  62. };
  63. enum WipeAlgo {
  64. waLinear,
  65. waQuadra,
  66. waHyper,
  67. };
  68. enum GCodeFlavor : uint8_t {
  69. gcfRepRap,
  70. gcfSprinter,
  71. gcfRepetier,
  72. gcfTeacup,
  73. gcfMakerWare,
  74. gcfMarlinLegacy,
  75. gcfMarlinFirmware,
  76. gcfKlipper,
  77. gcfSailfish,
  78. gcfMach3,
  79. gcfMachinekit,
  80. gcfSmoothie,
  81. gcfNoExtrusion,
  82. };
  83. enum class MachineLimitsUsage : uint8_t {
  84. EmitToGCode,
  85. TimeEstimateOnly,
  86. Limits,
  87. Ignore,
  88. Count,
  89. };
  90. enum PrintHostType {
  91. htPrusaLink,
  92. htPrusaConnect,
  93. htOctoPrint,
  94. htMoonraker,
  95. htDuet,
  96. htFlashAir,
  97. htAstroBox,
  98. htRepetier,
  99. htKlipper,
  100. htMPMDv2,
  101. htMKS,
  102. htMiniDeltaLCD,
  103. };
  104. enum AuthorizationType {
  105. atKeyPassword, atUserPassword
  106. };
  107. enum class FuzzySkinType {
  108. None,
  109. External,
  110. Shell,
  111. All,
  112. };
  113. enum InfillPattern : uint8_t{
  114. ipRectilinear, ipRectilinearWGapFill,
  115. ipMonotonic, ipMonotonicWGapFill,
  116. ipAlignedRectilinear,
  117. ipGrid,
  118. ipTriangles, ipStars, ipCubic,
  119. ipLine, ipMonotonicLines,
  120. ipConcentric, ipConcentricGapFill,
  121. ipHoneycomb, ip3DHoneycomb,
  122. ipGyroid,
  123. ipHilbertCurve, ipArchimedeanChords, ipOctagramSpiral,
  124. ipAdaptiveCubic, ipSupportCubic, ipSupportBase,
  125. ipSmooth, ipSmoothHilbert, ipSmoothTriple,
  126. ipRectiWithPerimeter,
  127. ipScatteredRectilinear,
  128. ipSawtooth,
  129. ipLightning,
  130. ipEnsuring,
  131. ipAuto,
  132. ipCount,
  133. };
  134. enum class IroningType {
  135. TopSurfaces,
  136. TopmostOnly,
  137. AllSolid,
  138. Count,
  139. };
  140. enum PerimeterDirection {
  141. pdCCW_CW,
  142. pdCCW_CCW,
  143. pdCW_CCW,
  144. pdCW_CW,
  145. };
  146. enum class SlicingMode
  147. {
  148. // Regular, applying ClipperLib::pftNonZero rule when creating ExPolygons.
  149. Regular,
  150. // Compatible with 3DLabPrint models, applying ClipperLib::pftEvenOdd rule when creating ExPolygons.
  151. EvenOdd,
  152. // Orienting all contours CCW, thus closing all holes.
  153. CloseHoles,
  154. };
  155. enum SupportMaterialPattern {
  156. smpRectilinear,
  157. smpRectilinearGrid,
  158. smpHoneycomb,
  159. };
  160. enum SupportMaterialStyle {
  161. smsGrid,
  162. smsSnug,
  163. smsTree,
  164. smsOrganic,
  165. };
  166. //from prusa, not used in superslicer as InfillPattern is enough.
  167. //enum SupportMaterialInterfacePattern {
  168. // smipAuto, smipRectilinear, smipConcentric,
  169. //};
  170. enum SeamPosition {
  171. spRandom,
  172. spAllRandom,
  173. spNearest, //not used anymore
  174. spAligned,
  175. spExtremlyAligned,
  176. spRear,
  177. spCustom, // or seam object
  178. spCost,
  179. };
  180. enum SLAMaterial {
  181. slamTough,
  182. slamFlex,
  183. slamCasting,
  184. slamDental,
  185. slamHeatResistant,
  186. };
  187. enum DenseInfillAlgo {
  188. dfaAutomatic,
  189. dfaAutoNotFull,
  190. dfaAutoOrEnlarged,
  191. dfaAutoOrNothing,
  192. dfaEnlarged,
  193. dfaDisabled,
  194. };
  195. enum NoPerimeterUnsupportedAlgo {
  196. npuaNone, npuaNoPeri, npuaBridges, npuaBridgesOverhangs, npuaFilled,
  197. };
  198. enum InfillConnection {
  199. icConnected, icHoles, icOuterShell, icNotConnected,
  200. };
  201. enum RemainingTimeType : uint8_t{
  202. rtNone = 0,
  203. rtM117 = 1<<0,
  204. rtM73 = 1<<1,
  205. rtM73_Quiet = 1<<2,
  206. rtM73_M117 = rtM73 | rtM117,
  207. };
  208. //note: check if the enum_bitmask can't be used (and improve it?)
  209. inline RemainingTimeType operator|(RemainingTimeType a, RemainingTimeType b) {
  210. return static_cast<RemainingTimeType>(static_cast<uint64_t>(a) | static_cast<uint64_t>(b));
  211. }
  212. inline RemainingTimeType operator&(RemainingTimeType a, RemainingTimeType b) {
  213. return static_cast<RemainingTimeType>(static_cast<uint64_t>(a) & static_cast<uint64_t>(b));
  214. }
  215. inline RemainingTimeType operator^(RemainingTimeType a, RemainingTimeType b) {
  216. return static_cast<RemainingTimeType>(static_cast<uint64_t>(a) ^ static_cast<uint64_t>(b));
  217. }
  218. inline RemainingTimeType operator|=(RemainingTimeType& a, RemainingTimeType b) {
  219. a = a | b; return a;
  220. }
  221. inline RemainingTimeType operator&=(RemainingTimeType& a, RemainingTimeType b) {
  222. a = a & b; return a;
  223. }
  224. enum SupportZDistanceType {
  225. zdFilament, zdPlane, zdNone,
  226. };
  227. enum SLADisplayOrientation {
  228. sladoLandscape,
  229. sladoPortrait
  230. };
  231. using SLASupportTreeType = sla::SupportTreeType;
  232. using SLAPillarConnectionMode = sla::PillarConnectionMode;
  233. // from prusa, not used in superslicer (as we can choose the width of inner & outer separatly.
  234. enum BrimType {
  235. btNoBrim,
  236. btOuterOnly,
  237. btInnerOnly,
  238. btOuterAndInner,
  239. };
  240. enum DraftShield {
  241. dsDisabled,
  242. dsLimited,
  243. dsEnabled,
  244. };
  245. enum class LabelObjectsStyle {
  246. Disabled,
  247. Octoprint,
  248. Firmware,
  249. Both,
  250. };
  251. enum class PerimeterGeneratorType
  252. {
  253. // Classic perimeter generator using Clipper offsets with constant extrusion width.
  254. Classic,
  255. // Perimeter generator with variable extrusion width based on the paper
  256. // "A framework for adaptive width control of dense contour-parallel toolpaths in fused deposition modeling" ported from Cura.
  257. Arachne
  258. };
  259. enum class GCodeThumbnailsFormat {
  260. PNG, JPG, QOI, BIQU
  261. };
  262. enum ZLiftTop {
  263. zltAll,
  264. zltTop,
  265. zltNotTop
  266. };
  267. #define CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(NAME) \
  268. template<> const t_config_enum_names& ConfigOptionEnum<NAME>::get_enum_names(); \
  269. template<> const t_config_enum_values& ConfigOptionEnum<NAME>::get_enum_values();
  270. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(ArcFittingType)
  271. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PrinterTechnology)
  272. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(ForwardCompatibilitySubstitutionRule)
  273. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(CompleteObjectSort)
  274. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(WipeAlgo)
  275. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(GCodeFlavor)
  276. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(MachineLimitsUsage)
  277. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PrintHostType)
  278. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(AuthorizationType)
  279. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(BridgeType)
  280. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(FuzzySkinType)
  281. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(InfillPattern)
  282. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(IroningType)
  283. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PerimeterDirection)
  284. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(SlicingMode)
  285. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(SupportMaterialPattern)
  286. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(SupportMaterialStyle)
  287. //CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(SupportMaterialInterfacePattern)
  288. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(SeamPosition)
  289. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(SLAMaterial)
  290. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(DenseInfillAlgo)
  291. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(NoPerimeterUnsupportedAlgo)
  292. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(InfillConnection)
  293. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(RemainingTimeType)
  294. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(SupportZDistanceType)
  295. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(SLADisplayOrientation)
  296. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(SLAPillarConnectionMode)
  297. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(SLASupportTreeType)
  298. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(BrimType)
  299. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(DraftShield)
  300. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(LabelObjectsStyle)
  301. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(GCodeThumbnailsFormat)
  302. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(ZLiftTop)
  303. CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PerimeterGeneratorType)
  304. #undef CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS
  305. class DynamicPrintConfig;
  306. // Defines each and every confiuration option of Slic3r, including the properties of the GUI dialogs.
  307. // Does not store the actual values, but defines default values.
  308. class PrintConfigDef : public ConfigDef
  309. {
  310. public:
  311. PrintConfigDef();
  312. static void handle_legacy(t_config_option_key& opt_key, std::string& value, bool remove_unkown_keys = true);
  313. static bool is_defined(t_config_option_key& opt_key);
  314. static std::map<std::string, std::string> to_prusa(t_config_option_key& opt_key, std::string& value, const DynamicConfig& all_conf);
  315. static std::map<std::string, std::string> from_prusa(t_config_option_key& opt_key, std::string& value, const DynamicConfig& all_conf);
  316. static void handle_legacy_composite(DynamicPrintConfig &config, std::vector<std::pair<t_config_option_key, std::string>> &opt_deleted);
  317. // Array options growing with the number of extruders
  318. const std::vector<std::string>& extruder_option_keys() const { return m_extruder_option_keys; }
  319. const std::set<std::string>& filament_override_option_keys() const { return m_filament_override_option_keys; }
  320. // Options defining the extruder retract properties. These keys are sorted lexicographically.
  321. // The extruder retract keys could be overidden by the same values defined at the Filament level
  322. // (then the key is further prefixed with the "filament_" prefix).
  323. const std::vector<std::string>& extruder_retract_keys() const { return m_extruder_retract_keys; }
  324. // Array options growing with the number of milling cutters
  325. const std::vector<std::string>& milling_option_keys() const { return m_milling_option_keys; }
  326. const std::set<std::string>& material_overrides_option_keys() const { return m_material_overrides_option_keys; }
  327. private:
  328. void init_common_params();
  329. void init_fff_params();
  330. void init_extruder_option_keys();
  331. void init_sla_params();
  332. void init_sla_support_params(const std::string &method_prefix);
  333. void init_milling_params();
  334. std::vector<std::string> m_extruder_option_keys;
  335. std::set<std::string> m_filament_override_option_keys;
  336. std::vector<std::string> m_extruder_retract_keys;
  337. std::vector<std::string> m_milling_option_keys;
  338. std::set<std::string> m_material_overrides_option_keys;
  339. };
  340. // The one and only global definition of SLic3r configuration options.
  341. // This definition is constant.
  342. extern const PrintConfigDef print_config_def;
  343. class StaticPrintConfig;
  344. //PrinterTechnology printer_technology(const ConfigBase &cfg); //TODO del
  345. OutputFormat output_format(const ConfigBase &cfg);
  346. // Minimum object distance for arrangement, based on printer technology
  347. // double min_object_distance(const ConfigBase &cfg);
  348. // Slic3r dynamic configuration, used to override the configuration
  349. // per object, per modification volume or per printing material.
  350. // The dynamic configuration is also used to store user modifications of the print global parameters,
  351. // so the modified configuration values may be diffed against the active configuration
  352. // to invalidate the proper slicing resp. g-code generation processing steps.
  353. class DynamicPrintConfig : public DynamicConfig
  354. {
  355. public:
  356. DynamicPrintConfig() {}
  357. DynamicPrintConfig(const DynamicPrintConfig &rhs) : DynamicConfig(rhs) {}
  358. DynamicPrintConfig(DynamicPrintConfig &&rhs) noexcept : DynamicConfig(std::move(rhs)) {}
  359. explicit DynamicPrintConfig(const StaticPrintConfig &rhs);
  360. explicit DynamicPrintConfig(const ConfigBase &rhs) : DynamicConfig(rhs) {}
  361. DynamicPrintConfig& operator=(const DynamicPrintConfig &rhs) { DynamicConfig::operator=(rhs); return *this; }
  362. DynamicPrintConfig& operator=(DynamicPrintConfig &&rhs) noexcept { DynamicConfig::operator=(std::move(rhs)); return *this; }
  363. static DynamicPrintConfig full_print_config();
  364. static DynamicPrintConfig full_print_config_with(const t_config_option_key &opt_key, const std::string &str, bool append = false) {
  365. auto config = DynamicPrintConfig::full_print_config();
  366. config.set_deserialize_strict(opt_key, str, append);
  367. return config;
  368. }
  369. static DynamicPrintConfig full_print_config_with(std::initializer_list<SetDeserializeItem> items) {
  370. auto config = DynamicPrintConfig::full_print_config();
  371. config.set_deserialize_strict(items);
  372. return config;
  373. }
  374. static DynamicPrintConfig new_with(const t_config_option_key &opt_key, const std::string &str, bool append = false) {
  375. DynamicPrintConfig config;
  376. config.set_deserialize_strict(opt_key, str, append);
  377. return config;
  378. }
  379. static DynamicPrintConfig new_with(std::initializer_list<SetDeserializeItem> items) {
  380. DynamicPrintConfig config;
  381. config.set_deserialize_strict(items);
  382. return config;
  383. }
  384. static DynamicPrintConfig* new_from_defaults_keys(const std::vector<std::string> &keys);
  385. // Overrides ConfigBase::def(). Static configuration definition. Any value stored into this ConfigBase shall have its definition here.
  386. const ConfigDef* def() const override { return &print_config_def; }
  387. void normalize_fdm();
  388. void set_num_extruders(unsigned int num_extruders);
  389. void set_num_milling(unsigned int num_milling);
  390. // Validate the PrintConfig. Returns an empty string on success, otherwise an error message is returned.
  391. std::string validate();
  392. // Verify whether the opt_key has not been obsoleted or renamed.
  393. // Both opt_key and value may be modified by handle_legacy().
  394. // If the opt_key is no more valid in this version of Slic3r, opt_key is cleared by handle_legacy().
  395. // handle_legacy() is called internally by set_deserialize().
  396. void handle_legacy(t_config_option_key &opt_key, std::string &value) const override
  397. { PrintConfigDef::handle_legacy(opt_key, value); }
  398. // Called after a config is loaded as a whole.
  399. // Perform composite conversions, for example merging multiple keys into one key.
  400. // For conversion of single options, the handle_legacy() method above is called.
  401. void handle_legacy_composite(std::vector<std::pair<t_config_option_key, std::string>> &opt_deleted) override
  402. { PrintConfigDef::handle_legacy_composite(*this, opt_deleted); }
  403. void to_prusa(t_config_option_key& opt_key, std::string& value) const override
  404. { PrintConfigDef::to_prusa(opt_key, value, *this); }
  405. // utilities to help convert from prusa config.
  406. // if with_phony, then the phony settigns will be set to phony if needed.
  407. void convert_from_prusa(bool with_phony);
  408. /// <summary>
  409. /// callback to changed other settings that are linked (like width & spacing)
  410. /// </summary>
  411. /// <param name="opt_key">name of the changed option</param>
  412. /// <return> configs that have at least a change</param>
  413. const DynamicPrintConfig* value_changed(const t_config_option_key& opt_key, const std::vector<const DynamicPrintConfig*> config_collection);
  414. const DynamicPrintConfig* update_phony(const std::vector<const DynamicPrintConfig*> config_collection, bool exclude_default_extrusion = false);
  415. };
  416. // An indirection to a bunch of Config
  417. class MultiPtrPrintConfig : public virtual ConfigBase
  418. {
  419. public:
  420. MultiPtrPrintConfig() = default;
  421. // Overrides ConfigBase::def(). Static configuration definition. Any value stored into this ConfigBase shall have its definition here.
  422. const ConfigDef* def() const override { return &print_config_def; }
  423. // Overrides ConfigResolver::optptr().
  424. const ConfigOption* optptr(const t_config_option_key &opt_key) const override;
  425. // Overrides ConfigBase::optptr(). Find ando/or create a ConfigOption instance for a given name.
  426. ConfigOption* optptr(const t_config_option_key &opt_key, bool create = false) override;
  427. // Overrides ConfigBase::keys(). Collect names of all configuration values maintained by this configuration store.
  428. t_config_option_keys keys() const override;
  429. std::vector<ConfigBase*> storages;
  430. private:
  431. };
  432. void handle_legacy_sla(DynamicPrintConfig& config);
  433. class StaticPrintConfig : public StaticConfig
  434. {
  435. public:
  436. StaticPrintConfig() {}
  437. // Overrides ConfigBase::def(). Static configuration definition. Any value stored into this ConfigBase shall have its definition here.
  438. const ConfigDef* def() const override { return &print_config_def; }
  439. // Reference to the cached list of keys.
  440. virtual const t_config_option_keys& keys_ref() const = 0;
  441. protected:
  442. // Verify whether the opt_key has not been obsoleted or renamed.
  443. // Both opt_key and value may be modified by handle_legacy().
  444. // If the opt_key is no more valid in this version of Slic3r, opt_key is cleared by handle_legacy().
  445. // handle_legacy() is called internally by set_deserialize().
  446. void handle_legacy(t_config_option_key &opt_key, std::string &value) const override
  447. { PrintConfigDef::handle_legacy(opt_key, value); }
  448. // Internal class for keeping a dynamic map to static options.
  449. class StaticCacheBase
  450. {
  451. public:
  452. // To be called during the StaticCache setup.
  453. // Add one ConfigOption into m_map_name_to_offset.
  454. template<typename T>
  455. void opt_add(const std::string &name, const char *base_ptr, const T &opt)
  456. {
  457. assert(m_map_name_to_offset.find(name) == m_map_name_to_offset.end());
  458. m_map_name_to_offset[name] = (const char*)&opt - base_ptr;
  459. }
  460. protected:
  461. std::map<std::string, ptrdiff_t> m_map_name_to_offset;
  462. };
  463. // Parametrized by the type of the topmost class owning the options.
  464. template<typename T>
  465. class StaticCache : public StaticCacheBase
  466. {
  467. public:
  468. // Calling the constructor of m_defaults with 0 forces m_defaults to not run the initialization.
  469. StaticCache() : m_defaults(nullptr) {}
  470. ~StaticCache() { delete m_defaults; m_defaults = nullptr; }
  471. bool initialized() const { return ! m_keys.empty(); }
  472. ConfigOption* optptr(const std::string &name, T *owner) const
  473. {
  474. const auto it = m_map_name_to_offset.find(name);
  475. return (it == m_map_name_to_offset.end()) ? nullptr : reinterpret_cast<ConfigOption*>((char*)owner + it->second);
  476. }
  477. const ConfigOption* optptr(const std::string &name, const T *owner) const
  478. {
  479. const auto it = m_map_name_to_offset.find(name);
  480. return (it == m_map_name_to_offset.end()) ? nullptr : reinterpret_cast<const ConfigOption*>((const char*)owner + it->second);
  481. }
  482. const std::vector<std::string>& keys() const { return m_keys; }
  483. const T& defaults() const { return *m_defaults; }
  484. // To be called during the StaticCache setup.
  485. // Collect option keys from m_map_name_to_offset,
  486. // assign default values to m_defaults.
  487. void finalize(T *defaults, const ConfigDef *defs)
  488. {
  489. assert(defaults != nullptr);
  490. assert(defs != nullptr);
  491. m_defaults = defaults;
  492. m_keys.clear();
  493. m_keys.reserve(m_map_name_to_offset.size());
  494. for (const auto &kvp : defs->options) {
  495. // Find the option given the option name kvp.first by an offset from (char*)m_defaults.
  496. ConfigOption *opt = this->optptr(kvp.first, m_defaults);
  497. if (opt == nullptr)
  498. // This option is not defined by the ConfigBase of type T.
  499. continue;
  500. m_keys.emplace_back(kvp.first);
  501. const ConfigOptionDef *def = defs->get(kvp.first);
  502. assert(def != nullptr);
  503. if (def->default_value)
  504. opt->set(def->default_value.get());
  505. }
  506. }
  507. private:
  508. T *m_defaults;
  509. std::vector<std::string> m_keys;
  510. };
  511. };
  512. #define STATIC_PRINT_CONFIG_CACHE_BASE(CLASS_NAME) \
  513. public: \
  514. /* Overrides ConfigBase::optptr(). Find ando/or create a ConfigOption instance for a given name. */ \
  515. const ConfigOption* optptr(const t_config_option_key &opt_key) const override \
  516. { const ConfigOption* opt = s_cache_##CLASS_NAME.optptr(opt_key, this); \
  517. if (opt == nullptr && parent != nullptr) \
  518. /*if not find, try with the parent config.*/ \
  519. opt = parent->option(opt_key); \
  520. return opt; \
  521. } \
  522. /* Overrides ConfigBase::optptr(). Find ando/or create a ConfigOption instance for a given name. */ \
  523. ConfigOption* optptr(const t_config_option_key &opt_key, bool create = false) override \
  524. { return s_cache_##CLASS_NAME.optptr(opt_key, this); } \
  525. /* Overrides ConfigBase::keys(). Collect names of all configuration values maintained by this configuration store. */ \
  526. t_config_option_keys keys() const override { return s_cache_##CLASS_NAME.keys(); } \
  527. const t_config_option_keys& keys_ref() const override { return s_cache_##CLASS_NAME.keys(); } \
  528. static const CLASS_NAME& defaults() { assert(s_cache_##CLASS_NAME.initialized()); return s_cache_##CLASS_NAME.defaults(); } \
  529. private: \
  530. friend int print_config_static_initializer(); \
  531. static void initialize_cache() \
  532. { \
  533. assert(! s_cache_##CLASS_NAME.initialized()); \
  534. if (! s_cache_##CLASS_NAME.initialized()) { \
  535. CLASS_NAME *inst = new CLASS_NAME(1); \
  536. inst->initialize(s_cache_##CLASS_NAME, (const char*)inst); \
  537. s_cache_##CLASS_NAME.finalize(inst, inst->def()); \
  538. } \
  539. } \
  540. /* Cache object holding a key/option map, a list of option keys and a copy of this static config initialized with the defaults. */ \
  541. static StaticPrintConfig::StaticCache<CLASS_NAME> s_cache_##CLASS_NAME;
  542. #define STATIC_PRINT_CONFIG_CACHE(CLASS_NAME) \
  543. STATIC_PRINT_CONFIG_CACHE_BASE(CLASS_NAME) \
  544. public: \
  545. /* Public default constructor will initialize the key/option cache and the default object copy if needed. */ \
  546. CLASS_NAME() { assert(s_cache_##CLASS_NAME.initialized()); *this = s_cache_##CLASS_NAME.defaults(); } \
  547. protected: \
  548. /* Protected constructor to be called when compounded. */ \
  549. CLASS_NAME(int) {}
  550. #define STATIC_PRINT_CONFIG_CACHE_DERIVED(CLASS_NAME) \
  551. STATIC_PRINT_CONFIG_CACHE_BASE(CLASS_NAME) \
  552. public: \
  553. /* Overrides ConfigBase::def(). Static configuration definition. Any value stored into this ConfigBase shall have its definition here. */ \
  554. const ConfigDef* def() const override { return &print_config_def; } \
  555. /* Handle legacy and obsoleted config keys */ \
  556. void handle_legacy(t_config_option_key &opt_key, std::string &value) const override \
  557. { PrintConfigDef::handle_legacy(opt_key, value); }
  558. #define PRINT_CONFIG_CLASS_ELEMENT_DEFINITION(r, data, elem) BOOST_PP_TUPLE_ELEM(0, elem) BOOST_PP_TUPLE_ELEM(1, elem);
  559. #define PRINT_CONFIG_CLASS_ELEMENT_INITIALIZATION2(KEY) cache.opt_add(BOOST_PP_STRINGIZE(KEY), base_ptr, this->KEY);
  560. #define PRINT_CONFIG_CLASS_ELEMENT_INITIALIZATION(r, data, elem) PRINT_CONFIG_CLASS_ELEMENT_INITIALIZATION2(BOOST_PP_TUPLE_ELEM(1, elem))
  561. #define PRINT_CONFIG_CLASS_ELEMENT_HASH(r, data, elem) boost::hash_combine(seed, BOOST_PP_TUPLE_ELEM(1, elem).hash());
  562. #define PRINT_CONFIG_CLASS_ELEMENT_EQUAL(r, data, elem) if (! (BOOST_PP_TUPLE_ELEM(1, elem) == rhs.BOOST_PP_TUPLE_ELEM(1, elem))) return false;
  563. #define PRINT_CONFIG_CLASS_ELEMENT_LOWER(r, data, elem) \
  564. if (BOOST_PP_TUPLE_ELEM(1, elem) < rhs.BOOST_PP_TUPLE_ELEM(1, elem)) return true; \
  565. if (! (BOOST_PP_TUPLE_ELEM(1, elem) == rhs.BOOST_PP_TUPLE_ELEM(1, elem))) return false;
  566. #define PRINT_CONFIG_CLASS_DEFINE(CLASS_NAME, PARAMETER_DEFINITION_SEQ) \
  567. class CLASS_NAME : public StaticPrintConfig { \
  568. STATIC_PRINT_CONFIG_CACHE(CLASS_NAME) \
  569. public: \
  570. BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CLASS_ELEMENT_DEFINITION, _, PARAMETER_DEFINITION_SEQ) \
  571. size_t hash() const throw() \
  572. { \
  573. size_t seed = 0; \
  574. BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CLASS_ELEMENT_HASH, _, PARAMETER_DEFINITION_SEQ) \
  575. return seed; \
  576. } \
  577. bool operator==(const CLASS_NAME &rhs) const throw() \
  578. { \
  579. BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CLASS_ELEMENT_EQUAL, _, PARAMETER_DEFINITION_SEQ) \
  580. return true; \
  581. } \
  582. bool operator!=(const CLASS_NAME &rhs) const throw() { return ! (*this == rhs); } \
  583. bool operator<(const CLASS_NAME &rhs) const throw() \
  584. { \
  585. BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CLASS_ELEMENT_LOWER, _, PARAMETER_DEFINITION_SEQ) \
  586. return false; \
  587. } \
  588. protected: \
  589. void initialize(StaticCacheBase &cache, const char *base_ptr) \
  590. { \
  591. BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CLASS_ELEMENT_INITIALIZATION, _, PARAMETER_DEFINITION_SEQ) \
  592. } \
  593. };
  594. #define PRINT_CONFIG_CLASS_DERIVED_CLASS_LIST_ITEM(r, data, i, elem) BOOST_PP_COMMA_IF(i) public elem
  595. #define PRINT_CONFIG_CLASS_DERIVED_CLASS_LIST(CLASSES_PARENTS_TUPLE) BOOST_PP_SEQ_FOR_EACH_I(PRINT_CONFIG_CLASS_DERIVED_CLASS_LIST_ITEM, _, BOOST_PP_TUPLE_TO_SEQ(CLASSES_PARENTS_TUPLE))
  596. #define PRINT_CONFIG_CLASS_DERIVED_INITIALIZER_ITEM(r, VALUE, i, elem) BOOST_PP_COMMA_IF(i) elem(VALUE)
  597. #define PRINT_CONFIG_CLASS_DERIVED_INITIALIZER(CLASSES_PARENTS_TUPLE, VALUE) BOOST_PP_SEQ_FOR_EACH_I(PRINT_CONFIG_CLASS_DERIVED_INITIALIZER_ITEM, VALUE, BOOST_PP_TUPLE_TO_SEQ(CLASSES_PARENTS_TUPLE))
  598. #define PRINT_CONFIG_CLASS_DERIVED_INITCACHE_ITEM(r, data, elem) this->elem::initialize(cache, base_ptr);
  599. #define PRINT_CONFIG_CLASS_DERIVED_INITCACHE(CLASSES_PARENTS_TUPLE) BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CLASS_DERIVED_INITCACHE_ITEM, _, BOOST_PP_TUPLE_TO_SEQ(CLASSES_PARENTS_TUPLE))
  600. #define PRINT_CONFIG_CLASS_DERIVED_HASH(r, data, elem) boost::hash_combine(seed, static_cast<const elem*>(this)->hash());
  601. #define PRINT_CONFIG_CLASS_DERIVED_EQUAL(r, data, elem) \
  602. if (! (*static_cast<const elem*>(this) == static_cast<const elem&>(rhs))) return false;
  603. // Generic version, with or without new parameters. Don't use this directly.
  604. #define PRINT_CONFIG_CLASS_DERIVED_DEFINE1(CLASS_NAME, CLASSES_PARENTS_TUPLE, PARAMETER_DEFINITION, PARAMETER_REGISTRATION, PARAMETER_HASHES, PARAMETER_EQUALS) \
  605. class CLASS_NAME : PRINT_CONFIG_CLASS_DERIVED_CLASS_LIST(CLASSES_PARENTS_TUPLE) { \
  606. STATIC_PRINT_CONFIG_CACHE_DERIVED(CLASS_NAME) \
  607. CLASS_NAME() : PRINT_CONFIG_CLASS_DERIVED_INITIALIZER(CLASSES_PARENTS_TUPLE, 0) { assert(s_cache_##CLASS_NAME.initialized()); *this = s_cache_##CLASS_NAME.defaults(); } \
  608. public: \
  609. PARAMETER_DEFINITION \
  610. size_t hash() const throw() \
  611. { \
  612. size_t seed = 0; \
  613. BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CLASS_DERIVED_HASH, _, BOOST_PP_TUPLE_TO_SEQ(CLASSES_PARENTS_TUPLE)) \
  614. PARAMETER_HASHES \
  615. return seed; \
  616. } \
  617. bool operator==(const CLASS_NAME &rhs) const throw() \
  618. { \
  619. BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CLASS_DERIVED_EQUAL, _, BOOST_PP_TUPLE_TO_SEQ(CLASSES_PARENTS_TUPLE)) \
  620. PARAMETER_EQUALS \
  621. return true; \
  622. } \
  623. bool operator!=(const CLASS_NAME &rhs) const throw() { return ! (*this == rhs); } \
  624. protected: \
  625. CLASS_NAME(int) : PRINT_CONFIG_CLASS_DERIVED_INITIALIZER(CLASSES_PARENTS_TUPLE, 1) {} \
  626. void initialize(StaticCacheBase &cache, const char* base_ptr) { \
  627. PRINT_CONFIG_CLASS_DERIVED_INITCACHE(CLASSES_PARENTS_TUPLE) \
  628. PARAMETER_REGISTRATION \
  629. } \
  630. };
  631. // Variant without adding new parameters.
  632. #define PRINT_CONFIG_CLASS_DERIVED_DEFINE0(CLASS_NAME, CLASSES_PARENTS_TUPLE) \
  633. PRINT_CONFIG_CLASS_DERIVED_DEFINE1(CLASS_NAME, CLASSES_PARENTS_TUPLE, BOOST_PP_EMPTY(), BOOST_PP_EMPTY(), BOOST_PP_EMPTY(), BOOST_PP_EMPTY())
  634. // Variant with adding new parameters.
  635. #define PRINT_CONFIG_CLASS_DERIVED_DEFINE(CLASS_NAME, CLASSES_PARENTS_TUPLE, PARAMETER_DEFINITION_SEQ) \
  636. PRINT_CONFIG_CLASS_DERIVED_DEFINE1(CLASS_NAME, CLASSES_PARENTS_TUPLE, \
  637. BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CLASS_ELEMENT_DEFINITION, _, PARAMETER_DEFINITION_SEQ), \
  638. BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CLASS_ELEMENT_INITIALIZATION, _, PARAMETER_DEFINITION_SEQ), \
  639. BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CLASS_ELEMENT_HASH, _, PARAMETER_DEFINITION_SEQ), \
  640. BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CLASS_ELEMENT_EQUAL, _, PARAMETER_DEFINITION_SEQ))
  641. PRINT_CONFIG_CLASS_DEFINE(
  642. PrintObjectConfig,
  643. ((ConfigOptionFloatOrPercent, brim_acceleration))
  644. ((ConfigOptionBool, brim_inside_holes))
  645. ((ConfigOptionFloat, brim_width))
  646. ((ConfigOptionFloat, brim_width_interior))
  647. ((ConfigOptionBool, brim_ears))
  648. ((ConfigOptionFloat, brim_ears_detection_length))
  649. ((ConfigOptionFloat, brim_ears_max_angle))
  650. ((ConfigOptionEnum<InfillPattern>, brim_ears_pattern))
  651. ((ConfigOptionBool, brim_per_object))
  652. ((ConfigOptionFloat, brim_separation))
  653. ((ConfigOptionFloatOrPercent, brim_speed))
  654. //((ConfigOptionEnum<BrimType>, brim_type))
  655. ((ConfigOptionString, object_gcode))
  656. ((ConfigOptionBool, dont_support_bridges))
  657. ((ConfigOptionPercent, external_perimeter_cut_corners))
  658. //((ConfigOptionBool, exact_last_layer_height))
  659. ((ConfigOptionFloatOrPercent, extrusion_width))
  660. ((ConfigOptionFloatOrPercent, extrusion_spacing))
  661. ((ConfigOptionBool, fill_angle_follow_model))
  662. ((ConfigOptionFloatOrPercent, first_layer_acceleration))
  663. ((ConfigOptionFloatOrPercent, first_layer_acceleration_over_raft))
  664. ((ConfigOptionFloatOrPercent, first_layer_height))
  665. ((ConfigOptionFloatOrPercent, first_layer_extrusion_width))
  666. ((ConfigOptionFloatOrPercent, first_layer_extrusion_spacing))
  667. ((ConfigOptionFloatOrPercent, first_layer_infill_extrusion_width))
  668. ((ConfigOptionFloatOrPercent, first_layer_infill_extrusion_spacing))
  669. ((ConfigOptionFloatOrPercent, first_layer_infill_speed))
  670. ((ConfigOptionFloat, first_layer_min_speed))
  671. ((ConfigOptionFloat, first_layer_size_compensation)) /* elefant_foot_compensation */
  672. ((ConfigOptionInt, first_layer_size_compensation_layers))
  673. ((ConfigOptionBool, first_layer_size_compensation_no_collapse))
  674. ((ConfigOptionFloatOrPercent, first_layer_speed))
  675. ((ConfigOptionFloatOrPercent, first_layer_speed_over_raft))
  676. ((ConfigOptionFloat, hole_size_compensation))
  677. ((ConfigOptionFloat, hole_size_threshold))
  678. //((ConfigOptionBool, infill_only_where_needed))
  679. // Force the generation of solid shells between adjacent materials/volumes.
  680. ((ConfigOptionBool, interface_shells))
  681. ((ConfigOptionFloat, layer_height))
  682. ((ConfigOptionFloat, mmu_segmented_region_max_width))
  683. ((ConfigOptionFloat, mmu_segmented_region_interlocking_depth))
  684. ((ConfigOptionFloat, model_precision))
  685. ((ConfigOptionPercent, perimeter_bonding))
  686. ((ConfigOptionFloat, raft_contact_distance))
  687. ((ConfigOptionFloat, raft_expansion))
  688. ((ConfigOptionPercent, raft_first_layer_density))
  689. ((ConfigOptionFloat, raft_first_layer_expansion))
  690. ((ConfigOptionFloatOrPercent, raft_interface_layer_height))
  691. ((ConfigOptionInt, raft_layers))
  692. ((ConfigOptionFloatOrPercent, raft_layer_height))
  693. ((ConfigOptionEnum<SeamPosition>, seam_position))
  694. ((ConfigOptionPercent, seam_angle_cost))
  695. ((ConfigOptionPercent, seam_travel_cost))
  696. ((ConfigOptionFloatOrPercent, seam_notch_all))
  697. ((ConfigOptionFloat, seam_notch_angle))
  698. ((ConfigOptionFloatOrPercent, seam_notch_inner))
  699. ((ConfigOptionFloatOrPercent, seam_notch_outer))
  700. ((ConfigOptionBool, seam_visibility))
  701. // ((ConfigOptionFloat, seam_preferred_direction))
  702. // ((ConfigOptionFloat, seam_preferred_direction_jitter))
  703. ((ConfigOptionFloat, slice_closing_radius))
  704. ((ConfigOptionEnum<SlicingMode>, slicing_mode))
  705. ((ConfigOptionBool, staggered_inner_seams))
  706. ((ConfigOptionBool, support_material))
  707. // Automatic supports (generated based fdm support point generator).
  708. ((ConfigOptionBool, support_material_auto))
  709. // Direction of the support pattern (in XY plane).
  710. ((ConfigOptionFloat, support_material_angle))
  711. ((ConfigOptionFloat, support_material_angle_height))
  712. ((ConfigOptionBool, support_material_buildplate_only))
  713. ((ConfigOptionEnum<SupportZDistanceType>, support_material_contact_distance_type))
  714. // support_material_contact_distance (PS) == support_material_contact_distance_top (SuSi 2.3 &-)
  715. ((ConfigOptionFloatOrPercent, support_material_contact_distance))
  716. // support_material_bottom_contact_distance (PS 2.4) == support_material_contact_distance_bottom (SuSi 2.3 &-)
  717. ((ConfigOptionFloatOrPercent, support_material_bottom_contact_distance))
  718. ((ConfigOptionEnum<InfillPattern>, support_material_bottom_interface_pattern))
  719. ((ConfigOptionInt, support_material_enforce_layers))
  720. ((ConfigOptionInt, support_material_extruder))
  721. ((ConfigOptionFloatOrPercent, support_material_extrusion_width))
  722. ((ConfigOptionFloat, support_material_interface_angle))
  723. ((ConfigOptionFloat, support_material_interface_angle_increment))
  724. ((ConfigOptionBool, support_material_interface_contact_loops))
  725. ((ConfigOptionInt, support_material_interface_extruder))
  726. ((ConfigOptionInt, support_material_interface_layers))
  727. ((ConfigOptionFloatOrPercent, support_material_interface_layer_height))
  728. ((ConfigOptionInt, support_material_bottom_interface_layers))
  729. // Spacing between interface lines (the hatching distance). Set zero to get a solid interface.
  730. ((ConfigOptionFloat, support_material_interface_spacing))
  731. ((ConfigOptionFloatOrPercent, support_material_interface_speed))
  732. ((ConfigOptionEnum<SupportMaterialPattern>, support_material_pattern))
  733. // Morphological closing of support areas. Only used for "sung" supports.
  734. ((ConfigOptionFloat, support_material_closing_radius))
  735. ((ConfigOptionFloatOrPercent, support_material_layer_height))
  736. // Spacing between support material lines (the hatching distance).
  737. ((ConfigOptionFloat, support_material_spacing))
  738. ((ConfigOptionFloatOrPercent, support_material_speed))
  739. ((ConfigOptionEnum<SupportMaterialStyle>, support_material_style))
  740. ((ConfigOptionBool, support_material_synchronize_layers))
  741. // Overhang angle threshold.
  742. ((ConfigOptionInt, support_material_threshold))
  743. ((ConfigOptionEnum<InfillPattern>, support_material_top_interface_pattern))
  744. ((ConfigOptionBool, support_material_with_sheath))
  745. ((ConfigOptionFloatOrPercent, support_material_xy_spacing))
  746. ((ConfigOptionBool, thin_walls_merge))
  747. // Tree supports
  748. ((ConfigOptionFloat, support_tree_angle))
  749. ((ConfigOptionFloat, support_tree_angle_slow))
  750. ((ConfigOptionFloat, support_tree_branch_diameter))
  751. ((ConfigOptionFloat, support_tree_branch_diameter_angle))
  752. ((ConfigOptionFloat, support_tree_branch_diameter_double_wall))
  753. ((ConfigOptionPercent, support_tree_top_rate))
  754. ((ConfigOptionFloat, support_tree_branch_distance))
  755. ((ConfigOptionFloat, support_tree_tip_diameter))
  756. // The rest
  757. ((ConfigOptionFloat, xy_size_compensation))
  758. ((ConfigOptionFloat, xy_inner_size_compensation))
  759. ((ConfigOptionBool, wipe_into_objects))
  760. )
  761. PRINT_CONFIG_CLASS_DEFINE(
  762. PrintRegionConfig,
  763. ((ConfigOptionBool, avoid_crossing_top))
  764. ((ConfigOptionFloatOrPercent, bridge_acceleration))
  765. ((ConfigOptionFloat, bridge_angle))
  766. ((ConfigOptionEnum<InfillPattern>, bridge_fill_pattern))
  767. ((ConfigOptionEnum<BridgeType>, bridge_type))
  768. ((ConfigOptionInt, bottom_solid_layers))
  769. ((ConfigOptionFloat, bottom_solid_min_thickness))
  770. ((ConfigOptionPercent, bridge_flow_ratio))
  771. ((ConfigOptionPercent, over_bridge_flow_ratio))
  772. ((ConfigOptionPercent, bridge_overlap))
  773. ((ConfigOptionPercent, bridge_overlap_min))
  774. ((ConfigOptionEnum<InfillPattern>, bottom_fill_pattern))
  775. ((ConfigOptionFloatOrPercent, bridged_infill_margin))
  776. ((ConfigOptionFloatOrPercent, bridge_speed))
  777. ((ConfigOptionFloat, curve_smoothing_precision))
  778. ((ConfigOptionFloat, curve_smoothing_cutoff_dist))
  779. ((ConfigOptionFloat, curve_smoothing_angle_convex))
  780. ((ConfigOptionFloat, curve_smoothing_angle_concave))
  781. ((ConfigOptionFloatOrPercent, default_acceleration))
  782. ((ConfigOptionFloatOrPercent, default_speed))
  783. ((ConfigOptionBool, enforce_full_fill_volume))
  784. ((ConfigOptionFloatOrPercent, external_infill_margin))
  785. ((ConfigOptionFloatOrPercent, external_perimeter_acceleration))
  786. ((ConfigOptionFloatOrPercent, external_perimeter_extrusion_width))
  787. ((ConfigOptionFloatOrPercent, external_perimeter_extrusion_spacing))
  788. ((ConfigOptionFloatOrPercent, external_perimeter_extrusion_change_odd_layers))
  789. ((ConfigOptionPercent, external_perimeter_overlap))
  790. ((ConfigOptionFloatOrPercent, external_perimeter_speed))
  791. ((ConfigOptionBool, external_perimeters_first))
  792. ((ConfigOptionBool, external_perimeters_first_force))
  793. ((ConfigOptionBool, external_perimeters_hole))
  794. ((ConfigOptionBool, external_perimeters_nothole))
  795. ((ConfigOptionBool, external_perimeters_vase))
  796. ((ConfigOptionBool, extra_perimeters))
  797. ((ConfigOptionBool, extra_perimeters_odd_layers))
  798. ((ConfigOptionBool, extra_perimeters_on_overhangs))
  799. ((ConfigOptionBool, only_one_perimeter_first_layer))
  800. ((ConfigOptionBool, only_one_perimeter_top))
  801. ((ConfigOptionBool, only_one_perimeter_top_other_algo))
  802. ((ConfigOptionBool, fill_aligned_z))
  803. ((ConfigOptionFloat, fill_angle))
  804. ((ConfigOptionBool, fill_angle_cross))
  805. ((ConfigOptionFloat, fill_angle_increment))
  806. ((ConfigOptionFloats, fill_angle_template))
  807. ((ConfigOptionPercent, fill_density))
  808. ((ConfigOptionEnum<InfillPattern>, fill_pattern))
  809. ((ConfigOptionPercent, first_layer_flow_ratio))
  810. ((ConfigOptionEnum<FuzzySkinType>, fuzzy_skin))
  811. ((ConfigOptionFloatOrPercent, fuzzy_skin_thickness))
  812. ((ConfigOptionFloatOrPercent, fuzzy_skin_point_dist))
  813. ((ConfigOptionPercent, fill_top_flow_ratio))
  814. ((ConfigOptionPercent, fill_smooth_distribution))
  815. ((ConfigOptionFloatOrPercent, fill_smooth_width))
  816. ((ConfigOptionFloatOrPercent, gap_fill_acceleration))
  817. ((ConfigOptionBool, gap_fill_enabled))
  818. ((ConfigOptionFloatOrPercent, gap_fill_extension))
  819. ((ConfigOptionPercent, gap_fill_flow_match_perimeter))
  820. ((ConfigOptionBool, gap_fill_last))
  821. ((ConfigOptionFloatOrPercent, gap_fill_max_width))
  822. ((ConfigOptionFloatOrPercent, gap_fill_min_area))
  823. ((ConfigOptionFloatOrPercent, gap_fill_min_length))
  824. ((ConfigOptionFloatOrPercent, gap_fill_min_width))
  825. ((ConfigOptionPercent, gap_fill_overlap))
  826. ((ConfigOptionFloatOrPercent, gap_fill_speed))
  827. ((ConfigOptionFloatOrPercent, infill_anchor))
  828. ((ConfigOptionFloatOrPercent, infill_anchor_max))
  829. ((ConfigOptionBool, hole_to_polyhole))
  830. ((ConfigOptionFloatOrPercent, hole_to_polyhole_threshold))
  831. ((ConfigOptionBool, hole_to_polyhole_twisted))
  832. ((ConfigOptionFloatOrPercent, infill_acceleration))
  833. ((ConfigOptionInt, infill_extruder))
  834. ((ConfigOptionFloatOrPercent, infill_extrusion_width))
  835. ((ConfigOptionFloatOrPercent, infill_extrusion_spacing))
  836. ((ConfigOptionFloatOrPercent, infill_extrusion_change_odd_layers))
  837. ((ConfigOptionInt, infill_every_layers))
  838. ((ConfigOptionFloatOrPercent, infill_overlap))
  839. ((ConfigOptionFloatOrPercent, infill_speed))
  840. ((ConfigOptionEnum<InfillConnection>, infill_connection))
  841. ((ConfigOptionEnum<InfillConnection>, infill_connection_solid))
  842. ((ConfigOptionEnum<InfillConnection>, infill_connection_top))
  843. ((ConfigOptionEnum<InfillConnection>, infill_connection_bottom))
  844. ((ConfigOptionEnum<InfillConnection>, infill_connection_bridge))
  845. ((ConfigOptionBool, infill_dense))
  846. ((ConfigOptionEnum<DenseInfillAlgo>, infill_dense_algo))
  847. ((ConfigOptionBool, infill_first))
  848. ((ConfigOptionFloatOrPercent, internal_bridge_acceleration))
  849. ((ConfigOptionFloatOrPercent, internal_bridge_speed))
  850. // Ironing options
  851. ((ConfigOptionBool, ironing))
  852. ((ConfigOptionFloatOrPercent, ironing_acceleration))
  853. ((ConfigOptionFloat, ironing_angle))
  854. ((ConfigOptionEnum<IroningType>, ironing_type))
  855. ((ConfigOptionPercent, ironing_flowrate))
  856. ((ConfigOptionFloatOrPercent, ironing_spacing))
  857. ((ConfigOptionFloatOrPercent, ironing_speed))
  858. // milling options
  859. ((ConfigOptionFloatOrPercent, milling_after_z))
  860. ((ConfigOptionFloatOrPercent, milling_extra_size))
  861. ((ConfigOptionBool, milling_post_process))
  862. ((ConfigOptionFloat, milling_speed))
  863. ((ConfigOptionFloatOrPercent, min_bead_width))
  864. ((ConfigOptionFloatOrPercent, min_feature_size))
  865. ((ConfigOptionFloatOrPercent, min_width_top_surface))
  866. // Detect bridging perimeters
  867. ((ConfigOptionFloatOrPercent, overhangs_acceleration))
  868. ((ConfigOptionFloat, overhangs_bridge_threshold))
  869. ((ConfigOptionInt, overhangs_bridge_upper_layers))
  870. ((ConfigOptionGraph, overhangs_dynamic_speed))
  871. ((ConfigOptionFloatOrPercent, overhangs_max_slope))
  872. ((ConfigOptionBool, overhangs_reverse))
  873. ((ConfigOptionFloatOrPercent, overhangs_reverse_threshold))
  874. ((ConfigOptionFloatOrPercent, overhangs_speed))
  875. ((ConfigOptionInt, overhangs_speed_enforce))
  876. ((ConfigOptionFloatOrPercent, overhangs_width))
  877. ((ConfigOptionFloatOrPercent, overhangs_width_speed))
  878. ((ConfigOptionEnum<NoPerimeterUnsupportedAlgo>, no_perimeter_unsupported_algo))
  879. ((ConfigOptionFloatOrPercent, perimeter_acceleration))
  880. ((ConfigOptionEnum<PerimeterDirection>, perimeter_direction))
  881. ((ConfigOptionInt, perimeter_extruder))
  882. ((ConfigOptionFloatOrPercent, perimeter_extrusion_width))
  883. ((ConfigOptionFloatOrPercent, perimeter_extrusion_spacing))
  884. ((ConfigOptionFloatOrPercent, perimeter_extrusion_change_odd_layers))
  885. ((ConfigOptionEnum<PerimeterGeneratorType>, perimeter_generator))
  886. ((ConfigOptionBool, perimeter_loop))
  887. ((ConfigOptionEnum<SeamPosition>, perimeter_loop_seam))
  888. ((ConfigOptionPercent, perimeter_overlap))
  889. ((ConfigOptionBool, perimeter_reverse))
  890. ((ConfigOptionBool, perimeter_round_corners))
  891. ((ConfigOptionFloatOrPercent, perimeter_speed))
  892. // Total number of perimeters.
  893. ((ConfigOptionInt, perimeters))
  894. ((ConfigOptionInt, perimeters_hole))
  895. ((ConfigOptionPercent, print_extrusion_multiplier))
  896. ((ConfigOptionFloat, print_retract_length))
  897. ((ConfigOptionFloat, print_retract_lift))
  898. ((ConfigOptionString, region_gcode))
  899. ((ConfigOptionBool, small_area_infill_flow_compensation))
  900. ((ConfigOptionGraph, small_area_infill_flow_compensation_model))
  901. ((ConfigOptionFloatOrPercent, small_perimeter_speed))
  902. ((ConfigOptionFloatOrPercent, small_perimeter_min_length))
  903. ((ConfigOptionFloatOrPercent, small_perimeter_max_length))
  904. ((ConfigOptionEnum<InfillPattern>, solid_fill_pattern))
  905. ((ConfigOptionFloatOrPercent, solid_infill_acceleration))
  906. ((ConfigOptionFloat, solid_infill_below_area))
  907. ((ConfigOptionFloat, solid_infill_below_layer_area))
  908. ((ConfigOptionFloatOrPercent, solid_infill_below_width))
  909. ((ConfigOptionInt, solid_infill_extruder))
  910. ((ConfigOptionFloatOrPercent, solid_infill_extrusion_width))
  911. ((ConfigOptionFloatOrPercent, solid_infill_extrusion_spacing))
  912. ((ConfigOptionFloatOrPercent, solid_infill_extrusion_change_odd_layers))
  913. ((ConfigOptionInt, solid_infill_every_layers))
  914. ((ConfigOptionFloatOrPercent, solid_infill_speed))
  915. ((ConfigOptionPercent, solid_infill_overlap))
  916. ((ConfigOptionInt, solid_over_perimeters))
  917. ((ConfigOptionInt, print_first_layer_temperature))
  918. ((ConfigOptionInt, print_temperature))
  919. ((ConfigOptionPercent, thin_perimeters))
  920. ((ConfigOptionPercent, thin_perimeters_all))
  921. ((ConfigOptionBool, thin_walls))
  922. ((ConfigOptionFloatOrPercent, thin_walls_acceleration))
  923. ((ConfigOptionFloatOrPercent, thin_walls_min_width))
  924. ((ConfigOptionFloatOrPercent, thin_walls_overlap))
  925. ((ConfigOptionFloatOrPercent, thin_walls_speed))
  926. ((ConfigOptionEnum<InfillPattern>, top_fill_pattern))
  927. ((ConfigOptionFloatOrPercent, top_infill_extrusion_width))
  928. ((ConfigOptionFloatOrPercent, top_infill_extrusion_spacing))
  929. ((ConfigOptionInt, top_solid_layers))
  930. ((ConfigOptionFloat, top_solid_min_thickness))
  931. ((ConfigOptionFloatOrPercent, top_solid_infill_acceleration))
  932. ((ConfigOptionPercent, top_solid_infill_overlap))
  933. ((ConfigOptionFloatOrPercent, top_solid_infill_speed))
  934. ((ConfigOptionFloatOrPercent, travel_acceleration))
  935. ((ConfigOptionBool, travel_deceleration_use_target))
  936. ((ConfigOptionInt, wall_distribution_count))
  937. ((ConfigOptionFloatOrPercent, wall_transition_length))
  938. ((ConfigOptionFloatOrPercent, wall_transition_filter_deviation))
  939. ((ConfigOptionFloat, wall_transition_angle))
  940. ((ConfigOptionBool, wipe_into_infill))
  941. )
  942. PRINT_CONFIG_CLASS_DEFINE(
  943. MachineEnvelopeConfig,
  944. ((ConfigOptionEnum<MachineLimitsUsage>, machine_limits_usage))
  945. ((ConfigOptionFloats, machine_max_acceleration_x))
  946. ((ConfigOptionFloats, machine_max_acceleration_y))
  947. ((ConfigOptionFloats, machine_max_acceleration_z))
  948. ((ConfigOptionFloats, machine_max_acceleration_e))
  949. ((ConfigOptionFloats, machine_max_feedrate_x))
  950. ((ConfigOptionFloats, machine_max_feedrate_y))
  951. ((ConfigOptionFloats, machine_max_feedrate_z))
  952. ((ConfigOptionFloats, machine_max_feedrate_e))
  953. ((ConfigOptionFloats, machine_max_acceleration_extruding))
  954. ((ConfigOptionFloats, machine_max_acceleration_retracting))
  955. ((ConfigOptionFloats, machine_max_acceleration_travel))
  956. ((ConfigOptionFloats, machine_max_jerk_x))
  957. ((ConfigOptionFloats, machine_max_jerk_y))
  958. ((ConfigOptionFloats, machine_max_jerk_z))
  959. ((ConfigOptionFloats, machine_max_jerk_e))
  960. ((ConfigOptionFloats, machine_min_travel_rate))
  961. ((ConfigOptionFloats, machine_min_extruding_rate))
  962. )
  963. PRINT_CONFIG_CLASS_DEFINE(
  964. GCodeConfig,
  965. ((ConfigOptionEnum<ArcFittingType>, arc_fitting))
  966. ((ConfigOptionFloatOrPercent, arc_fitting_resolution))
  967. ((ConfigOptionFloatOrPercent, arc_fitting_tolerance))
  968. ((ConfigOptionBool, autoemit_temperature_commands))
  969. ((ConfigOptionString, before_layer_gcode))
  970. ((ConfigOptionString, between_objects_gcode))
  971. ((ConfigOptionBool, binary_gcode))
  972. ((ConfigOptionFloats, deretract_speed))
  973. ((ConfigOptionString, end_gcode))
  974. ((ConfigOptionStrings, end_filament_gcode))
  975. ((ConfigOptionFloats, filament_pressure_advance))
  976. ((ConfigOptionFloat, extra_loading_move))
  977. ((ConfigOptionGraphs, extruder_extrusion_multiplier_speed))
  978. ((ConfigOptionPercents, extruder_fan_offset))
  979. ((ConfigOptionPoints, extruder_offset))
  980. ((ConfigOptionFloats, extruder_temperature_offset))
  981. ((ConfigOptionString, extrusion_axis))
  982. ((ConfigOptionFloats, extrusion_multiplier))
  983. ((ConfigOptionFloat, fan_kickstart))
  984. ((ConfigOptionBool, fan_percentage))
  985. ((ConfigOptionInt, fan_printer_min_speed))
  986. ((ConfigOptionBool, fan_speedup_overhangs))
  987. ((ConfigOptionFloat, fan_speedup_time))
  988. ((ConfigOptionFloats, filament_cooling_final_speed))
  989. ((ConfigOptionFloats, filament_cooling_initial_speed))
  990. ((ConfigOptionInts, filament_cooling_moves))
  991. ((ConfigOptionFloats, filament_cost))
  992. ((ConfigOptionFloats, filament_density))
  993. ((ConfigOptionFloats, filament_diameter))
  994. ((ConfigOptionFloats, filament_max_speed))
  995. ((ConfigOptionFloats, filament_minimal_purge_on_wipe_tower))
  996. ((ConfigOptionFloats, filament_spool_weight))
  997. ((ConfigOptionFloats, filament_max_volumetric_speed))
  998. ((ConfigOptionFloats, filament_max_wipe_tower_speed))
  999. ((ConfigOptionStrings, filament_type))
  1000. ((ConfigOptionFloats, filament_loading_speed))
  1001. ((ConfigOptionPercents, filament_fill_top_flow_ratio))
  1002. ((ConfigOptionPercents, filament_first_layer_flow_ratio))
  1003. ((ConfigOptionFloats, filament_load_time))
  1004. ((ConfigOptionFloats, filament_loading_speed_start))
  1005. ((ConfigOptionBools, filament_multitool_ramming))
  1006. ((ConfigOptionFloats, filament_multitool_ramming_flow))
  1007. ((ConfigOptionFloats, filament_multitool_ramming_volume))
  1008. ((ConfigOptionStrings, filament_ramming_parameters))
  1009. ((ConfigOptionBools, filament_use_skinnydip)) /* SKINNYDIP OPTIONS BEGIN */
  1010. ((ConfigOptionBools, filament_use_fast_skinnydip))
  1011. ((ConfigOptionFloats, filament_skinnydip_distance))
  1012. ((ConfigOptionInts, filament_melt_zone_pause))
  1013. ((ConfigOptionInts, filament_cooling_zone_pause))
  1014. ((ConfigOptionBools, filament_enable_toolchange_temp))
  1015. ((ConfigOptionInts, filament_toolchange_temp))
  1016. ((ConfigOptionBools, filament_enable_toolchange_part_fan))
  1017. ((ConfigOptionInts, filament_toolchange_part_fan_speed))
  1018. ((ConfigOptionFloats, filament_dip_insertion_speed))
  1019. ((ConfigOptionFloats, filament_dip_extraction_speed)) /* SKINNYDIP OPTIONS END */
  1020. ((ConfigOptionBools, filament_soluble))
  1021. ((ConfigOptionFloats, filament_toolchange_delay))
  1022. ((ConfigOptionFloats, filament_unloading_speed))
  1023. ((ConfigOptionFloats, filament_unloading_speed_start))
  1024. ((ConfigOptionFloats, filament_unload_time))
  1025. ((ConfigOptionFloats, filament_wipe_advanced_pigment))
  1026. ((ConfigOptionBool, gcode_ascii))
  1027. ((ConfigOptionInt, gcode_command_buffer))
  1028. ((ConfigOptionBool, gcode_comments))
  1029. ((ConfigOptionString, gcode_filename_illegal_char))
  1030. ((ConfigOptionEnum<GCodeFlavor>, gcode_flavor))
  1031. ((ConfigOptionEnum<LabelObjectsStyle>, gcode_label_objects))
  1032. ((ConfigOptionFloatOrPercent, gcode_min_length))
  1033. ((ConfigOptionFloatOrPercent, gcode_min_resolution))
  1034. ((ConfigOptionInt, gcode_precision_xyz))
  1035. ((ConfigOptionInt, gcode_precision_e))
  1036. // Triples of strings: "search pattern", "replace with pattern", "attribs"
  1037. // where "attribs" are one of:
  1038. // r - regular expression
  1039. // i - case insensitive
  1040. // w - whole word
  1041. ((ConfigOptionStrings, gcode_substitutions))
  1042. ((ConfigOptionString, layer_gcode))
  1043. ((ConfigOptionString, feature_gcode))
  1044. ((ConfigOptionFloat, max_gcode_per_second))
  1045. ((ConfigOptionFloatOrPercent, max_print_speed))
  1046. ((ConfigOptionFloat, max_volumetric_speed))
  1047. ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_positive))
  1048. ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_negative))
  1049. ((ConfigOptionFloats, milling_z_lift))
  1050. ((ConfigOptionBools, travel_ramping_lift))
  1051. // ((ConfigOptionFloats, travel_max_lift))
  1052. ((ConfigOptionFloats, travel_slope))
  1053. ((ConfigOptionBools, travel_lift_before_obstacle))
  1054. ((ConfigOptionPercents, retract_before_wipe))
  1055. ((ConfigOptionFloats, retract_length))
  1056. ((ConfigOptionFloats, retract_length_toolchange))
  1057. ((ConfigOptionFloats, retract_lift))
  1058. ((ConfigOptionFloats, retract_lift_above))
  1059. ((ConfigOptionFloats, retract_lift_below))
  1060. ((ConfigOptionBools, retract_lift_first_layer))
  1061. ((ConfigOptionStrings, retract_lift_top))
  1062. ((ConfigOptionFloats, retract_lift_before_travel))
  1063. ((ConfigOptionFloats, retract_restart_extra))
  1064. ((ConfigOptionFloats, retract_restart_extra_toolchange))
  1065. ((ConfigOptionFloats, retract_speed))
  1066. ((ConfigOptionStrings, start_filament_gcode))
  1067. ((ConfigOptionString, start_gcode))
  1068. ((ConfigOptionBool, start_gcode_manual))
  1069. ((ConfigOptionBool, single_extruder_multi_material))
  1070. ((ConfigOptionBool, single_extruder_multi_material_priming))
  1071. ((ConfigOptionStrings, tool_name))
  1072. ((ConfigOptionString, toolchange_gcode))
  1073. ((ConfigOptionFloat, travel_speed))
  1074. ((ConfigOptionFloat, travel_speed_z))
  1075. ((ConfigOptionBool, use_firmware_retraction))
  1076. ((ConfigOptionBool, use_relative_e_distances))
  1077. ((ConfigOptionBool, use_volumetric_e))
  1078. ((ConfigOptionBool, variable_layer_height))
  1079. ((ConfigOptionFloat, cooling_tube_retraction))
  1080. ((ConfigOptionFloat, cooling_tube_length))
  1081. ((ConfigOptionBool, high_current_on_filament_swap))
  1082. ((ConfigOptionFloat, parking_pos_retraction))
  1083. ((ConfigOptionBool, remaining_times))
  1084. ((ConfigOptionEnum<RemainingTimeType>, remaining_times_type))
  1085. ((ConfigOptionBool, silent_mode))
  1086. ((ConfigOptionBool, wipe_advanced))
  1087. ((ConfigOptionEnum<WipeAlgo>, wipe_advanced_algo))
  1088. ((ConfigOptionFloat, wipe_advanced_nozzle_melted_volume))
  1089. ((ConfigOptionFloat, wipe_advanced_multiplier))
  1090. ((ConfigOptionFloats, wipe_extra_perimeter))
  1091. ((ConfigOptionPercents, wipe_inside_depth))
  1092. ((ConfigOptionBools, wipe_inside_end))
  1093. ((ConfigOptionBools, wipe_inside_start))
  1094. ((ConfigOptionFloatsOrPercents, wipe_lift))
  1095. ((ConfigOptionFloatsOrPercents, wipe_lift_length))
  1096. ((ConfigOptionFloatsOrPercents, wipe_min))
  1097. ((ConfigOptionBools, wipe_only_crossing))
  1098. ((ConfigOptionFloats, wipe_speed))
  1099. ((ConfigOptionBool, wipe_tower_no_sparse_layers))
  1100. ((ConfigOptionFloat, wipe_tower_speed))
  1101. ((ConfigOptionFloatOrPercent, wipe_tower_wipe_starting_speed))
  1102. ((ConfigOptionFloat, z_step))
  1103. ((ConfigOptionString, color_change_gcode))
  1104. ((ConfigOptionString, pause_print_gcode))
  1105. ((ConfigOptionString, template_custom_gcode))
  1106. )
  1107. #ifdef HAS_PRESSURE_EQUALIZER
  1108. ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_positive))
  1109. ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_negative))
  1110. #endif
  1111. static inline std::string get_extrusion_axis(const GCodeConfig& cfg)
  1112. {
  1113. return
  1114. ((cfg.gcode_flavor.value == gcfMach3) || (cfg.gcode_flavor.value == gcfMachinekit)) ? "A" :
  1115. (cfg.gcode_flavor.value == gcfNoExtrusion) ? "" : cfg.extrusion_axis.value;
  1116. }
  1117. PRINT_CONFIG_CLASS_DERIVED_DEFINE(
  1118. PrintConfig,
  1119. (MachineEnvelopeConfig, GCodeConfig),
  1120. ((ConfigOptionBool, allow_empty_layers))
  1121. ((ConfigOptionBool, avoid_crossing_curled_overhangs))
  1122. ((ConfigOptionBool, avoid_crossing_perimeters))
  1123. ((ConfigOptionBool, avoid_crossing_not_first_layer))
  1124. ((ConfigOptionFloatOrPercent, avoid_crossing_perimeters_max_detour))
  1125. ((ConfigOptionPoints, bed_shape))
  1126. ((ConfigOptionInts, bed_temperature))
  1127. ((ConfigOptionInts, bridge_fan_speed))
  1128. ((ConfigOptionFloatOrPercent, bridge_precision))
  1129. ((ConfigOptionInts, chamber_temperature))
  1130. ((ConfigOptionBool, complete_objects))
  1131. ((ConfigOptionFloat, parallel_objects_step))
  1132. ((ConfigOptionBool, complete_objects_one_skirt))
  1133. ((ConfigOptionBool, complete_objects_one_brim))
  1134. ((ConfigOptionEnum<CompleteObjectSort>, complete_objects_sort))
  1135. ((ConfigOptionFloats, colorprint_heights))
  1136. //((ConfigOptionBools, cooling))
  1137. ((ConfigOptionInts, disable_fan_first_layers))
  1138. ((ConfigOptionInts, default_fan_speed))
  1139. ((ConfigOptionEnum<DraftShield>, draft_shield))
  1140. ((ConfigOptionFloat, duplicate_distance))
  1141. ((ConfigOptionBool, enforce_retract_first_layer))
  1142. ((ConfigOptionInts, external_perimeter_fan_speed))
  1143. ((ConfigOptionFloat, extruder_clearance_height))
  1144. ((ConfigOptionFloat, extruder_clearance_radius))
  1145. ((ConfigOptionStrings, extruder_colour))
  1146. //((ConfigOptionBools, fan_always_on))
  1147. ((ConfigOptionFloats, fan_below_layer_time))
  1148. ((ConfigOptionStrings, filament_colour))
  1149. ((ConfigOptionStrings, filament_custom_variables))
  1150. ((ConfigOptionStrings, filament_notes))
  1151. ((ConfigOptionPercents, filament_max_overlap))
  1152. ((ConfigOptionPercents, filament_shrink))
  1153. ((ConfigOptionInts, first_layer_bed_temperature))
  1154. ((ConfigOptionInts, first_layer_temperature))
  1155. ((ConfigOptionInts, idle_temperature))
  1156. ((ConfigOptionInts, full_fan_speed_layer))
  1157. ((ConfigOptionInts, gap_fill_fan_speed))
  1158. ((ConfigOptionInts, infill_fan_speed))
  1159. ((ConfigOptionInts, internal_bridge_fan_speed))
  1160. ((ConfigOptionFloat, lift_min))
  1161. ((ConfigOptionInts, max_fan_speed))
  1162. ((ConfigOptionFloatsOrPercents, max_layer_height))
  1163. ((ConfigOptionFloat, max_print_height))
  1164. ((ConfigOptionPercents, max_speed_reduction))
  1165. ((ConfigOptionFloats, milling_diameter))
  1166. ((ConfigOptionStrings, milling_toolchange_end_gcode))
  1167. ((ConfigOptionStrings, milling_toolchange_start_gcode))
  1168. //((ConfigOptionInts, min_fan_speed)) // now fan_printer_min_speed
  1169. ((ConfigOptionFloatsOrPercents, min_layer_height))
  1170. ((ConfigOptionFloats, min_print_speed))
  1171. ((ConfigOptionFloat, min_skirt_length))
  1172. ((ConfigOptionString, notes))
  1173. ((ConfigOptionFloats, nozzle_diameter))
  1174. ((ConfigOptionBool, only_retract_when_crossing_perimeters))
  1175. ((ConfigOptionBool, ooze_prevention))
  1176. ((ConfigOptionString, output_filename_format))
  1177. ((ConfigOptionGraphs, overhangs_dynamic_fan_speed))
  1178. ((ConfigOptionInts, overhangs_fan_speed))
  1179. ((ConfigOptionInts, perimeter_fan_speed))
  1180. ((ConfigOptionStrings, post_process))
  1181. ((ConfigOptionPoint, priming_position))
  1182. ((ConfigOptionString, print_custom_variables))
  1183. ((ConfigOptionString, printer_custom_variables))
  1184. ((ConfigOptionString, printer_model))
  1185. ((ConfigOptionString, printer_notes))
  1186. ((ConfigOptionFloat, resolution))
  1187. ((ConfigOptionFloat, resolution_internal))
  1188. ((ConfigOptionFloats, retract_before_travel))
  1189. ((ConfigOptionBools, retract_layer_change))
  1190. ((ConfigOptionInt, skirt_brim))
  1191. ((ConfigOptionFloat, skirt_distance))
  1192. ((ConfigOptionBool, skirt_distance_from_brim))
  1193. ((ConfigOptionInt, skirt_height))
  1194. ((ConfigOptionFloatOrPercent, skirt_extrusion_width))
  1195. ((ConfigOptionFloatsOrPercents, seam_gap))
  1196. ((ConfigOptionFloatsOrPercents, seam_gap_external))
  1197. ((ConfigOptionInt, skirts))
  1198. ((ConfigOptionFloats, slowdown_below_layer_time))
  1199. ((ConfigOptionBool, spiral_vase))
  1200. ((ConfigOptionInts, solid_infill_fan_speed))
  1201. ((ConfigOptionInt, standby_temperature_delta))
  1202. ((ConfigOptionFloatOrPercent, support_material_acceleration))
  1203. ((ConfigOptionInts, support_material_fan_speed))
  1204. ((ConfigOptionFloatOrPercent, support_material_interface_acceleration))
  1205. ((ConfigOptionInts, support_material_interface_fan_speed))
  1206. ((ConfigOptionInts, temperature))
  1207. ((ConfigOptionInt, threads))
  1208. ((ConfigOptionPoints, thumbnails))
  1209. ((ConfigOptionString, thumbnails_color))
  1210. ((ConfigOptionBool, thumbnails_custom_color))
  1211. ((ConfigOptionBool, thumbnails_end_file))
  1212. ((ConfigOptionEnum<GCodeThumbnailsFormat>, thumbnails_format))
  1213. ((ConfigOptionBool, thumbnails_tag_format))
  1214. ((ConfigOptionBool, thumbnails_with_bed))
  1215. ((ConfigOptionPercent, time_estimation_compensation))
  1216. ((ConfigOptionFloat, time_cost))
  1217. ((ConfigOptionFloat, time_start_gcode))
  1218. ((ConfigOptionFloat, time_toolchange))
  1219. ((ConfigOptionInts, top_fan_speed))
  1220. ((ConfigOptionBools, wipe))
  1221. ((ConfigOptionBool, wipe_tower))
  1222. ((ConfigOptionFloatOrPercent, wipe_tower_brim_width))
  1223. ((ConfigOptionFloat, wipe_tower_x))
  1224. ((ConfigOptionFloat, wipe_tower_y))
  1225. ((ConfigOptionFloat, wipe_tower_width))
  1226. ((ConfigOptionFloat, wipe_tower_per_color_wipe))
  1227. ((ConfigOptionFloat, wipe_tower_rotation_angle))
  1228. ((ConfigOptionFloat, wipe_tower_cone_angle))
  1229. ((ConfigOptionPercent, wipe_tower_extra_spacing))
  1230. ((ConfigOptionFloat, wipe_tower_bridging))
  1231. ((ConfigOptionInt, wipe_tower_extruder))
  1232. ((ConfigOptionFloats, wiping_volumes_matrix))
  1233. ((ConfigOptionFloats, wiping_volumes_extruders))
  1234. ((ConfigOptionFloat, z_offset))
  1235. ((ConfigOptionFloat, init_z_rotate))
  1236. )
  1237. //static inline
  1238. double min_object_distance(const PrintConfig& config); //TODO: remove
  1239. //static inline
  1240. double min_object_distance(const ConfigBase* config, double height = 0); //TODO: remove
  1241. // This object is mapped to Perl as Slic3r::Config::Full.
  1242. PRINT_CONFIG_CLASS_DERIVED_DEFINE0(
  1243. FullPrintConfig,
  1244. (PrintObjectConfig, PrintRegionConfig, PrintConfig)
  1245. )
  1246. // Validate the FullPrintConfig. Returns an empty string on success, otherwise an error message is returned.
  1247. std::string validate(const FullPrintConfig &config);
  1248. // This object is mapped to Perl as Slic3r::Config::PrintRegion.
  1249. PRINT_CONFIG_CLASS_DEFINE(
  1250. SLAPrintConfig,
  1251. ((ConfigOptionString, output_filename_format))
  1252. ((ConfigOptionString, print_custom_variables))
  1253. )
  1254. PRINT_CONFIG_CLASS_DEFINE(
  1255. SLAPrintObjectConfig,
  1256. ((ConfigOptionFloat, layer_height))
  1257. ((ConfigOptionFloat, model_precision))
  1258. //Number of the layers needed for the exposure time fade [3;20]
  1259. ((ConfigOptionInt, faded_layers))/*= 10*/
  1260. ((ConfigOptionFloat, slice_closing_radius))
  1261. ((ConfigOptionEnum<SlicingMode>, slicing_mode))
  1262. // Enabling or disabling support creation
  1263. ((ConfigOptionBool, supports_enable))
  1264. ((ConfigOptionEnum<sla::SupportTreeType>, support_tree_type))
  1265. // Diameter in mm of the pointing side of the head.
  1266. ((ConfigOptionFloat, support_head_front_diameter))/*= 0.2*/
  1267. // How much the pinhead has to penetrate the model surface
  1268. ((ConfigOptionFloat, support_head_penetration))/*= 0.2*/
  1269. // Width in mm from the back sphere center to the front sphere center.
  1270. ((ConfigOptionFloat, support_head_width))/*= 1.0*/
  1271. // Radius in mm of the support pillars.
  1272. ((ConfigOptionFloat, support_pillar_diameter))/*= 0.8*/
  1273. // The percentage of smaller pillars compared to the normal pillar diameter
  1274. // which are used in problematic areas where a normal pilla cannot fit.
  1275. ((ConfigOptionPercent, support_small_pillar_diameter_percent))
  1276. // How much bridge (supporting another pinhead) can be placed on a pillar.
  1277. ((ConfigOptionInt, support_max_bridges_on_pillar))
  1278. // How the pillars are bridged together
  1279. ((ConfigOptionEnum<SLAPillarConnectionMode>, support_pillar_connection_mode))
  1280. // Generate only ground facing supports
  1281. ((ConfigOptionBool, support_buildplate_only))
  1282. ((ConfigOptionFloat, support_max_weight_on_model))
  1283. // Generate only ground facing supports
  1284. ((ConfigOptionBool, support_enforcers_only))
  1285. // TODO: unimplemented at the moment. This coefficient will have an impact
  1286. // when bridges and pillars are merged. The resulting pillar should be a bit
  1287. // thicker than the ones merging into it. How much thicker? I don't know
  1288. // but it will be derived from this value.
  1289. ((ConfigOptionFloat, support_pillar_widening_factor))
  1290. // Radius in mm of the pillar base.
  1291. ((ConfigOptionFloat, support_base_diameter))/*= 2.0*/
  1292. // The height of the pillar base cone in mm.
  1293. ((ConfigOptionFloat, support_base_height))/*= 1.0*/
  1294. // The minimum distance of the pillar base from the model in mm.
  1295. ((ConfigOptionFloat, support_base_safety_distance)) /*= 1.0*/
  1296. // The default angle for connecting support sticks and junctions.
  1297. ((ConfigOptionFloat, support_critical_angle))/*= 45*/
  1298. // The max length of a bridge in mm
  1299. ((ConfigOptionFloat, support_max_bridge_length))/*= 15.0*/
  1300. // The max distance of two pillars to get cross linked.
  1301. ((ConfigOptionFloat, support_max_pillar_link_distance))
  1302. // The elevation in Z direction upwards. This is the space between the pad
  1303. // and the model object's bounding box bottom. Units in mm.
  1304. ((ConfigOptionFloat, support_object_elevation))/*= 5.0*/
  1305. // Branching tree
  1306. // Diameter in mm of the pointing side of the head.
  1307. ((ConfigOptionFloat, branchingsupport_head_front_diameter))/*= 0.2*/
  1308. // How much the pinhead has to penetrate the model surface
  1309. ((ConfigOptionFloat, branchingsupport_head_penetration))/*= 0.2*/
  1310. // Width in mm from the back sphere center to the front sphere center.
  1311. ((ConfigOptionFloat, branchingsupport_head_width))/*= 1.0*/
  1312. // Radius in mm of the support pillars.
  1313. ((ConfigOptionFloat, branchingsupport_pillar_diameter))/*= 0.8*/
  1314. // The percentage of smaller pillars compared to the normal pillar diameter
  1315. // which are used in problematic areas where a normal pilla cannot fit.
  1316. ((ConfigOptionPercent, branchingsupport_small_pillar_diameter_percent))
  1317. // How much bridge (supporting another pinhead) can be placed on a pillar.
  1318. ((ConfigOptionInt, branchingsupport_max_bridges_on_pillar))
  1319. // How the pillars are bridged together
  1320. ((ConfigOptionEnum<SLAPillarConnectionMode>, branchingsupport_pillar_connection_mode))
  1321. // Generate only ground facing supports
  1322. ((ConfigOptionBool, branchingsupport_buildplate_only))
  1323. ((ConfigOptionFloat, branchingsupport_max_weight_on_model))
  1324. ((ConfigOptionFloat, branchingsupport_pillar_widening_factor))
  1325. // Radius in mm of the pillar base.
  1326. ((ConfigOptionFloat, branchingsupport_base_diameter))/*= 2.0*/
  1327. // The height of the pillar base cone in mm.
  1328. ((ConfigOptionFloat, branchingsupport_base_height))/*= 1.0*/
  1329. // The minimum distance of the pillar base from the model in mm.
  1330. ((ConfigOptionFloat, branchingsupport_base_safety_distance)) /*= 1.0*/
  1331. // The default angle for connecting support sticks and junctions.
  1332. ((ConfigOptionFloat, branchingsupport_critical_angle))/*= 45*/
  1333. // The max length of a bridge in mm
  1334. ((ConfigOptionFloat, branchingsupport_max_bridge_length))/*= 15.0*/
  1335. // The max distance of two pillars to get cross linked.
  1336. ((ConfigOptionFloat, branchingsupport_max_pillar_link_distance))
  1337. // The elevation in Z direction upwards. This is the space between the pad
  1338. // and the model object's bounding box bottom. Units in mm.
  1339. ((ConfigOptionFloat, branchingsupport_object_elevation))/*= 5.0*/
  1340. /////// Following options influence automatic support points placement:
  1341. ((ConfigOptionInt, support_points_density_relative))
  1342. ((ConfigOptionFloat, support_points_minimal_distance))
  1343. // Now for the base pool (pad) /////////////////////////////////////////////
  1344. // Enabling or disabling support creation
  1345. ((ConfigOptionBool, pad_enable))
  1346. // The thickness of the pad walls
  1347. ((ConfigOptionFloat, pad_wall_thickness))/*= 2*/
  1348. // The height of the pad from the bottom to the top not considering the pit
  1349. ((ConfigOptionFloat, pad_wall_height))/*= 5*/
  1350. // How far should the pad extend around the contained geometry
  1351. ((ConfigOptionFloat, pad_brim_size))
  1352. // The greatest distance where two individual pads are merged into one. The
  1353. // distance is measured roughly from the centroids of the pads.
  1354. ((ConfigOptionFloat, pad_max_merge_distance))/*= 50*/
  1355. // The smoothing radius of the pad edges
  1356. // ((ConfigOptionFloat, pad_edge_radius))/*= 1*/;
  1357. // The slope of the pad wall...
  1358. ((ConfigOptionFloat, pad_wall_slope))
  1359. // /////////////////////////////////////////////////////////////////////////
  1360. // Zero elevation mode parameters:
  1361. // - The object pad will be derived from the model geometry.
  1362. // - There will be a gap between the object pad and the generated pad
  1363. // according to the support_base_safety_distance parameter.
  1364. // - The two pads will be connected with tiny connector sticks
  1365. // /////////////////////////////////////////////////////////////////////////
  1366. // Disable the elevation (ignore its value) and use the zero elevation mode
  1367. ((ConfigOptionBool, pad_around_object))
  1368. ((ConfigOptionBool, pad_around_object_everywhere))
  1369. // This is the gap between the object bottom and the generated pad
  1370. ((ConfigOptionFloat, pad_object_gap))
  1371. // How far to place the connector sticks on the object pad perimeter
  1372. ((ConfigOptionFloat, pad_object_connector_stride))
  1373. // The width of the connectors sticks
  1374. ((ConfigOptionFloat, pad_object_connector_width))
  1375. // How much should the tiny connectors penetrate into the model body
  1376. ((ConfigOptionFloat, pad_object_connector_penetration))
  1377. // /////////////////////////////////////////////////////////////////////////
  1378. // Model hollowing parameters:
  1379. // - Models can be hollowed out as part of the SLA print process
  1380. // - Thickness of the hollowed model walls can be adjusted
  1381. // -
  1382. // - Additional holes will be drilled into the hollow model to allow for
  1383. // - resin removal.
  1384. // /////////////////////////////////////////////////////////////////////////
  1385. ((ConfigOptionBool, hollowing_enable))
  1386. // The minimum thickness of the model walls to maintain. Note that the
  1387. // resulting walls may be thicker due to smoothing out fine cavities where
  1388. // resin could stuck.
  1389. ((ConfigOptionFloat, hollowing_min_thickness))
  1390. // Indirectly controls the voxel size (resolution) used by openvdb
  1391. ((ConfigOptionFloat, hollowing_quality))
  1392. // Indirectly controls the minimum size of created cavities.
  1393. ((ConfigOptionFloat, hollowing_closing_distance))
  1394. )
  1395. enum SLAMaterialSpeed { slamsSlow, slamsFast, slamsHighViscosity };
  1396. PRINT_CONFIG_CLASS_DEFINE(
  1397. SLAMaterialConfig,
  1398. ((ConfigOptionFloat, initial_layer_height))
  1399. ((ConfigOptionFloat, bottle_cost))
  1400. ((ConfigOptionFloat, bottle_volume))
  1401. ((ConfigOptionFloat, bottle_weight))
  1402. ((ConfigOptionStrings, filament_custom_variables))
  1403. ((ConfigOptionFloat, material_density))
  1404. ((ConfigOptionFloat, exposure_time))
  1405. ((ConfigOptionFloat, initial_exposure_time))
  1406. ((ConfigOptionFloats, material_correction))
  1407. ((ConfigOptionFloat, material_correction_x))
  1408. ((ConfigOptionFloat, material_correction_y))
  1409. ((ConfigOptionFloat, material_correction_z))
  1410. ((ConfigOptionEnum<SLAMaterialSpeed>, material_print_speed))
  1411. ((ConfigOptionFloat, material_ow_support_pillar_diameter))
  1412. ((ConfigOptionFloat, material_ow_branchingsupport_pillar_diameter))
  1413. ((ConfigOptionFloat, material_ow_support_head_front_diameter))
  1414. ((ConfigOptionFloat, material_ow_branchingsupport_head_front_diameter))
  1415. ((ConfigOptionFloat, material_ow_support_head_penetration))
  1416. ((ConfigOptionFloat, material_ow_branchingsupport_head_penetration))
  1417. ((ConfigOptionFloat, material_ow_support_head_width))
  1418. ((ConfigOptionFloat, material_ow_branchingsupport_head_width))
  1419. ((ConfigOptionInt, material_ow_support_points_density_relative))
  1420. ((ConfigOptionFloat, material_ow_first_layer_size_compensation)) /* material_ow_elefant_foot_compensation */
  1421. ((ConfigOptionFloat, material_ow_relative_correction_x))
  1422. ((ConfigOptionFloat, material_ow_relative_correction_y))
  1423. ((ConfigOptionFloat, material_ow_relative_correction_z))
  1424. )
  1425. PRINT_CONFIG_CLASS_DEFINE(
  1426. SLAPrinterConfig,
  1427. ((ConfigOptionEnum<PrinterTechnology>, printer_technology))
  1428. ((ConfigOptionEnum<OutputFormat>, output_format))
  1429. ((ConfigOptionPoints, bed_shape))
  1430. ((ConfigOptionFloat, max_print_height))
  1431. ((ConfigOptionFloat, display_width))
  1432. ((ConfigOptionFloat, display_height))
  1433. ((ConfigOptionInt, display_pixels_x))
  1434. ((ConfigOptionInt, display_pixels_y))
  1435. ((ConfigOptionEnum<SLADisplayOrientation>, display_orientation))
  1436. ((ConfigOptionBool, display_mirror_x))
  1437. ((ConfigOptionBool, display_mirror_y))
  1438. ((ConfigOptionFloats, relative_correction))
  1439. ((ConfigOptionFloat, relative_correction_x))
  1440. ((ConfigOptionFloat, relative_correction_y))
  1441. ((ConfigOptionFloat, relative_correction_z))
  1442. ((ConfigOptionFloat, absolute_correction))
  1443. ((ConfigOptionFloat, first_layer_size_compensation))
  1444. ((ConfigOptionFloat, elephant_foot_min_width))
  1445. ((ConfigOptionFloat, gamma_correction))
  1446. ((ConfigOptionFloat, fast_tilt_time))
  1447. ((ConfigOptionFloat, slow_tilt_time))
  1448. ((ConfigOptionFloat, high_viscosity_tilt_time))
  1449. ((ConfigOptionFloat, area_fill))
  1450. ((ConfigOptionFloat, min_exposure_time))
  1451. ((ConfigOptionFloat, max_exposure_time))
  1452. ((ConfigOptionFloat, min_initial_exposure_time))
  1453. ((ConfigOptionFloat, max_initial_exposure_time))
  1454. ((ConfigOptionString, printer_custom_variables))
  1455. ((ConfigOptionFloat, sla_output_precision))
  1456. ((ConfigOptionPoints, thumbnails))
  1457. ((ConfigOptionString, thumbnails_color))
  1458. ((ConfigOptionBool, thumbnails_custom_color))
  1459. ((ConfigOptionBool, thumbnails_tag_format))
  1460. ((ConfigOptionBool, thumbnails_with_bed))
  1461. ((ConfigOptionBool, thumbnails_with_support))
  1462. ((ConfigOptionFloat, z_rotate))
  1463. )
  1464. PRINT_CONFIG_CLASS_DERIVED_DEFINE0(
  1465. SLAFullPrintConfig,
  1466. (SLAPrinterConfig, SLAPrintConfig, SLAPrintObjectConfig, SLAMaterialConfig)
  1467. )
  1468. #undef STATIC_PRINT_CONFIG_CACHE
  1469. #undef STATIC_PRINT_CONFIG_CACHE_BASE
  1470. #undef STATIC_PRINT_CONFIG_CACHE_DERIVED
  1471. #undef PRINT_CONFIG_CLASS_ELEMENT_DEFINITION
  1472. #undef PRINT_CONFIG_CLASS_ELEMENT_EQUAL
  1473. #undef PRINT_CONFIG_CLASS_ELEMENT_LOWER
  1474. #undef PRINT_CONFIG_CLASS_ELEMENT_HASH
  1475. #undef PRINT_CONFIG_CLASS_ELEMENT_INITIALIZATION
  1476. #undef PRINT_CONFIG_CLASS_ELEMENT_INITIALIZATION2
  1477. #undef PRINT_CONFIG_CLASS_DEFINE
  1478. #undef PRINT_CONFIG_CLASS_DERIVED_CLASS_LIST
  1479. #undef PRINT_CONFIG_CLASS_DERIVED_CLASS_LIST_ITEM
  1480. #undef PRINT_CONFIG_CLASS_DERIVED_DEFINE
  1481. #undef PRINT_CONFIG_CLASS_DERIVED_DEFINE0
  1482. #undef PRINT_CONFIG_CLASS_DERIVED_DEFINE1
  1483. #undef PRINT_CONFIG_CLASS_DERIVED_HASH
  1484. #undef PRINT_CONFIG_CLASS_DERIVED_EQUAL
  1485. #undef PRINT_CONFIG_CLASS_DERIVED_INITCACHE_ITEM
  1486. #undef PRINT_CONFIG_CLASS_DERIVED_INITCACHE
  1487. #undef PRINT_CONFIG_CLASS_DERIVED_INITIALIZER
  1488. #undef PRINT_CONFIG_CLASS_DERIVED_INITIALIZER_ITEM
  1489. class CLIActionsConfigDef : public ConfigDef
  1490. {
  1491. public:
  1492. CLIActionsConfigDef();
  1493. };
  1494. class CLITransformConfigDef : public ConfigDef
  1495. {
  1496. public:
  1497. CLITransformConfigDef();
  1498. };
  1499. class CLIMiscConfigDef : public ConfigDef
  1500. {
  1501. public:
  1502. CLIMiscConfigDef();
  1503. };
  1504. typedef std::string t_custom_gcode_key;
  1505. // This map containes list of specific placeholders for each custom G-code, if any exist
  1506. const std::map<t_custom_gcode_key, t_config_option_keys>& custom_gcode_specific_placeholders();
  1507. // Next classes define placeholders used by GUI::EditGCodeDialog.
  1508. class ReadOnlySlicingStatesConfigDef : public ConfigDef
  1509. {
  1510. public:
  1511. ReadOnlySlicingStatesConfigDef();
  1512. };
  1513. class ReadWriteSlicingStatesConfigDef : public ConfigDef
  1514. {
  1515. public:
  1516. ReadWriteSlicingStatesConfigDef();
  1517. };
  1518. class OtherSlicingStatesConfigDef : public ConfigDef
  1519. {
  1520. public:
  1521. OtherSlicingStatesConfigDef();
  1522. };
  1523. class PrintStatisticsConfigDef : public ConfigDef
  1524. {
  1525. public:
  1526. PrintStatisticsConfigDef();
  1527. };
  1528. class ObjectsInfoConfigDef : public ConfigDef
  1529. {
  1530. public:
  1531. ObjectsInfoConfigDef();
  1532. };
  1533. class DimensionsConfigDef : public ConfigDef
  1534. {
  1535. public:
  1536. DimensionsConfigDef();
  1537. };
  1538. class TimestampsConfigDef : public ConfigDef
  1539. {
  1540. public:
  1541. TimestampsConfigDef();
  1542. };
  1543. class OtherPresetsConfigDef : public ConfigDef
  1544. {
  1545. public:
  1546. OtherPresetsConfigDef();
  1547. };
  1548. // This classes defines all custom G-code specific placeholders.
  1549. class CustomGcodeSpecificConfigDef : public ConfigDef
  1550. {
  1551. public:
  1552. CustomGcodeSpecificConfigDef();
  1553. };
  1554. extern const CustomGcodeSpecificConfigDef custom_gcode_specific_config_def;
  1555. // This class defines the command line options representing actions.
  1556. extern const CLIActionsConfigDef cli_actions_config_def;
  1557. // This class defines the command line options representing transforms.
  1558. extern const CLITransformConfigDef cli_transform_config_def;
  1559. // This class defines all command line options that are not actions or transforms.
  1560. extern const CLIMiscConfigDef cli_misc_config_def;
  1561. class DynamicPrintAndCLIConfig : public DynamicPrintConfig
  1562. {
  1563. public:
  1564. DynamicPrintAndCLIConfig() {}
  1565. DynamicPrintAndCLIConfig(const DynamicPrintAndCLIConfig &other) : DynamicPrintConfig(other) {}
  1566. // Overrides ConfigBase::def(). Static configuration definition. Any value stored into this ConfigBase shall have its definition here.
  1567. const ConfigDef* def() const override { return &s_def; }
  1568. // Verify whether the opt_key has not been obsoleted or renamed.
  1569. // Both opt_key and value may be modified by handle_legacy().
  1570. // If the opt_key is no more valid in this version of Slic3r, opt_key is cleared by handle_legacy().
  1571. // handle_legacy() is called internally by set_deserialize().
  1572. void handle_legacy(t_config_option_key &opt_key, std::string &value) const override;
  1573. private:
  1574. class PrintAndCLIConfigDef : public ConfigDef
  1575. {
  1576. public:
  1577. PrintAndCLIConfigDef() {
  1578. this->options.insert(print_config_def.options.begin(), print_config_def.options.end());
  1579. this->options.insert(cli_actions_config_def.options.begin(), cli_actions_config_def.options.end());
  1580. this->options.insert(cli_transform_config_def.options.begin(), cli_transform_config_def.options.end());
  1581. this->options.insert(cli_misc_config_def.options.begin(), cli_misc_config_def.options.end());
  1582. for (const auto &kvp : this->options)
  1583. this->by_serialization_key_ordinal[kvp.second.serialization_key_ordinal] = &kvp.second;
  1584. }
  1585. // Do not release the default values, they are handled by print_config_def & cli_actions_config_def / cli_transform_config_def / cli_misc_config_def.
  1586. ~PrintAndCLIConfigDef() { this->options.clear(); }
  1587. };
  1588. static PrintAndCLIConfigDef s_def;
  1589. };
  1590. bool is_XL_printer(const DynamicPrintConfig &cfg);
  1591. bool is_XL_printer(const PrintConfig &cfg);
  1592. Points get_bed_shape(const DynamicPrintConfig &cfg);
  1593. Points get_bed_shape(const PrintConfig &cfg);
  1594. Points get_bed_shape(const SLAPrinterConfig &cfg);
  1595. std::string get_sla_suptree_prefix(const DynamicPrintConfig &config);
  1596. // ModelConfig is a wrapper around DynamicPrintConfig with an addition of a timestamp.
  1597. // Each change of ModelConfig is tracked by assigning a new timestamp from a global counter.
  1598. // The counter is used for faster synchronization of the background slicing thread
  1599. // with the front end by skipping synchronization of equal config dictionaries.
  1600. // The global counter is also used for avoiding unnecessary serialization of config
  1601. // dictionaries when taking an Undo snapshot.
  1602. //
  1603. // The global counter is NOT thread safe, therefore it is recommended to use ModelConfig from
  1604. // the main thread only.
  1605. //
  1606. // As there is a global counter and it is being increased with each change to any ModelConfig,
  1607. // if two ModelConfig dictionaries differ, they should differ with their timestamp as well.
  1608. // Therefore copying the ModelConfig including its timestamp is safe as there is no harm
  1609. // in having multiple ModelConfig with equal timestamps as long as their dictionaries are equal.
  1610. //
  1611. // The timestamp is used by the Undo/Redo stack. As zero timestamp means invalid timestamp
  1612. // to the Undo/Redo stack (zero timestamp means the Undo/Redo stack needs to serialize and
  1613. // compare serialized data for differences), zero timestamp shall never be used.
  1614. // Timestamp==1 shall only be used for empty dictionaries.
  1615. class ModelConfig
  1616. {
  1617. public:
  1618. // Following method clears the config and increases its timestamp, so the deleted
  1619. // state is considered changed from perspective of the undo/redo stack.
  1620. void reset() { m_data.clear(); touch(); }
  1621. void assign_config(const ModelConfig &rhs) {
  1622. if (m_timestamp != rhs.m_timestamp) {
  1623. m_data = rhs.m_data;
  1624. m_timestamp = rhs.m_timestamp;
  1625. }
  1626. }
  1627. void assign_config(ModelConfig &&rhs) {
  1628. if (m_timestamp != rhs.m_timestamp) {
  1629. m_data = std::move(rhs.m_data);
  1630. m_timestamp = rhs.m_timestamp;
  1631. rhs.reset();
  1632. }
  1633. }
  1634. // Modification of the ModelConfig is not thread safe due to the global timestamp counter!
  1635. // Don't call modification methods from the back-end!
  1636. // Assign methods don't assign if src==dst to not having to bump the timestamp in case they are equal.
  1637. void assign_config(const DynamicPrintConfig &rhs) { if (m_data != rhs) { m_data = rhs; this->touch(); } }
  1638. void assign_config(DynamicPrintConfig &&rhs) { if (m_data != rhs) { m_data = std::move(rhs); this->touch(); } }
  1639. void apply(const ModelConfig &other, bool ignore_nonexistent = false) { this->apply(other.get(), ignore_nonexistent); }
  1640. void apply(const ConfigBase &other, bool ignore_nonexistent = false) { m_data.apply_only(other, other.keys(), ignore_nonexistent); this->touch(); }
  1641. void apply_only(const ModelConfig &other, const t_config_option_keys &keys, bool ignore_nonexistent = false) { this->apply_only(other.get(), keys, ignore_nonexistent); }
  1642. void apply_only(const ConfigBase &other, const t_config_option_keys &keys, bool ignore_nonexistent = false) { m_data.apply_only(other, keys, ignore_nonexistent); this->touch(); }
  1643. bool set_key_value(const std::string &opt_key, ConfigOption *opt) { bool out = m_data.set_key_value(opt_key, opt); this->touch(); return out; }
  1644. template<typename T>
  1645. void set(const std::string &opt_key, T value) { m_data.set(opt_key, value, true); this->touch(); }
  1646. void set_any(const std::string &opt_key, bool enable, boost::any value, int16_t extruder_id)
  1647. {
  1648. ConfigOption *opt = m_data.option(opt_key, true);
  1649. assert(opt);
  1650. if (opt) {
  1651. opt->set_any(value, extruder_id);
  1652. opt->set_enabled(enable, extruder_id);
  1653. this->touch();
  1654. }
  1655. }
  1656. void set_deserialize(const t_config_option_key &opt_key, const std::string &str, ConfigSubstitutionContext &substitution_context, bool append = false)
  1657. { m_data.set_deserialize(opt_key, str, substitution_context, append); this->touch(); }
  1658. void set_deserialize_strict(const t_config_option_key &opt_key, const std::string &str, bool append = false)
  1659. { m_data.set_deserialize_strict(opt_key, str, append); this->touch(); }
  1660. bool erase(const t_config_option_key &opt_key) { bool out = m_data.erase(opt_key); if (out) this->touch(); return out; }
  1661. // Getters are thread safe.
  1662. // The following implicit conversion breaks the Cereal serialization.
  1663. // operator const DynamicPrintConfig&() const throw() { return this->get(); }
  1664. const DynamicPrintConfig& get() const throw() { return m_data; }
  1665. bool empty() const throw() { return m_data.empty(); }
  1666. size_t size() const throw() { return m_data.size(); }
  1667. auto cbegin() const { return m_data.cbegin(); }
  1668. auto cend() const { return m_data.cend(); }
  1669. t_config_option_keys keys() const { return m_data.keys(); }
  1670. bool has(const t_config_option_key& opt_key) const { return m_data.has(opt_key); }
  1671. const ConfigDef* def() const { return m_data.def(); }
  1672. bool operator==(const ModelConfig& other) const { return m_data.equals(other.m_data); }
  1673. bool operator!=(const ModelConfig& other) const { return !this->operator==(other); }
  1674. const ConfigOption* option(const t_config_option_key &opt_key) const { return m_data.option(opt_key); }
  1675. int opt_int(const t_config_option_key &opt_key) const { return m_data.opt_int(opt_key); }
  1676. int extruder() const { return opt_int("extruder"); }
  1677. int first_layer_extruder() const { return opt_int("first_layer_extruder"); }
  1678. double opt_float(const t_config_option_key &opt_key) const { return m_data.opt_float(opt_key); }
  1679. std::string opt_serialize(const t_config_option_key &opt_key) const { return m_data.opt_serialize(opt_key); }
  1680. // Return an optional timestamp of this object.
  1681. // If the timestamp returned is non-zero, then the serialization framework will
  1682. // only save this object on the Undo/Redo stack if the timestamp is different
  1683. // from the timestmap of the object at the top of the Undo / Redo stack.
  1684. virtual uint64_t timestamp() const throw() { return m_timestamp; }
  1685. bool timestamp_matches(const ModelConfig &rhs) const throw() { return m_timestamp == rhs.m_timestamp; }
  1686. // Not thread safe! Should not be called from other than the main thread!
  1687. void touch() { m_timestamp = ++ s_last_timestamp; }
  1688. // utilities to help convert from prusa config.
  1689. // if with_phony, then the phony settigns will be set to phony if needed.
  1690. void convert_from_prusa(const DynamicPrintConfig& global_config, bool with_phony);
  1691. void handle_legacy_composite(std::vector<std::pair<t_config_option_key, std::string>> &opt_deleted)
  1692. { PrintConfigDef::handle_legacy_composite(m_data, opt_deleted); }
  1693. private:
  1694. friend class cereal::access;
  1695. template<class Archive> void serialize(Archive& ar) { ar(m_timestamp); ar(m_data); }
  1696. uint64_t m_timestamp { 1 };
  1697. DynamicPrintConfig m_data;
  1698. static uint64_t s_last_timestamp;
  1699. };
  1700. void deserialize_maybe_from_prusa(std::map<t_config_option_key, std::string> settings,
  1701. ModelConfig & config,
  1702. const DynamicPrintConfig & global_config,
  1703. ConfigSubstitutionContext & config_substitutions,
  1704. bool with_phony,
  1705. bool check_prusa);
  1706. void deserialize_maybe_from_prusa(std::map<t_config_option_key, std::string> settings,
  1707. DynamicPrintConfig & config,
  1708. ConfigSubstitutionContext & config_substitutions,
  1709. bool with_phony,
  1710. bool check_prusa);
  1711. } // namespace Slic3r
  1712. // Serialization through the Cereal library
  1713. namespace cereal {
  1714. // Let cereal know that there are load / save non-member functions declared for DynamicPrintConfig, ignore serialize / load / save from parent class DynamicConfig.
  1715. template <class Archive> struct specialize<Archive, Slic3r::DynamicPrintConfig, cereal::specialization::non_member_load_save> {};
  1716. template<class Archive> void load(Archive& archive, Slic3r::DynamicPrintConfig &config)
  1717. {
  1718. size_t cnt;
  1719. archive(cnt);
  1720. config.clear();
  1721. for (size_t i = 0; i < cnt; ++ i) {
  1722. size_t serialization_key_ordinal;
  1723. archive(serialization_key_ordinal);
  1724. assert(serialization_key_ordinal > 0);
  1725. auto it = Slic3r::print_config_def.by_serialization_key_ordinal.find(serialization_key_ordinal);
  1726. assert(it != Slic3r::print_config_def.by_serialization_key_ordinal.end());
  1727. config.set_key_value(it->second->opt_key, it->second->load_option_from_archive(archive));
  1728. }
  1729. }
  1730. template<class Archive> void save(Archive& archive, const Slic3r::DynamicPrintConfig &config)
  1731. {
  1732. size_t cnt = config.size();
  1733. archive(cnt);
  1734. for (auto it = config.cbegin(); it != config.cend(); ++it) {
  1735. const Slic3r::ConfigOptionDef* optdef = Slic3r::print_config_def.get(it->first);
  1736. assert(optdef != nullptr);
  1737. assert(optdef->serialization_key_ordinal > 0);
  1738. archive(optdef->serialization_key_ordinal);
  1739. optdef->save_option_to_archive(archive, it->second.get());
  1740. }
  1741. }
  1742. }
  1743. #endif