This commit is contained in:
enricoturri1966 2023-03-15 09:44:31 +01:00
commit e7f1130ece
9 changed files with 641 additions and 586 deletions

View File

@ -16,6 +16,7 @@
#include "FillLightning.hpp"
#include "FillConcentric.hpp"
#include "FillEnsuring.hpp"
#include "Polygon.hpp"
namespace Slic3r {
@ -486,14 +487,6 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive:
size_t first_object_layer_id = this->object()->get_layer(0)->id();
for (SurfaceFill &surface_fill : surface_fills) {
//skip patterns for which additional input is nullptr
switch (surface_fill.params.pattern) {
case ipLightning: if (lightning_generator == nullptr) continue; break;
case ipAdaptiveCubic: if (adaptive_fill_octree == nullptr) continue; break;
case ipSupportCubic: if (support_fill_octree == nullptr) continue; break;
default: break;
}
// Create the filler object.
std::unique_ptr<Fill> f = std::unique_ptr<Fill>(Fill::new_from_type(surface_fill.params.pattern));
f->set_bounding_box(bbox);
@ -647,7 +640,7 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive:
#endif
}
Polylines Layer::generate_sparse_infill_polylines_for_anchoring() const
Polylines Layer::generate_sparse_infill_polylines_for_anchoring(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive::Octree* support_fill_octree, FillLightning::Generator* lightning_generator) const
{
std::vector<SurfaceFill> surface_fills = group_fills(*this);
const Slic3r::BoundingBox bbox = this->object()->bounding_box();
@ -656,14 +649,17 @@ Polylines Layer::generate_sparse_infill_polylines_for_anchoring() const
Polylines sparse_infill_polylines{};
for (SurfaceFill &surface_fill : surface_fills) {
// skip patterns for which additional input is nullptr
if (surface_fill.surface.surface_type != stInternal) {
continue;
}
switch (surface_fill.params.pattern) {
case ipLightning: continue; break;
case ipAdaptiveCubic: continue; break;
case ipSupportCubic: continue; break;
case ipCount: continue; break;
case ipSupportBase: continue; break;
case ipEnsuring: continue; break;
case ipLightning:
case ipAdaptiveCubic:
case ipSupportCubic:
case ipRectilinear:
case ipMonotonic:
case ipMonotonicLines:
@ -688,10 +684,16 @@ Polylines Layer::generate_sparse_infill_polylines_for_anchoring() const
f->layer_id = this->id();
f->z = this->print_z;
f->angle = surface_fill.params.angle;
// f->adapt_fill_octree = (surface_fill.params.pattern == ipSupportCubic) ? support_fill_octree : adaptive_fill_octree;
f->adapt_fill_octree = (surface_fill.params.pattern == ipSupportCubic) ? support_fill_octree : adaptive_fill_octree;
f->print_config = &this->object()->print()->config();
f->print_object_config = &this->object()->config();
if (surface_fill.params.pattern == ipLightning) {
auto *lf = dynamic_cast<FillLightning::Filler *>(f.get());
lf->generator = lightning_generator;
lf->num_raft_layers = this->object()->slicing_parameters().raft_layers();
}
// calculate flow spacing for infill pattern generation
double link_max_length = 0.;
if (!surface_fill.params.bridge) {

View File

@ -368,8 +368,12 @@ public:
void make_perimeters();
// Phony version of make_fills() without parameters for Perl integration only.
void make_fills() { this->make_fills(nullptr, nullptr, nullptr); }
void make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive::Octree* support_fill_octree, FillLightning::Generator* lightning_generator);
Polylines generate_sparse_infill_polylines_for_anchoring() const;
void make_fills(FillAdaptive::Octree *adaptive_fill_octree,
FillAdaptive::Octree *support_fill_octree,
FillLightning::Generator *lightning_generator);
Polylines generate_sparse_infill_polylines_for_anchoring(FillAdaptive::Octree *adaptive_fill_octree,
FillAdaptive::Octree *support_fill_octree,
FillLightning::Generator* lightning_generator) const;
void make_ironing();
void export_region_slices_to_svg(const char *path) const;

View File

@ -378,7 +378,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly
const double custom_angle = this->region().config().bridge_angle.value;
const auto params = Algorithm::RegionExpansionParameters::build(expansion_bottom_bridge, expansion_step, max_nr_expansion_steps);
bridges.surfaces = custom_angle > 0 ?
expand_merge_surfaces(m_fill_surfaces.surfaces, stBottomBridge, shells, params, custom_angle) :
expand_merge_surfaces(m_fill_surfaces.surfaces, stBottomBridge, shells, params, Geometry::deg2rad(custom_angle)) :
expand_bridges_detect_orientations(m_fill_surfaces.surfaces, shells, params);
BOOST_LOG_TRIVIAL(trace) << "Processing external surface, detecting bridges - done";
#if 0

View File

@ -1177,7 +1177,7 @@ void Print::alert_when_supports_needed()
case SupportSpotsGenerator::SupportPointCause::WeakObjectPart: message = L("thin fragile section"); break;
}
return (critical ? "!" : "") + message;
return message;
};
// vector of pairs of object and its issues, where each issue is a pair of type and critical flag

View File

@ -1,6 +1,8 @@
#ifndef slic3r_Print_hpp_
#define slic3r_Print_hpp_
#include "Fill/FillAdaptive.hpp"
#include "Fill/FillLightning.hpp"
#include "PrintBase.hpp"
#include "BoundingBox.hpp"
@ -385,7 +387,8 @@ private:
void discover_horizontal_shells();
void combine_infill();
void _generate_support_material();
std::pair<FillAdaptive::OctreePtr, FillAdaptive::OctreePtr> prepare_adaptive_infill_data();
std::pair<FillAdaptive::OctreePtr, FillAdaptive::OctreePtr> prepare_adaptive_infill_data(
const std::vector<std::pair<const Surface*, float>>& surfaces_w_bottom_z) const;
FillLightning::GeneratorPtr prepare_lightning_infill_data();
// XYZ in scaled coordinates
@ -410,6 +413,9 @@ private:
// this is set to true when LayerRegion->slices is split in top/internal/bottom
// so that next call to make_perimeters() performs a union() before computing loops
bool m_typed_slices = false;
std::pair<FillAdaptive::OctreePtr, FillAdaptive::OctreePtr> m_adaptive_fill_octrees;
FillLightning::GeneratorPtr m_lightning_generator;
};
struct WipeTowerData

File diff suppressed because it is too large Load Diff

View File

@ -1451,7 +1451,7 @@ static void generate_initial_areas(
// As a circle is round this length is identical for every axis as long as the 90 degrees angle between both remains.
const coord_t circle_length_to_half_linewidth_change = config.min_radius < config.support_line_width ?
config.min_radius / 2 :
sqrt(sqr(config.min_radius) - sqr(config.min_radius - config.support_line_width / 2));
scale_(sqrt(sqr(unscale<double>(config.min_radius)) - sqr(unscale<double>(config.min_radius - config.support_line_width / 2))));
// Extra support offset to compensate for larger tip radiis. Also outset a bit more when z overwrites xy, because supporting something with a part of a support line is better than not supporting it at all.
//FIXME Vojtech: This is not sufficient for support enforcers to work.
//FIXME There is no account for the support overhang angle.

View File

@ -34,6 +34,10 @@
// #define SLIC3R_DEBUG_SLICE_PROCESSING
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
#define DEBUG_INTERSECTIONLINE
#endif
#if defined(SLIC3R_DEBUG) || defined(SLIC3R_DEBUG_SLICE_PROCESSING)
#include "SVG.hpp"
#endif
@ -125,7 +129,7 @@ public:
};
uint32_t flags { 0 };
#if DEBUG_INTERSECTIONLINE
#ifdef DEBUG_INTERSECTIONLINE
enum class Source {
BottomPlane,
TopPlane,
@ -1446,19 +1450,19 @@ static std::vector<Polygons> make_slab_loops(
for (const IntersectionLine &l : lines.at_slice[slice_below])
if (l.edge_type != IntersectionLine::FacetEdgeType::Top) {
in.emplace_back(l);
#if DEBUG_INTERSECTIONLINE
#ifdef DEBUG_INTERSECTIONLINE
in.back().source = IntersectionLine::Source::BottomPlane;
#endif // DEBUG_INTERSECTIONLINE
}
}
{
// Edges in between slice_below and slice_above.
#if DEBUG_INTERSECTIONLINE
#ifdef DEBUG_INTERSECTIONLINE
size_t old_size = in.size();
#endif // DEBUG_INTERSECTIONLINE
// Edge IDs of end points on in-between lines that touch the layer above are already increased with num_edges.
append(in, lines.between_slices[line_idx]);
#if DEBUG_INTERSECTIONLINE
#ifdef DEBUG_INTERSECTIONLINE
for (auto it = in.begin() + old_size; it != in.end(); ++ it) {
assert(it->edge_type == IntersectionLine::FacetEdgeType::Slab);
it->source = IntersectionLine::Source::Slab;
@ -1476,7 +1480,7 @@ static std::vector<Polygons> make_slab_loops(
l.edge_a_id += num_edges;
if (l.edge_b_id >= 0)
l.edge_b_id += num_edges;
#if DEBUG_INTERSECTIONLINE
#ifdef DEBUG_INTERSECTIONLINE
l.source = IntersectionLine::Source::TopPlane;
#endif // DEBUG_INTERSECTIONLINE
}

View File

@ -799,7 +799,7 @@ void GLGizmoCut3D::render_cut_plane_grabbers()
void GLGizmoCut3D::render_cut_line()
{
if (!cut_line_processing() || m_line_end == Vec3d::Zero())
if (!cut_line_processing() || m_line_end.isApprox(Vec3d::Zero()))
return;
glsafe(::glEnable(GL_DEPTH_TEST));
@ -1130,7 +1130,7 @@ void GLGizmoCut3D::dragging_grabber_xy(const GLGizmoBase::UpdateData &data)
rotation[m_hover_id] = theta;
const Transform3d rotation_tmp = m_start_dragging_m * rotation_transform(rotation);
const bool update_tbb = m_rotation_m.rotation() != rotation_tmp.rotation();
const bool update_tbb = !m_rotation_m.rotation().isApprox(rotation_tmp.rotation());
m_rotation_m = rotation_tmp;
if (update_tbb)
m_transformed_bounding_box = transformed_bounding_box(m_plane_center, m_rotation_m);
@ -1262,7 +1262,7 @@ void GLGizmoCut3D::update_bb()
const BoundingBoxf3 box = bounding_box();
if (!box.defined)
return;
if (m_max_pos != box.max || m_min_pos != box.min) {
if (!m_max_pos.isApprox(box.max) || !m_min_pos.isApprox(box.min)) {
m_bounding_box = box;
@ -1679,7 +1679,7 @@ void GLGizmoCut3D::render_cut_plane_input_window(CutConnectors &connectors)
const bool has_connectors = !connectors.empty();
const bool is_cut_plane_init = m_rotation_m.isApprox(Transform3d::Identity()) && m_bb_center == m_plane_center;
const bool is_cut_plane_init = m_rotation_m.isApprox(Transform3d::Identity()) && m_bb_center.isApprox(m_plane_center);
m_imgui->disabled_begin(is_cut_plane_init);
wxString act_name = _L("Reset cutting plane");
if (render_reset_button("cut_plane", into_u8(act_name))) {
@ -2247,7 +2247,7 @@ void GLGizmoCut3D::update_connector_shape()
bool GLGizmoCut3D::cut_line_processing() const
{
return m_line_beg != Vec3d::Zero();
return !m_line_beg.isApprox(Vec3d::Zero());
}
void GLGizmoCut3D::discard_cut_line_processing()