diff --git a/main.cpp b/main.cpp index b878bf8..7662a15 100644 --- a/main.cpp +++ b/main.cpp @@ -17,8 +17,10 @@ using namespace std; int check_folder_structure(void); vector get_folder_entries(const char *folder); -vector get_choices(void); +vector get_file_choices(void); string pick_option(const string& name, const vector& options); +string choose_support(); +string choose_pattern(const string& place); void flush_input(void); void usage(char *name); @@ -41,7 +43,7 @@ int main(int argc, char **argv) } // Iterate configurations and build command - configurations = get_choices(); + configurations = get_file_choices(); command = "slic3r --no-gui"; for (it = configurations.begin(); it != configurations.end(); ++it) { @@ -50,6 +52,20 @@ int main(int argc, char **argv) command += "\""; } + // Support choices + command += choose_support(); + + // Bottom pattern choices + command += " --bottom-infill-pattern \""; + command += choose_pattern("Bottom Infill"); + command += "\""; + + // Top pattern choices + command += " --top-infill-pattern \""; + command += choose_pattern("Top Infill"); + command += "\""; + + // Add filename command += " \""; command += argv[1]; command += "\""; @@ -125,7 +141,7 @@ vector get_folder_entries(const char *folder) return result; } -vector get_choices(void) +vector get_file_choices(void) { vector result; vector options; @@ -165,8 +181,12 @@ string pick_option(const string& name, const vector& options) int i; int error; - printf("Available %s configurations:\n", name.c_str()); - printf("%-2d - Use slic3r defaults\n", 0); + if (1 == options.size()) + { + return options[0]; + } + + printf("Choose %s configuration:\n", name.c_str()); i = 1; for (it = options.begin(); it != options.end(); ++it) { @@ -184,18 +204,43 @@ redo_choice: goto redo_choice; } - if ((i < 0) || (i > options.size())) + if ((i <= 0) || (i > options.size())) { printf("Number out of bounds. Try again.\n"); goto redo_choice; } - if (0 == i) + return options[i - 1]; +} + +string choose_support() +{ + vector options; + + options.push_back("Do not generate support"); + options.push_back("Generate support"); + + if (pick_option("Support", options) == options[1]) + { + return "--support-material"; + } + else { return ""; } +} - return options[i - 1]; +string choose_pattern(const string& place) +{ + vector options; + + options.push_back("rectilinear"); + options.push_back("concentric"); + options.push_back("hilbertcurve"); + options.push_back("archimedeanchords"); + options.push_back("octagramspiral"); + + return pick_option(place, options); } void flush_input()