diff --git a/src/libslic3r/SLA/SLASupportTree.cpp b/src/libslic3r/SLA/SLASupportTree.cpp index 1d88e886f..ae75478e1 100644 --- a/src/libslic3r/SLA/SLASupportTree.cpp +++ b/src/libslic3r/SLA/SLASupportTree.cpp @@ -587,6 +587,23 @@ EigenMesh3D to_eigenmesh(const TriangleMesh& tmesh) { EigenMesh3D to_eigenmesh(const ModelObject& modelobj) { auto&& rmesh = modelobj.raw_mesh(); + + // we need to transform the raw mesh... + // currently all the instances share the same x and y rotation and scaling + // so we have to extract those from e.g. the first instance and apply to the + // raw mesh. This is also true for the support points. + // BUT: when the support structure is spawned for each instance than it has + // to omit the X, Y rotation and scaling as those have been already applied + // or apply an inverse transformation on the support structure after it + // has been created. + +// auto rot = modelobj.instances.front()->get_rotation(); +// auto scaling = modelobj.instances.front()->get_scaling_factor(); + +// rmesh.rotate(float(rot(X)), Axis::X); +// rmesh.rotate(float(rot(Y)), Axis::Y); +// rmesh.scale(scaling); + auto&& ret = to_eigenmesh(rmesh); auto&& bb = rmesh.bounding_box(); ret.ground_level = bb.min(Z); @@ -635,9 +652,18 @@ PointSet support_points(const Model& model) { PointSet support_points(const ModelObject& modelobject) { PointSet ret(modelobject.sla_support_points.size(), 3); + auto rot = modelobject.instances.front()->get_rotation(); +// auto scaling = modelobject.instances.front()->get_scaling_factor(); + +// Transform3d tr; +// tr.rotate(Eigen::AngleAxisd(rot(X), Vec3d::UnitX()) * +// Eigen::AngleAxisd(rot(Y), Vec3d::UnitY())); + long i = 0; for(const Vec3f& msource : modelobject.sla_support_points) { - ret.row(i++) = msource.cast(); + Vec3d&& p = msource.cast(); +// p = tr * p; + ret.row(i++) = p; } return ret; } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 4154ef4d0..cd045d1a5 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1875,21 +1875,13 @@ void Plater::priv::on_process_completed(wxCommandEvent &evt) case ptSLA: // Update the SLAPrint from the current Model, so that the reload_scene() // pulls the correct data. + + // FIXME: SLAPrint::apply is not ready for this. At this stage it would + // invalidate the previous result and the supports would not be available + // for rendering. // if (this->update_background_process() & UPDATE_BACKGROUND_PROCESS_RESTART) // this->schedule_background_process(); - { -// for(SLAPrintObject * po: sla_print.objects()) { -// TriangleMesh&& suppmesh = po->support_mesh(); -// if(suppmesh.facets_count() > 0) { -// ModelObject* mo = model.add_object(); -// for(const SLAPrintObject::Instance& inst : po->instances() ) { -// mo->add_instance(*(mo->instances[inst.instance_id.id])); -// mo->add_volume(suppmesh); -// } -// } -// } - } _3DScene::reload_scene(canvas3D, true); break; }