Merge branch 'master' into fs_emboss

This commit is contained in:
Filip Sykala - NTB T15p 2022-12-08 13:17:27 +01:00
commit 35baa70be0
7 changed files with 3187 additions and 3096 deletions

View File

@ -2327,7 +2327,7 @@ void GCode::process_layer_single_object(
interface_extruder = dontcare_extruder; interface_extruder = dontcare_extruder;
} }
bool extrude_support = has_support && support_extruder == extruder_id; bool extrude_support = has_support && support_extruder == extruder_id;
bool extrude_interface = interface_extruder && interface_extruder == extruder_id; bool extrude_interface = has_interface && interface_extruder == extruder_id;
if (extrude_support || extrude_interface) { if (extrude_support || extrude_interface) {
init_layer_delayed(); init_layer_delayed();
m_layer = layer_to_print.support_layer; m_layer = layer_to_print.support_layer;

View File

@ -317,13 +317,16 @@ void Layer::build_up_down_graph(Layer& below, Layer& above)
coord_t* end = srcs + 4; coord_t* end = srcs + 4;
std::sort(begin, end); std::sort(begin, end);
end = std::unique(begin, end); end = std::unique(begin, end);
assert(begin + 2 == end); if (begin + 1 == end) {
if (begin + 1 == end) // Self intersection may happen on source contour. Just copy the Z value.
pt.z() = *begin; pt.z() = *begin;
else if (begin + 2 <= end) { } else {
// store a -1 based negative index into the "intersections" vector here. assert(begin + 2 == end);
m_intersections.emplace_back(srcs[0], srcs[1]); if (begin + 2 <= end) {
pt.z() = -coord_t(m_intersections.size()); // store a -1 based negative index into the "intersections" vector here.
m_intersections.emplace_back(srcs[0], srcs[1]);
pt.z() = -coord_t(m_intersections.size());
}
} }
} }
const std::vector<std::pair<coord_t, coord_t>>& intersections() const { return m_intersections; } const std::vector<std::pair<coord_t, coord_t>>& intersections() const { return m_intersections; }

View File

@ -397,22 +397,37 @@ static ClipperLib_Z::Paths clip_extrusion(const ClipperLib_Z::Path &subject, con
ClipperLib_Z::Clipper clipper; ClipperLib_Z::Clipper clipper;
clipper.ZFillFunction([](const ClipperLib_Z::IntPoint &e1bot, const ClipperLib_Z::IntPoint &e1top, const ClipperLib_Z::IntPoint &e2bot, clipper.ZFillFunction([](const ClipperLib_Z::IntPoint &e1bot, const ClipperLib_Z::IntPoint &e1top, const ClipperLib_Z::IntPoint &e2bot,
const ClipperLib_Z::IntPoint &e2top, ClipperLib_Z::IntPoint &pt) { const ClipperLib_Z::IntPoint &e2top, ClipperLib_Z::IntPoint &pt) {
// The clipping contour may be simplified by clipping it with a bounding box of "subject" path.
// The clipping function used may produce self intersections outside of the "subject" bounding box. Such self intersections are
// harmless to the result of the clipping operation,
// Both ends of each edge belong to the same source: Either they are from subject or from clipping path.
assert(e1bot.z() >= 0 && e1top.z() >= 0);
assert(e2bot.z() >= 0 && e2top.z() >= 0);
assert((e1bot.z() == 0) == (e1top.z() == 0));
assert((e2bot.z() == 0) == (e2top.z() == 0));
// Start & end points of the clipped polyline (extrusion path with a non-zero width).
ClipperLib_Z::IntPoint start = e1bot; ClipperLib_Z::IntPoint start = e1bot;
ClipperLib_Z::IntPoint end = e1top; ClipperLib_Z::IntPoint end = e1top;
if (start.z() <= 0 && end.z() <= 0) { if (start.z() <= 0 && end.z() <= 0) {
start = e2bot; start = e2bot;
end = e2top; end = e2top;
} }
assert(start.z() > 0 && end.z() > 0); if (start.z() <= 0 && end.z() <= 0) {
// Self intersection on the source contour.
assert(start.z() == 0 && end.z() == 0);
pt.z() = 0;
} else {
// Interpolate extrusion line width.
assert(start.z() > 0 && end.z() > 0);
// Interpolate extrusion line width. double length_sqr = (end - start).cast<double>().squaredNorm();
double length_sqr = (end - start).cast<double>().squaredNorm(); double dist_sqr = (pt - start).cast<double>().squaredNorm();
double dist_sqr = (pt - start).cast<double>().squaredNorm(); double t = std::sqrt(dist_sqr / length_sqr);
double t = std::sqrt(dist_sqr / length_sqr);
pt.z() = start.z() + coord_t((end.z() - start.z()) * t); pt.z() = start.z() + coord_t((end.z() - start.z()) * t);
}
}); });
clipper.AddPath(subject, ClipperLib_Z::ptSubject, false); clipper.AddPath(subject, ClipperLib_Z::ptSubject, false);

File diff suppressed because it is too large Load Diff

View File

@ -450,6 +450,14 @@ struct PageBedShape: ConfigWizardPage
virtual void apply_custom_config(DynamicPrintConfig &config); virtual void apply_custom_config(DynamicPrintConfig &config);
}; };
struct PageBuildVolume : ConfigWizardPage
{
wxTextCtrl* build_volume;
PageBuildVolume(ConfigWizard* parent);
virtual void apply_custom_config(DynamicPrintConfig& config);
};
struct PageDiameters: ConfigWizardPage struct PageDiameters: ConfigWizardPage
{ {
wxTextCtrl *diam_nozzle; wxTextCtrl *diam_nozzle;
@ -584,6 +592,7 @@ struct ConfigWizard::priv
PageBedShape *page_bed = nullptr; PageBedShape *page_bed = nullptr;
PageDiameters *page_diams = nullptr; PageDiameters *page_diams = nullptr;
PageTemperatures *page_temps = nullptr; PageTemperatures *page_temps = nullptr;
PageBuildVolume* page_bvolume = nullptr;
// Pointers to all pages (regardless or whether currently part of the ConfigWizardIndex) // Pointers to all pages (regardless or whether currently part of the ConfigWizardIndex)
std::vector<ConfigWizardPage*> all_pages; std::vector<ConfigWizardPage*> all_pages;

View File

@ -1418,8 +1418,7 @@ void ColourPicker::sys_color_changed()
PointCtrl::~PointCtrl() PointCtrl::~PointCtrl()
{ {
if (sizer) { if (sizer && sizer->IsEmpty()) {
sizer->Clear();
delete sizer; delete sizer;
sizer = nullptr; sizer = nullptr;
} }

View File

@ -970,16 +970,19 @@ void MenuFactory::append_menu_item_edit_text(wxMenu *menu)
wxString name = _L("Edit text"); wxString name = _L("Edit text");
auto can_edit_text = []() { auto can_edit_text = []() {
const auto& sel = plater()->get_selection(); if (plater() != nullptr) {
if (sel.volumes_count() != 1) return false; const Selection& sel = plater()->get_selection();
auto cid = sel.get_volume(*sel.get_volume_idxs().begin()); if (sel.volumes_count() == 1) {
const ModelVolume* vol = plater()->canvas3D()->get_model() const GLVolume* gl_vol = sel.get_first_volume();
->objects[cid->object_idx()]->volumes[cid->volume_idx()]; const ModelVolume* vol = plater()->model().objects[gl_vol->object_idx()]->volumes[gl_vol->volume_idx()];
return vol->text_configuration.has_value(); return vol->text_configuration.has_value();
}
}
return false;
}; };
if (menu == &m_object_menu) { if (menu != &m_text_part_menu) {
auto menu_item_id = menu->FindItem(name); const int menu_item_id = menu->FindItem(name);
if (menu_item_id != wxNOT_FOUND) if (menu_item_id != wxNOT_FOUND)
menu->Destroy(menu_item_id); menu->Destroy(menu_item_id);
if (!can_edit_text()) if (!can_edit_text())