ENH: export stl with proper translation

1. export stl with proper translation
   If the object is not on first plate, previous export will give the
   vertices very big coordinates.
   jira: STUDIO-5991
2. add log for boolean failure reasons.

Change-Id: I52cec4e3ca31b215fbe60246f0266de3d4b8cb61
(cherry picked from commit 6c4dbc8c6c43dd5789e5ce3a572f465548068b77)
This commit is contained in:
Arthur 2024-01-17 11:21:26 +08:00 committed by Lane.Wei
parent 5145f39f57
commit abbd4e3ca7
3 changed files with 14 additions and 5 deletions

View File

@ -275,14 +275,20 @@ It check_csgmesh_booleans(const Range<It> &csgrange, Visitor &&vfn)
}
try {
if (!m || MeshBoolean::cgal::empty(*m))
if (!m || MeshBoolean::cgal::empty(*m)) {
BOOST_LOG_TRIVIAL(info) << "check_csgmesh_booleans fails! mesh " << i << "/" << csgrange.size() << " is empty, cannot do boolean!";
return;
}
if (!MeshBoolean::cgal::does_bound_a_volume(*m))
if (!MeshBoolean::cgal::does_bound_a_volume(*m)) {
BOOST_LOG_TRIVIAL(info) << "check_csgmesh_booleans fails! mesh "<<i<<"/"<<csgrange.size()<<" does_bound_a_volume is false, cannot do boolean!";
return;
}
if (MeshBoolean::cgal::does_self_intersect(*m))
if (MeshBoolean::cgal::does_self_intersect(*m)) {
BOOST_LOG_TRIVIAL(info) << "check_csgmesh_booleans fails! mesh " << i << "/" << csgrange.size() << " does_self_intersect is true, cannot do boolean!";
return;
}
}
catch (...) { return; }

View File

@ -687,7 +687,7 @@ wxMenuItem* MenuFactory::append_menu_item_fix_through_netfabb(wxMenu* menu)
void MenuFactory::append_menu_item_export_stl(wxMenu* menu, bool is_mulity_menu)
{
append_menu_item(menu, wxID_ANY, _L("Export as one STL") + dots, "",
append_menu_item(menu, wxID_ANY, _L("Export as one STL"), "",
[](wxCommandEvent&) { plater()->export_stl(false, true); }, "", nullptr,
[is_mulity_menu]() {
const Selection& selection = plater()->canvas3D()->get_selection();

View File

@ -11090,7 +11090,10 @@ void Plater::export_stl(bool extended, bool selection_only, bool multi_stls)
mesh.transform(volume->get_volume_transformation().get_matrix(), true);
}
if (model_object->instances.size() == 1) mesh.translate(-model_object->origin_translation.cast<float>());
if (model_object->instances.size() == 1) {
//coconut: make the mesh's origin=(0,0,0). origin_translation is useless here.
mesh.align_to_origin();//translate(- model_object->origin_translation.cast<float>());
}
}
else if (selection.is_multiple_full_object() && !multi_stls) {
const std::set<std::pair<int, int>>& instances_idxs = p->get_selection().get_selected_object_instances();