CLI: add the "regenerate" command, for use in Makefiles etc.
parent
27a5f6f9bd
commit
3fc85b7934
|
@ -46,6 +46,8 @@ static void ShowUsage(const std::string &cmd) {
|
||||||
being triangulated first.
|
being triangulated first.
|
||||||
export-surfaces --output <pattern>
|
export-surfaces --output <pattern>
|
||||||
Exports exact surfaces of solids in the sketch, if any.
|
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) {
|
auto FormatListFromFileFilter = [](const FileFilter *filter) {
|
||||||
|
@ -266,6 +268,20 @@ static bool RunCommand(const std::vector<std::string> args) {
|
||||||
StepFileWriter sfw = {};
|
StepFileWriter sfw = {};
|
||||||
sfw.ExportSurfacesTo(output);
|
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 {
|
} else {
|
||||||
fprintf(stderr, "Unrecognized command '%s'.\n", args[1].c_str());
|
fprintf(stderr, "Unrecognized command '%s'.\n", args[1].c_str());
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue