Skip to content

Commit

Permalink
CLI: add the "regenerate" command, for use in Makefiles etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Jan 24, 2017
1 parent 27a5f6f commit 3fc85b7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/platform/climain.cpp
Expand Up @@ -46,6 +46,8 @@ static void ShowUsage(const std::string &cmd) {
being triangulated first.
export-surfaces --output <pattern>
Exports exact surfaces of solids in the sketch, if any.
regenerate
Reloads all imported files, regenerates the sketch, and saves it.
)");

auto FormatListFromFileFilter = [](const FileFilter *filter) {
Expand Down Expand Up @@ -266,6 +268,20 @@ static bool RunCommand(const std::vector<std::string> args) {
StepFileWriter sfw = {};
sfw.ExportSurfacesTo(output);
};
} else if(args[1] == "regenerate") {
for(size_t argn = 2; argn < args.size(); argn++) {
if(!(ParseInputFile(argn))) {
fprintf(stderr, "Unrecognized option '%s'.\n", args[argn].c_str());
return false;
}
}

outputPattern = "%.slvs";

runner = [&](const std::string &output) {
SS.ReloadAllImported();
SS.SaveToFile(output);
};
} else {
fprintf(stderr, "Unrecognized command '%s'.\n", args[1].c_str());
return false;
Expand Down

0 comments on commit 3fc85b7

Please sign in to comment.