mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-23 13:33:12 +08:00
FIX:fix export stl function with cut connector
Jira: STUDIO-5760 Change-Id: I25707e96ed0eb12cf02593941d7a3945b0c90956
This commit is contained in:
parent
b5a913e127
commit
27dfac67f6
@ -10878,7 +10878,6 @@ TriangleMesh Plater::combine_mesh_fff(const ModelObject& mo, int instance_id, st
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BBS export with/without boolean, however, stil merge mesh
|
// BBS export with/without boolean, however, stil merge mesh
|
||||||
#define EXPORT_WITH_BOOLEAN 0
|
|
||||||
void Plater::export_stl(bool extended, bool selection_only, bool multi_stls)
|
void Plater::export_stl(bool extended, bool selection_only, bool multi_stls)
|
||||||
{
|
{
|
||||||
if (p->model.objects.empty()) { return; }
|
if (p->model.objects.empty()) { return; }
|
||||||
@ -10898,21 +10897,39 @@ void Plater::export_stl(bool extended, bool selection_only, bool multi_stls)
|
|||||||
|
|
||||||
wxBusyCursor wait;
|
wxBusyCursor wait;
|
||||||
const auto& selection = p->get_selection();
|
const auto& selection = p->get_selection();
|
||||||
const auto obj_idx = selection.get_object_idx();
|
|
||||||
|
|
||||||
#if EXPORT_WITH_BOOLEAN
|
|
||||||
if (selection_only && (obj_idx == -1 || selection.is_wipe_tower()))
|
|
||||||
return;
|
|
||||||
#else
|
|
||||||
// BBS support selecting multiple objects
|
// BBS support selecting multiple objects
|
||||||
if (selection_only && selection.is_wipe_tower()) return;
|
if (selection_only && selection.is_wipe_tower())
|
||||||
|
return;
|
||||||
// BBS
|
const auto obj_idx = selection.get_object_idx();
|
||||||
if (selection_only) {
|
if (obj_idx == -1)
|
||||||
// only support selection single full object and mulitiple full object
|
return;
|
||||||
if (!selection.is_single_full_object() && !selection.is_multiple_full_object()) return;
|
//confirm export_with_boolean
|
||||||
|
bool exist_negive_volume = false;
|
||||||
|
bool export_with_boolean = false;
|
||||||
|
const ModelObject *cur_model_object = p->model.objects[obj_idx];
|
||||||
|
for (auto v : cur_model_object->volumes) {
|
||||||
|
if (v->type() == ModelVolumeType::NEGATIVE_VOLUME) {
|
||||||
|
exist_negive_volume=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (exist_negive_volume) {
|
||||||
|
MessageDialog dlg(this, _L("Negative parts detected. Would you like to perform mesh boolean before exporting?"), _L("Message"),
|
||||||
|
wxICON_QUESTION | wxYES_NO);
|
||||||
|
int answer = dlg.ShowModal();
|
||||||
|
if (answer == wxID_YES) {
|
||||||
|
export_with_boolean = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!export_with_boolean) {
|
||||||
|
// BBS
|
||||||
|
if (selection_only) {
|
||||||
|
// only support selection single full object and mulitiple full object
|
||||||
|
if (!selection.is_single_full_object() && !selection.is_multiple_full_object())
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Following lambda generates a combined mesh for export with normals pointing outwards.
|
// Following lambda generates a combined mesh for export with normals pointing outwards.
|
||||||
auto mesh_to_export_fff_no_boolean = [](const ModelObject &mo, int instance_id) {
|
auto mesh_to_export_fff_no_boolean = [](const ModelObject &mo, int instance_id) {
|
||||||
TriangleMesh mesh;
|
TriangleMesh mesh;
|
||||||
@ -10934,7 +10951,6 @@ void Plater::export_stl(bool extended, bool selection_only, bool multi_stls)
|
|||||||
mesh.transform(mo.instances[instance_id]->get_matrix(), true);
|
mesh.transform(mo.instances[instance_id]->get_matrix(), true);
|
||||||
return mesh;
|
return mesh;
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
auto mesh_to_export_sla = [&, this](const ModelObject& mo, int instance_id) {
|
auto mesh_to_export_sla = [&, this](const ModelObject& mo, int instance_id) {
|
||||||
TriangleMesh mesh;
|
TriangleMesh mesh;
|
||||||
|
|
||||||
@ -11005,13 +11021,14 @@ void Plater::export_stl(bool extended, bool selection_only, bool multi_stls)
|
|||||||
std::function<TriangleMesh(const ModelObject& mo, int instance_id)>
|
std::function<TriangleMesh(const ModelObject& mo, int instance_id)>
|
||||||
mesh_to_export;
|
mesh_to_export;
|
||||||
|
|
||||||
if (p->printer_technology == ptFFF)
|
if (p->printer_technology == ptFFF){
|
||||||
#if EXPORT_WITH_BOOLEAN
|
if (export_with_boolean) {
|
||||||
mesh_to_export = [this](const ModelObject& mo, int instance_id) {return Plater::combine_mesh_fff(mo, instance_id,
|
mesh_to_export = [this](const ModelObject& mo, int instance_id) {return Plater::combine_mesh_fff(mo, instance_id,
|
||||||
[this](const std::string& msg) {return get_notification_manager()->push_plater_error_notification(msg); }); };
|
[this](const std::string& msg) {return get_notification_manager()->push_plater_error_notification(msg); }); };
|
||||||
#else
|
} else {
|
||||||
mesh_to_export = mesh_to_export_fff_no_boolean;
|
mesh_to_export = mesh_to_export_fff_no_boolean;
|
||||||
#endif
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
mesh_to_export = mesh_to_export_sla;
|
mesh_to_export = mesh_to_export_sla;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user