CLI: accept --chord-tol as an option to regenerate.

This is currently necessary to get repeatable results when exporting
assemblies as a part of a batch process, since the mesh geometry in
imported files is not regenerated for export.
pull/434/head
whitequark 2019-05-23 16:22:27 +00:00
parent 50c004b679
commit d01f715ebf
1 changed files with 8 additions and 2 deletions

View File

@ -41,8 +41,10 @@ Commands:
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 regenerate [--chord-tol <tolerance>]
Reloads all imported files, regenerates the sketch, and saves it. Reloads all imported files, regenerates the sketch, and saves it.
Note that, although this is not an export command, it uses absolute
chord tolerance, and can be used to prepare assemblies for export.
)"); )");
auto FormatListFromFileFilters = [](const std::vector<Platform::FileFilter> &filters) { auto FormatListFromFileFilters = [](const std::vector<Platform::FileFilter> &filters) {
@ -281,7 +283,8 @@ static bool RunCommand(const std::vector<std::string> args) {
}; };
} else if(args[1] == "regenerate") { } else if(args[1] == "regenerate") {
for(size_t argn = 2; argn < args.size(); argn++) { for(size_t argn = 2; argn < args.size(); argn++) {
if(!(ParseInputFile(argn))) { if(!(ParseInputFile(argn) ||
ParseChordTolerance(argn))) {
fprintf(stderr, "Unrecognized option '%s'.\n", args[argn].c_str()); fprintf(stderr, "Unrecognized option '%s'.\n", args[argn].c_str());
return false; return false;
} }
@ -290,6 +293,9 @@ static bool RunCommand(const std::vector<std::string> args) {
outputPattern = "%.slvs"; outputPattern = "%.slvs";
runner = [&](const Platform::Path &output) { runner = [&](const Platform::Path &output) {
SS.exportChordTol = chordTol;
SS.exportMode = true;
SS.SaveToFile(output); SS.SaveToFile(output);
}; };
} else { } else {