FIX: avoid collsion in by object mode

jira:STUDIO-11625

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: If5957a919af606934a34aa942f54dc4e7650a7f9
(cherry picked from commit 476c17819fe2e4fb7891b4b46865dde1a0057f33)
This commit is contained in:
xun.zhang
2025-05-07 21:40:30 +08:00
committed by Noisyfox
parent c027c00caa
commit ce81f03b6d
4 changed files with 119 additions and 18 deletions

View File

@@ -21,9 +21,10 @@ namespace Slic3r {
const Layer* curr_layer;
int picture_extruder_id; // the extruder id to take picture
int curr_extruder_id;
int height_to_rod;
bool based_on_all_layer; // whether to calculate the safe position based all layers
PrintSequence print_sequence; // print sequence: by layer or by object
std::optional<std::set<const PrintObject*>> printed_objects; // printed objects, only have value in by object mode
std::optional<std::vector<const PrintObject*>> printed_objects; // printed objects, only have value in by object mode
std::optional<int> liftable_extruder_id; // extruder id that can be lifted, cause bed height to change
std::optional<int> extruder_height_gap; // the height gap caused by extruder lift
};
@@ -47,22 +48,26 @@ namespace Slic3r {
ExPolygons collect_object_slices_data(const Layer* curr_layer, float height_range, const std::vector<const PrintObject*>& object_list);
Polygons collect_limit_areas_for_camera(const std::vector<const PrintObject*>& object_list);
Polygons collect_limit_areas_for_rod(const std::vector<const PrintObject*>& object_list, const PosPickCtx& ctx);
Polygon expand_object_projection(const Polygon& poly);
Point pick_nearest_object_center(const Point& curr_pos, const std::vector<const PrintObject*>& object_list);
Point get_objects_center(const std::vector<const PrintObject*>& object_list);
Polygon get_limit_area_for_camera(const PrintObject* obj);
std::vector<const PrintObject*> get_object_list(const std::optional<std::set<const PrintObject*>>& printed_objects);
std::vector<const PrintObject*> get_object_list(const std::optional<std::vector<const PrintObject*>>& printed_objects);
double get_raft_height(const PrintObject* obj);
BoundingBoxf3 get_real_instance_bbox(const PrintInstance& instance);
Point get_object_center(const PrintObject* obj);
private:
const Print* print{ nullptr };
std::vector<ExPolygons> m_extruder_printable_area;
Polygon m_bed_polygon;
Point m_plate_offset;
std::vector<ExPolygons> m_extruder_printable_area; //scaled data
Polygon m_bed_polygon; //scaled_data
Point m_plate_offset; // unscaled data
int m_plate_height; // unscaled data
int m_plate_width; // unscaled data
std::unordered_map<const PrintInstance*, BoundingBoxf3> bbox_cache;