Skip to content

Commit

Permalink
FIX: CLI: fix an exception when parsing scale params
Browse files Browse the repository at this point in the history
github: #4628
Change-Id: I29f1f8e605c12a92b140e53b6b894a0a676f3588
  • Loading branch information
lanewei120 committed Aug 26, 2024
1 parent 987f98f commit 2d4655e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/BambuStudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3785,10 +3785,16 @@ int CLI::run(int argc, char **argv)
// this affects volumes:
o->rotate(Geometry::deg2rad(m_config.opt_float(opt_key)), Y);
} else if (opt_key == "scale") {
float ratio = m_config.opt_float(opt_key);
if (ratio <= 0.f) {
BOOST_LOG_TRIVIAL(error) << boost::format("Invalid params:invalid scale ratio %1%")%ratio;
record_exit_reson(outfile_dir, CLI_INVALID_PARAMS, 0, cli_errors[CLI_INVALID_PARAMS], sliced_info);
flush_and_exit(CLI_INVALID_PARAMS);
}
for (auto &model : m_models)
for (auto &o : model.objects)
// this affects volumes:
o->scale(m_config.get_abs_value(opt_key, 1));
o->scale(ratio);
} else if (opt_key == "scale_to_fit") {
const Vec3d &opt = m_config.opt<ConfigOptionPoint3>(opt_key)->value;
if (opt.x() <= 0 || opt.y() <= 0 || opt.z() <= 0) {
Expand Down

0 comments on commit 2d4655e

Please sign in to comment.