Added(ported) function fix_through_netfabb()
+ Fixed adding of the instances to the object list
This commit is contained in:
parent
8c4fa9ba51
commit
2c0b784a2d
@ -74,6 +74,13 @@ if(WIN32)
|
||||
message("STL fixing by the Netfabb service will not be compiled")
|
||||
unset(WIN10SDK_PATH)
|
||||
endif()
|
||||
if(WIN10SDK_PATH)
|
||||
message("Building with Win10 Netfabb STL fixing service support")
|
||||
add_definitions(-DHAS_WIN10SDK)
|
||||
include_directories("${WIN10SDK_PATH}/Include")
|
||||
else()
|
||||
message("Building without Win10 Netfabb STL fixing service support")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
|
@ -286,8 +286,10 @@ void ObjectList::context_menu()
|
||||
else if (title == _("Name") && pt.x >15 &&
|
||||
m_objects_model->GetBitmap(item).GetRefData() == m_bmp_manifold_warning.GetRefData())
|
||||
{
|
||||
if (is_windows10())
|
||||
/*fix_through_netfabb()*/;// #ys_FIXME
|
||||
if (is_windows10()) {
|
||||
const auto obj_idx = m_objects_model->GetIdByItem(m_objects_model->GetTopParent(item));
|
||||
wxGetApp().plater()->fix_through_netfabb(obj_idx);
|
||||
}
|
||||
}
|
||||
#ifndef __WXMSW__
|
||||
GetMainWindow()->SetToolTip(""); // hide tooltip
|
||||
@ -1093,7 +1095,7 @@ void ObjectList::add_object_to_list(size_t obj_idx)
|
||||
|
||||
// add settings to the object, if it has those
|
||||
auto opt_keys = model_object->config.keys();
|
||||
if ( !(opt_keys.size() == 1 && opt_keys[0] == "extruder") ) {
|
||||
if (!opt_keys.empty() && !(opt_keys.size() == 1 && opt_keys[0] == "extruder")) {
|
||||
select_item(m_objects_model->AddSettingsChild(item));
|
||||
Collapse(item);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@
|
||||
#include "BackgroundSlicingProcess.hpp"
|
||||
#include "ProgressStatusBar.hpp"
|
||||
#include "slic3r/Utils/ASCIIFolding.hpp"
|
||||
#include "PrintConfig.hpp"
|
||||
#include "../Utils/FixModelByWin10.hpp"
|
||||
|
||||
#include <wx/glcanvas.h> // Needs to be last because reasons :-/
|
||||
#include "WipeTowerDialog.hpp"
|
||||
@ -898,7 +898,7 @@ struct Plater::priv
|
||||
void start_background_process();
|
||||
void reload_from_disk();
|
||||
void export_object_stl();
|
||||
void fix_through_netfabb();
|
||||
void fix_through_netfabb(const int obj_idx);
|
||||
|
||||
void on_notebook_changed(wxBookCtrlEvent&);
|
||||
void on_select_preset(wxCommandEvent&);
|
||||
@ -1578,35 +1578,35 @@ void Plater::priv::export_object_stl()
|
||||
// TODO
|
||||
}
|
||||
|
||||
void Plater::priv::fix_through_netfabb()
|
||||
void Plater::priv::fix_through_netfabb(const int obj_idx)
|
||||
{
|
||||
/*
|
||||
my ($self) = @_;
|
||||
my ($obj_idx, $object) = $self->selected_object;
|
||||
return if !defined $obj_idx;
|
||||
my $model_object = $self->{model}->objects->[$obj_idx];
|
||||
my $model_fixed = Slic3r::Model->new;
|
||||
Slic3r::GUI::fix_model_by_win10_sdk_gui($model_object, $self->{print}, $model_fixed);
|
||||
if (obj_idx < 0)
|
||||
return;
|
||||
|
||||
my @new_obj_idx = $self->load_model_objects(@{$model_fixed->objects});
|
||||
return if !@new_obj_idx;
|
||||
const auto model_object = model.objects[obj_idx];
|
||||
Model model_fixed;// = new Model();
|
||||
fix_model_by_win10_sdk_gui(*model_object, print, model_fixed);
|
||||
|
||||
auto new_obj_idxs = load_model_objects(model_fixed.objects);
|
||||
if (new_obj_idxs.empty())
|
||||
return;
|
||||
|
||||
foreach my $new_obj_idx (@new_obj_idx) {
|
||||
my $o = $self->{model}->objects->[$new_obj_idx];
|
||||
$o->clear_instances;
|
||||
$o->add_instance($_) for @{$model_object->instances};
|
||||
#$o->invalidate_bounding_box;
|
||||
for(auto new_obj_idx : new_obj_idxs) {
|
||||
auto o = model.objects[new_obj_idx];
|
||||
o->clear_instances();
|
||||
for (auto instance: model_object->instances)
|
||||
o->add_instance(*instance);
|
||||
// o->invalidate_bounding_box();
|
||||
|
||||
if ($o->volumes_count == $model_object->volumes_count) {
|
||||
for my $i (0..($o->volumes_count-1)) {
|
||||
$o->get_volume($i)->config->apply($model_object->get_volume($i)->config);
|
||||
if (o->volumes.size() == model_object->volumes.size()) {
|
||||
for (int i = 0; i < o->volumes.size(); i++) {
|
||||
o->volumes[i]->config.apply(model_object->volumes[i]->config);
|
||||
}
|
||||
}
|
||||
#FIXME restore volumes and their configs, layer_height_ranges, layer_height_profile, layer_height_profile_valid,
|
||||
// FIXME restore volumes and their configs, layer_height_ranges, layer_height_profile, layer_height_profile_valid,
|
||||
}
|
||||
|
||||
$self->remove($obj_idx);
|
||||
*/
|
||||
remove(obj_idx);
|
||||
}
|
||||
|
||||
void Plater::priv::on_notebook_changed(wxBookCtrlEvent&)
|
||||
@ -1969,6 +1969,8 @@ void Plater::increase_instances(size_t num)
|
||||
ModelObject* model_object = p->model.objects[obj_idx];
|
||||
ModelInstance* model_instance = model_object->instances.back();
|
||||
|
||||
bool was_one_instance = model_object->instances.size()==1;
|
||||
|
||||
float offset = 10.0;
|
||||
for (size_t i = 0; i < num; i++, offset += 10.0) {
|
||||
Vec3d offset_vec = model_instance->get_offset() + Vec3d(offset, offset, 0.0);
|
||||
@ -1976,7 +1978,7 @@ void Plater::increase_instances(size_t num)
|
||||
// p->print.get_object(obj_idx)->add_copy(Slic3r::to_2d(offset_vec));
|
||||
}
|
||||
|
||||
sidebar().obj_list()->increase_object_instances(obj_idx, num);
|
||||
sidebar().obj_list()->increase_object_instances(obj_idx, was_one_instance ? num + 1 : num);
|
||||
|
||||
if (p->get_config("autocenter") == "1") {
|
||||
p->arrange();
|
||||
@ -2286,5 +2288,6 @@ void Plater::changed_object(int obj_idx)
|
||||
|
||||
}
|
||||
|
||||
void Plater::fix_through_netfabb(const int obj_idx) { p->fix_through_netfabb(obj_idx); }
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
@ -125,6 +125,7 @@ public:
|
||||
void export_3mf();
|
||||
void reslice();
|
||||
void changed_object(int obj_idx);
|
||||
void fix_through_netfabb(const int obj_idx);
|
||||
void send_gcode();
|
||||
|
||||
void on_extruders_change(int extruders_count);
|
||||
|
@ -532,7 +532,7 @@ wxDataViewItem PrusaObjectDataViewModel::AddInstanceChild(const wxDataViewItem &
|
||||
parent_node->Append(inst_root_node);
|
||||
// notify control
|
||||
ItemAdded(parent_item, inst_root_item);
|
||||
if (num == 1) num++;
|
||||
// if (num == 1) num++;
|
||||
}
|
||||
|
||||
// Add instance nodes
|
||||
|
Loading…
Reference in New Issue
Block a user