diff --git a/xs/src/libslic3r/Format/AMF.cpp b/xs/src/libslic3r/Format/AMF.cpp index 2b7cc5c74..41e6941ee 100644 --- a/xs/src/libslic3r/Format/AMF.cpp +++ b/xs/src/libslic3r/Format/AMF.cpp @@ -578,7 +578,28 @@ void AMFParserContext::endElement(const char * /* name */) p = end + 1; } m_object->layer_height_profile_valid = true; - } else if (m_path.size() == 5 && m_path[3] == NODE_TYPE_VOLUME && m_volume) { + } + else if (m_path.size() == 3 && m_path[1] == NODE_TYPE_OBJECT && m_object && strcmp(opt_key, "sla_support_points") == 0) { + // Parse object's layer height profile, a semicolon separated list of floats. + unsigned char coord_idx = 0; + Vec3f point(Vec3f::Zero()); + char *p = const_cast(m_value[1].c_str()); + for (;;) { + char *end = strchr(p, ';'); + if (end != nullptr) + *end = 0; + + point(coord_idx) = atof(p); + if (++coord_idx == 3) { + m_object->sla_support_points.push_back(point); + coord_idx = 0; + } + if (end == nullptr) + break; + p = end + 1; + } + } + else if (m_path.size() == 5 && m_path[3] == NODE_TYPE_VOLUME && m_volume) { if (strcmp(opt_key, "modifier") == 0) { // Is this volume a modifier volume? // "modifier" flag comes first in the XML file, so it may be later overwritten by the "type" flag. @@ -609,7 +630,6 @@ void AMFParserContext::endElement(const char * /* name */) default: break; } - m_path.pop_back(); } @@ -878,6 +898,19 @@ bool store_amf(const char *path, Model *model, Print* print, bool export_print_c stream << "\n \n"; } //FIXME Store the layer height ranges (ModelObject::layer_height_ranges) + + const std::vector& sla_support_points = object->sla_support_points; + if (!sla_support_points.empty()) { + // Store the SLA supports as a single semicolon separated list. + stream << " "; + for (size_t i = 0; i < sla_support_points.size(); ++i) { + if (i != 0) + stream << ";"; + stream << sla_support_points[i](0) << ";" << sla_support_points[i](1) << ";" << sla_support_points[i](2); + } + stream << "\n \n"; + } + stream << " \n"; stream << " \n"; std::vector vertices_offsets; diff --git a/xs/src/libslic3r/Model.cpp b/xs/src/libslic3r/Model.cpp index 23c1853b8..a6fc603f7 100644 --- a/xs/src/libslic3r/Model.cpp +++ b/xs/src/libslic3r/Model.cpp @@ -498,6 +498,7 @@ ModelObject::ModelObject(Model *model, const ModelObject &other, bool copy_volum instances(), volumes(), config(other.config), + sla_support_points(other.sla_support_points), layer_height_ranges(other.layer_height_ranges), layer_height_profile(other.layer_height_profile), layer_height_profile_valid(other.layer_height_profile_valid), diff --git a/xs/src/slic3r/GUI/GLCanvas3D.hpp b/xs/src/slic3r/GUI/GLCanvas3D.hpp index cc7656106..7d9b830ca 100644 --- a/xs/src/slic3r/GUI/GLCanvas3D.hpp +++ b/xs/src/slic3r/GUI/GLCanvas3D.hpp @@ -724,7 +724,6 @@ private: void _render_bed(float theta) const; void _render_axes(bool depth_test) const; void _render_objects() const; - void _render_sla_support_points() const; void _render_cutting_plane() const; void _render_warning_texture() const; void _render_legend_texture() const; diff --git a/xs/src/slic3r/GUI/GLGizmo.cpp b/xs/src/slic3r/GUI/GLGizmo.cpp index 5aa9472b0..a24b11dcf 100644 --- a/xs/src/slic3r/GUI/GLGizmo.cpp +++ b/xs/src/slic3r/GUI/GLGizmo.cpp @@ -1734,7 +1734,6 @@ void GLGizmoSlaSupports::update_mesh() const float* first_vertex = m_model_object->volumes.front()->get_convex_hull().first_vertex(); m_source_data.mesh_first_point = Vec3d((double)first_vertex[0], (double)first_vertex[1], (double)first_vertex[2]); - // we'll now reload Grabbers (selection might have changed): m_grabbers.clear(); for (const Vec3f& point : m_model_object->sla_support_points) {