flow calibration first version

Port from SuperSlicer
This commit is contained in:
SoftFever 2022-12-26 18:35:04 +08:00
parent 53f3b8b009
commit 72f23ed5a8
40 changed files with 441 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,95 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Filament Flow Calibration</title>
</head>
<body>
<table width="100%">
<tbody>
<tr>
<td style="text-align: center;">
<h1>Filament Flow Calibration</h1>
</td>
</tr>
<tr>
<td style="text-align: right;"><strong>
<table><tr><td>Needs:</td>
<td style="text-align: left;">Bed Leveling</td></tr>
</table>
</strong>
</tr>
</tbody>
</table>
<p><strong>You need to do the bed level calibration before this one.</strong></p>
<p>This test will print five test samples with various level of flow. You can choose the flow difference between each steps. You should start with the 10% one.
After verifying the result with the help of the table below, you have to modify the filament extrusion multiplier in your filament preset (if the -20 is the best, change the multiplier from 1 to 0.8, see the formula below). Don't forget to save it afterwards! You can continue with the 2.5 step if you want a bit more precision.</p>
<h2>Results</h2>
<h4>Example:</h4>
<table width="100%">
<tbody>
<tr>
<td><img src="./m20.jpg" width="150" height="150" /></td>
<td><img src="./m10.jpg" width="150" height="150" /></td>
<td><img src="./0_v1.jpg" width="150" height="150" /></td>
<td><img src="./p10.jpg" width="150" height="150" /></td>
<td><img src="./p20.jpg" width="150" height="150" /></td>
</tr>
<tr>
<td style="text-align: center;">Not flat</td>
<td style="text-align: center;">Not flat</td>
<td style="text-align: center;">Not flat</td>
<td style="text-align: center;">Flat<br />but the circle<br />isn't that good</td>
<td style="text-align: center;">Flat surface<br />and good circle</td>
</tr>
</table>
<p>The flow you want to choose is the lowest that does not create gaps in the top surface. In this example it seems that the good flow is below +20. So you have to change your extrusion multiplier to 1.2 and print the second set of test (or put 1.15 and call it a day).</p>
<p>Don't look at the surface quality of the letter, it should be only good at the 0, as it's for this flow we calibrated the bed height. Here, going with +20% flow, you should lower the bed a bit (redoing the bed level calibration).</p>
<h4>Second step, starting from +20%:</h4>
<table>
<tbody>
<tr>
<td><img src="./m8.jpg" width="150" height="150" /></td>
<td><img src="./m6.jpg" width="150" height="150" /></td>
<td><img src="./m4.jpg" width="150" height="150" /></td>
<td><img src="./m2.jpg" width="150" height="150" /></td>
<td><img src="./0_v2.jpg" width="150" height="150" /></td>
</tr>
<tr>
<td style="text-align: center;">Not good</td>
<td style="text-align: center;">Not good</td>
<td style="text-align: center;">Almost good</td>
<td style="text-align: center;">Good but the<br />circle has some<br />irregularities</td>
<td style="text-align: center;">Good</td>
</tr>
</table>
<p>Here we can see the loop is not very good in the -8 and -6. The -4 is almost round but not quite, so it indicates that the nozzle has lost pressure. -2 is almost good but the 0 is the only one that can be considered as "good", and even so the loop isn't perfect. </p>
<h2>How to tune your printer</h2>
<p>You have to change the extrusion multiplier for the filament you calibrate for (and save it). Formula for the new extrusion multiplier: new_multiplier = ( (100 + chosen_number) / 100 ) * old_multiplier<br />
Example: first step, i choose the -10, so i have ((100-10)/100) * 1 = (0.9) * 1 = 0.9<br />
second step i choose +5, so i have ((100+5)/100) * 0.9 = (1.05) * 0.9 = 0.945
</p>
<p>If you want to make this change permanent and left your extrusion multiplier to 1 in Slic3r, you can change your firmware configuration by multiplying (or dividing, depends of the firmware/setting) the 'extruder speed setting' (e-step, step_distance) by this extrusion multiplier.</p>
<h2>Advice</h2>
<p>Before doing this test, it's preferable to calibrate your extruder (it's easier on bowden setup):</p>
<ul>
<li>Remove the extruder bowden tube from the output of the extruder (or remove the extruder assembly from the nozzle assembly if you have a direct-extruder)</li>
<li>Put the filament through it (by hand or using the software control)</li>
<li>Cut the filament flush with the output of the extruder. Measure with your spring-steel ruler that you measure just 0mm. If not, note the value and don't forget to remove it from every other measure you do.</li>
<li>Ask your extruder to extrude 200mm of filament (gcode: G1 E200).</li>
<li>Measure the length of the extruded filament. Repeat this process two times more if you want more precision.</li>
<li>You have to change your extruder multiplier (estep, step_distance) by multiplying (or dividing, depending on your firmware) the current value by (200 / average_measured_value).</li>
<p>Note that this value may change if you change the pressure the extruder exerts against the filament.</p>
</ul>
<h2>Notes</h2>
<p>It's very difficult to tune the flow below the 2% mark, and no filament is consistent enough to warrant it anyway. Filaments that have a guarantee of +-0.03mm has a ~7% variation between the low and high end cross section.</p>
<p>Most of the calibrations need to be done in the right order. This one should be second.</p>
<p>You may want to re-do the bed level calibration if the result is below 0.9 or higher than 1.1.</p>
<p>Note that the filament extrusion multiplier can change with a different filament material, as a softer one can be squished/dented more by the extruder and so have a lower diameter in the extruder gears.</p>
<p>If your printer extruder 'eats' the filament and can't complete the top layer, you will have to increase the ironing distribution (by 5% increments). (Expert setting, print -> infill)</p>
<p>This test sets the setting "Complete individual objects" to true, so you may want to reset your print settings afterwards</p>
<p>Licence for models used for this calibration test: CC BY-SA 3.0</p>
</body>
</html>

View file

@ -0,0 +1,92 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Calibration du d&eacute;bit du filament</title>
</head>
<body>
<table width="100%">
<tbody>
<tr>
<td style="text-align: center;">
<h1>Calibration du d&eacute;bit du filament</h1>
</td>
<td style="text-align: right;"><strong>
<table><tr><td>besoins:</td><td style="text-align: left;">Mise &agrave; niveau du plateau</td></tr>
</table>
</strong>
</tr>
</tbody>
</table>
<p><strong>Vous devez effectuer l'&eacute;talonnage du niveau du plateau avant celui-ci..</strong></p>
<p>Ce test imprimera cinq &eacute;chantillons de test avec diff&eacute;rents niveaux de d&eacute;bit. Vous pouvez choisir la diff&eacute;rence de d&eacute;bit entre chaque &eacute;tape. Vous devriez commencer par celui &agrave; 10%.
Apr&egrave;s avoir v&eacute;rifi&eacute; le r&eacute;sultat &agrave; l'aide du tableau ci-dessous, vous devez modifier le multiplicateur d'extrusion du filament dans votre r&eacute;glage de filament (si le -20 est le meilleur, changez le multiplicateur de 1 &agrave; 0,8, voir la formule ci-dessous). N'oubliez pas de le sauvegarder ensuite ! Vous pouvez continuer avec le pas de 2% si vous voulez un peu plus de pr&eacute;cision.</p>
<h2>R&eacute;sultats</h2>
<h4>Exemple:</h4>
<table width="100%">
<tbody>
<tr>
<td><img src="./m20.jpg" width="150" height="150" /></td>
<td><img src="./m10.jpg" width="150" height="150" /></td>
<td><img src="./0_v1.jpg" width="150" height="150" /></td>
<td><img src="./p10.jpg" width="150" height="150" /></td>
<td><img src="./p20.jpg" width="150" height="150" /></td>
</tr>
<tr>
<td style="text-align: center;">pas plat</td>
<td style="text-align: center;">pas plat</td>
<td style="text-align: center;">pas plat</td>
<td style="text-align: center;">plat<br />Mais le cercle<br />n'est pas si bon</td>
<td style="text-align: center;">Surface plane<br />et bon cercle</td>
</tr>
</table>
<p>Le d&eacute;bit que vous voulez choisir est le plus faible qui ne cr&eacute;e pas de trous dans la surface sup&eacute;rieure. Dans cet exemple, il semble que le bon d&eacute;bit soit inf&eacute;rieur &agrave; +20. Vous devez donc modifier votre multiplicateur d'extrusion &agrave; 1,2 et imprimer la deuxi&egrave;me s&eacute;rie de tests (ou mettre 1,15 et s'arr&ecirc;ter l&agrave;).</p>
<p>Ne regardez pas la qualit&eacute; de surface de la lettre, elle ne doit &ecirc;tre bonne qu'au 0, car c'est pour ce d&eacute;bit que nous avons calibr&eacute; la hauteur du plateau. Ici, en partant avec un d&eacute;bit de +20%, il faut baisser un peu le plateau (en refaisant la calibration du niveau du plateau).</p>
<h4>Deuxi&egrave;me &eacute;tape, &agrave; partir de +20%.:</h4>
<table>
<tbody>
<tr>
<td><img src="./m8.jpg" width="150" height="150" /></td>
<td><img src="./m6.jpg" width="150" height="150" /></td>
<td><img src="./m4.jpg" width="150" height="150" /></td>
<td><img src="./m2.jpg" width="150" height="150" /></td>
<td><img src="./0_v2.jpg" width="150" height="150" /></td>
</tr>
<tr>
<td style="text-align: center;">Pas bon</td>
<td style="text-align: center;">Pas bon</td>
<td style="text-align: center;">Presque bon</td>
<td style="text-align: center;">Bon<br />Mais le cercle<br />a quelques<br />irr&eacute;gularit&eacute;s</td>
<td style="text-align: center;">Bon</td>
</tr>
</table>
<p>Ici, nous pouvons voir que le cercle n'est pas tr&egrave;s bon dans les mod&egrave;les -8 et -6. Le -4 est presque rond mais pas tout &agrave; fait, il indique donc que la buse a perdu de la pression. Le -2 est presque bon mais le 0 est le seul qui peut &ecirc;tre consid&eacute;r&eacute; comme "bon", et m&ecirc;me ainsi le cercle n'est pas parfaite. </p>
<h2>Comment r&eacute;gler votre imprimante</h2>
<p>Vous devez modifier le multiplicateur d'extrusion pour le filament pour lequel vous calibrez (et le sauvegarder). Formule pour le nouveau multiplicateur d'extrusion : nouveau_multiplicateur = ( (100 + nombre_choisi) / 100 ) * ancien_multiplicateur<br />
Exemple : premi&egrave;re &eacute;tape, je choisis le -10, donc j'ai ((100-10)/100) * 1 = (0.9) * 1 = 0.9<br />
deuxi&egrave;me &eacute;tape, je choisis +5, donc j'ai ((100+5)/100) * 0.9 = (1.05) * 0.9 = 0.945
</p>
<p>Si vous voulez rendre ce changement permanent et laisser votre multiplicateur d'extrusion &agrave; 1 dans SuperSlicer, vous pouvez changer la configuration de votre firmware en multipliant (ou divisant, selon le firmware/r&eacute;glage) le 'r&eacute;glage de la vitesse de l'extrudeuse' (e-step, step_distance) par ce multiplicateur d'extrusion.</p>
<h2>Conseils</h2>
<p>Avant de faire ce test, il est pr&eacute;f&eacute;rable de calibrer votre extrudeuse (c'est plus facile sur une installation bowden) :</p>
<ul>
<li>Retirez le tube Bowden de l'extrudeuse de la sortie de l'extrudeuse (ou retirez l'ensemble de l'extrudeuse de l'ensemble de la buse si vous avez une extrudeuse directe).</li>
<li>Passez le filament &agrave; travers (&agrave; la main ou en utilisant le logiciel de contrôle).</li>
<li>Coupez le filament au ras de la sortie de l'extrudeuse. Mesurez avec votre r&egrave;gle en acier &agrave; ressort que vous ne mesurez que 0mm. Si ce n'est pas le cas, notez la valeur et n'oubliez pas de l'enlever de toutes vos autres mesures.</li>
<li>Demandez &agrave; votre extrudeuse d'extruder 200mm de filament (gcode : G1 E200).</li>
<li>Mesurez la longueur du filament extrud&eacute;. R&eacute;p&eacute;tez ce processus deux fois de plus si vous voulez plus de pr&eacute;cision.</li>
<li>Vous devez modifier le multiplicateur de votre extrudeuse (estep, step_distance) en multipliant (ou divisant, selon votre firmware) la valeur actuelle par (200 / average_measured_value).</li>
<p>Notez que cette valeur peut changer si vous modifiez la pression que l'extrudeuse exerce sur le filament.</p>
</ul>
<h2>Notes</h2>
<p>Il est tr&egrave;s difficile de r&eacute;gler le d&eacute;bit en dessous de la barre des 2%, et aucun filament n'est assez r&eacute;gulier pour le justifier de toute fa&ccedil;on. Les filaments qui ont une garantie de +-0.03mm ont une variation de ~7% entre la section transversale basse et haute.</p>
<p>La plupart des calibrations doivent &ecirc;tre effectu&eacute;es dans le bon ordre. Celui-ci devrait &ecirc;tre le deuxi&egrave;me.</p>
<p>Vous devrez peut-&ecirc;tre refaire l'&eacute;talonnage du niveau du plateau si le r&eacute;sultat est inf&eacute;rieur &agrave; 0,9 ou sup&eacute;rieur &agrave; 1,1..</p>
<p>Notez que le multiplicateur d'extrusion du filament peut changer avec un mat&eacute;riau de filament diff&eacute;rent, car un filament plus mou peut &ecirc;tre plus &eacute;cras&eacute;/marqu&eacute; par l'extrudeuse et donc avoir un diam&egrave;tre plus faible dans les engrenages de l'extrudeuse.</p>
<p>Si l'extrudeuse de votre imprimante "mange" le filament et ne peut pas terminer la couche sup&eacute;rieure, vous devrez augmenter la r&eacute;partition du repassage (par incr&eacute;ments de 5 %). (R&eacute;glage expert, impression -> repassage)</p>
<p>Ce test d&eacute;finit le param&egrave;tre "Compl&eacute;ter les objets individuels" &agrave; Vraie, donc vous pouvez vouloir r&eacute;initialiser vos param&egrave;tres d'impression par la suite.</p>
<p>Licence pour les mod&egrave;les utilis&eacute;s pour cet essai de calibration: CC BY-SA 3.0</p>
</body>
</html>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1228,7 +1228,7 @@ void PrintConfigDef::init_fff_params()
"Can't be zero");
def->sidetext = L("mm³/s");
def->min = 0;
def->max = 50;
def->max = 200;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats { 2. });

View file

@ -2466,6 +2466,12 @@ void MainFrame::init_menubar_as_editor()
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("PA - Bowden"), _L("Calibrate PA - Bowden"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_pa(true); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Flowrate - Pass 1"), _L("Flowrate - Pass 1"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Flowrate - Pass 2"), _L("Flowrate - Pass 2"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
#else
m_menubar->Append(fileMenu, wxString::Format("&%s", _L("File")));
if (editMenu)
@ -2485,6 +2491,12 @@ void MainFrame::init_menubar_as_editor()
append_menu_item(claib_menu, wxID_ANY, _L("PA - Bowden"), _L("Calibrate PA - Bowden"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_pa(true); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(claib_menu, wxID_ANY, _L("Flowrate - Pass 1"), _L("Flowrate - Pass 1"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(claib_menu, wxID_ANY, _L("Flowrate - Pass 2"), _L("Flowrate - Pass 2"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
m_menubar->Append(claib_menu,wxString::Format("&%s", _L("Calibration")));

View file

@ -7873,6 +7873,245 @@ void Plater::calib_pa(bool bowden) {
p->background_process.fff_print()->is_calib_mode() = bowden ? Calib_PA_Bowden : Calib_PA_DDE;
}
//
//void Plater::calib_flowrate(int pass) {
// if (pass != 1 && pass != 2)
// return;
// const auto calib_name = "Flowrate Test";
// new_project(false, false, calib_name);
// if (pass == 1) {
// std::vector<size_t> res = load_files(std::vector<std::string>{
// Slic3r::resources_dir() + "/calib/flowrate_0.stl",
// Slic3r::resources_dir() + "/calib/flowrate_5.stl",
// Slic3r::resources_dir() + "/calib/flowrate_15.stl",
// Slic3r::resources_dir() + "/calib/flowrate_20.stl",
// Slic3r::resources_dir() + "/calib/flowrate_m5.stl",
// Slic3r::resources_dir() + "/calib/flowrate_m10.stl",
// Slic3r::resources_dir() + "/calib/flowrate_m15.stl",
// Slic3r::resources_dir() + "/calib/flowrate_m20.stl"
// }, LoadStrategy::LoadModel | LoadStrategy::Silence);
// //add_model(false, Slic3r::resources_dir() + "/calib/flowrate_0.stl" );
// //add_model(false, Slic3r::resources_dir() + "/calib/flowrate_5.stl" );
// //add_model(false, Slic3r::resources_dir() + "/calib/flowrate_15.stl" );
// //add_model(false, Slic3r::resources_dir() + "/calib/flowrate_20.stl" );
// //add_model(false, Slic3r::resources_dir() + "/calib/flowrate_m5.stl" );
// //add_model(false, Slic3r::resources_dir() + "/calib/flowrate_m10.stl");
// //add_model(false, Slic3r::resources_dir() + "/calib/flowrate_m15.stl");
// //add_model(false, Slic3r::resources_dir() + "/calib/flowrate_m20.stl");
//
// }
// wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
// CallAfter([this] {this->arrange(); });
//
//
//}
ModelObject* Plater::add_part(ModelObject* model_object, std::string input_file, Vec3d move, Vec3d scale) {
Model model;
try {
model = Model::read_from_file(input_file);
}
catch (std::exception& e) {
auto msg = _L("Error!") + " " + input_file + " : " + e.what() + ".";
show_error(this, msg);
exit(1);
}
for (ModelObject* object : model.objects) {
Vec3d delta = Vec3d::Zero();
if (model_object->origin_translation != Vec3d::Zero())
{
object->center_around_origin();
delta = model_object->origin_translation - object->origin_translation;
}
for (ModelVolume* volume : object->volumes) {
volume->translate(delta + move);
if (scale != Vec3d{ 1,1,1 }) {
volume->scale(scale);
}
ModelVolume* new_volume = model_object->add_volume(*volume);
new_volume->set_type(ModelVolumeType::MODEL_PART);
new_volume->name = boost::filesystem::path(input_file).filename().string();
//volumes_info.push_back(std::make_pair(from_u8(new_volume->name), new_volume->get_mesh_errors_count() > 0));
// set a default extruder value, since user can't add it manually
// new_volume->config.set_key_value("extruder", new ConfigOptionInt(0));
// new_volume->config.set_key_value("first_layer_extruder", new ConfigOptionInt(0));
//move to bed
/* const TriangleMesh& hull = new_volume->get_convex_hull();
float min_z = std::numeric_limits<float>::max();
for (const stl_facet& facet : hull.stl.facet_start) {
for (int i = 0; i < 3; ++i)
min_z = std::min(min_z, Vec3f::UnitZ().dot(facet.vertex[i]));
}
volume->translate(Vec3d(0,0,-min_z));*/
}
}
assert(model.objects.size() == 1);
return model.objects.empty() ? nullptr : model.objects[0];
}
void Plater::calib_flowrate(int pass) {
if (pass != 1 && pass != 2)
return;
const auto calib_name = "Flowrate Test";
new_project(false, false, calib_name);
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
float start = 80.0f;
float delta = 10.f;
if (pass == 1) {
start = 80.0f;
delta = 10.0f;
}
else {
start = 92.0f;
delta = 2.0f;
}
std::vector<size_t> objs_idx = load_files(std::vector<std::string>{
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "filament_flow_test_cube.amf").string(),
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "filament_flow_test_cube.amf").string(),
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "filament_flow_test_cube.amf").string(),
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "filament_flow_test_cube.amf").string(),
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "filament_flow_test_cube.amf").string()}, LoadStrategy::LoadModel | LoadStrategy::Silence);
assert(objs_idx.size() == 5);
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
auto printerConfig = &wxGetApp().preset_bundle->printers.get_edited_preset().config;// get_tab(Preset::TYPE_PRINTER)->get_config();
/// --- scale ---
// model is created for a 0.4 nozzle, scale xy with nozzle size.
const ConfigOptionFloats* nozzle_diameter_config = printerConfig->option<ConfigOptionFloats>("nozzle_diameter");
assert(nozzle_diameter_config->values.size() > 0);
float nozzle_diameter = nozzle_diameter_config->values[0];
float xyScale = nozzle_diameter / 0.4;
//scale z to have 6 layers
double first_layer_height = print_config->option<ConfigOptionFloat>("initial_layer_print_height")->value;
double layer_height = nozzle_diameter / 2.;
first_layer_height = std::max(first_layer_height, nozzle_diameter / 2.);
float zscale = first_layer_height + 5 * layer_height;
//do scaling
if (xyScale < 0.9 || 1.2 < xyScale) {
for (size_t i = 0; i < 5; i++)
model().objects[objs_idx[i]]->scale(xyScale, xyScale, zscale); // base: 10 10 1
}
else {
for (size_t i = 0; i < 5; i++)
model().objects[objs_idx[i]]->scale(1, 1, zscale);
}
//add sub-part after scale
float zscale_number = (first_layer_height + layer_height) / 0.4;
/* zshift is calculated using the following:
(zscale / 2) represents the midpoint of the filament_flow_test_cube
((first_layer_height + layer_height) / 2) represents the midpoint of our indicator tab (it is scaled to be 2 layers tall)
The 0.3 constant is the same as the delta calculated in add_part below, this should probably be calculated per the model object
*/
float zshift = -(zscale / 2) + ((first_layer_height + layer_height) / 2) + 0.3;
if (pass == 1) {
add_part(model().objects[objs_idx[0]], (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "m20.amf").string(), Vec3d{ 10 * xyScale,0,zshift }, Vec3d{ xyScale , xyScale, zscale_number });
add_part(model().objects[objs_idx[1]], (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "m10.amf").string(), Vec3d{ 10 * xyScale,0,zshift }, Vec3d{ xyScale , xyScale, zscale_number });
add_part(model().objects[objs_idx[2]], (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "_0.amf").string(), Vec3d{ 10 * xyScale,0,zshift }, Vec3d{ xyScale , xyScale, zscale_number });
add_part(model().objects[objs_idx[3]], (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "p10.amf").string(), Vec3d{ 10 * xyScale,0,zshift }, Vec3d{ xyScale , xyScale, zscale_number });
add_part(model().objects[objs_idx[4]], (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "p20.amf").string(), Vec3d{ 10 * xyScale,0,zshift }, Vec3d{ xyScale , xyScale, zscale_number });
}
else if (pass == 2) {
add_part(model().objects[objs_idx[0]], (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "m8.amf").string(), Vec3d{ 10 * xyScale,0,zshift }, Vec3d{ xyScale , xyScale, zscale_number });
add_part(model().objects[objs_idx[1]], (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "m6.amf").string(), Vec3d{ 10 * xyScale,0,zshift }, Vec3d{ xyScale , xyScale, zscale_number });
add_part(model().objects[objs_idx[2]], (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "m4.amf").string(), Vec3d{ 10 * xyScale,0,zshift }, Vec3d{ xyScale , xyScale, zscale_number });
add_part(model().objects[objs_idx[3]], (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "m2.amf").string(), Vec3d{ 10 * xyScale,0,zshift }, Vec3d{ xyScale , xyScale, zscale_number });
add_part(model().objects[objs_idx[4]], (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "_0.amf").string(), Vec3d{ 10 * xyScale,0,zshift }, Vec3d{ xyScale , xyScale, zscale_number });
}
for (size_t i = 0; i < 5; i++) {
add_part(model().objects[objs_idx[i]], (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "O.amf").string(), Vec3d{ 0,0,zscale / 2.f + 0.5 }, Vec3d{ xyScale , xyScale, layer_height / 0.2 }); // base: 0.2mm height
}
/// --- translate ---;
bool has_to_arrange = false;
////const ConfigOptionFloat* extruder_clearance_radius = print_config->option<ConfigOptionFloat>("extruder_clearance_radius");
//float extruder_clearance_radius = 0.0f;
////const ConfigOptionPoints* bed_shape = printerConfig->option<ConfigOptionPoints>("printable_area");
//auto bed_area = printerConfig->option<ConfigOptionPoints>("printable_area")->values;
//const double brim_width = nozzle_diameter * 3.5;
//Vec2d bed_size = BoundingBoxf(bed_area).size();
//Vec2d bed_min = BoundingBoxf(bed_area).min;
//float offsetx = 3 + 20 * xyScale + extruder_clearance_radius + brim_width + (brim_width > extruder_clearance_radius ? brim_width - extruder_clearance_radius : 0);
//float offsety = 3 + 20 * xyScale + extruder_clearance_radius+ brim_width + (brim_width > extruder_clearance_radius ? brim_width - extruder_clearance_radius : 0);
//model().objects[objs_idx[0]]->translate({ bed_min.x() + bed_size.x() / 2 - offsetx / 2, bed_min.y() + bed_size.y() / 2 - offsety, zscale / 2 });
//model().objects[objs_idx[1]]->translate({ bed_min.x() + bed_size.x() / 2 - offsetx / 2, bed_min.y() + bed_size.y() / 2 , zscale / 2 });
//model().objects[objs_idx[2]]->translate({ bed_min.x() + bed_size.x() / 2 - offsetx / 2, bed_min.y() + bed_size.y() / 2 + offsety, zscale / 2 });
//model().objects[objs_idx[3]]->translate({ bed_min.x() + bed_size.x() / 2 + offsetx / 2, bed_min.y() + bed_size.y() / 2 - offsety, zscale / 2 });
//model().objects[objs_idx[4]]->translate({ bed_min.x() + bed_size.x() / 2 + offsetx / 2, bed_min.y() + bed_size.y() / 2 + offsety, zscale / 2 });
/// --- custom config ---
for (size_t i = 0; i < 5; i++) {
model().objects[objs_idx[i]]->config.set_key_value("wall_loops", new ConfigOptionInt(3));
model().objects[objs_idx[i]]->config.set_key_value("only_one_wall_top", new ConfigOptionBool(true));
model().objects[objs_idx[i]]->config.set_key_value("sparse_infill_density", new ConfigOptionPercent(40));
model().objects[objs_idx[i]]->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(3));
model().objects[objs_idx[i]]->config.set_key_value("top_shell_layers", new ConfigOptionInt(4));
model().objects[objs_idx[i]]->config.set_key_value("detect_thin_wall", new ConfigOptionBool(true));
model().objects[objs_idx[i]]->config.set_key_value("filter_out_gap_fill", new ConfigOptionFloat(0));
model().objects[objs_idx[i]]->config.set_key_value("layer_height", new ConfigOptionFloat(layer_height));
model().objects[objs_idx[i]]->config.set_key_value("initial_layer_height", new ConfigOptionFloat(first_layer_height));
model().objects[objs_idx[i]]->config.set_key_value("sparse_infill_pattern", new ConfigOptionEnum<InfillPattern>(ipRectilinear));
model().objects[objs_idx[i]]->config.set_key_value("top_surface_pattern", new ConfigOptionEnum<InfillPattern>(ipMonotonic));
//disable ironing post-process
model().objects[objs_idx[i]]->config.set_key_value("ironing_type", new ConfigOptionEnum<IroningType>(IroningType::NoIroning));
//set extrusion mult: 80 90 100 110 120
model().objects[objs_idx[i]]->config.set_key_value("print_flow_ratio", new ConfigOptionPercent(start + (float)i * delta));
}
//update plater
//GLCanvas3D::set_warning_freeze(false);
//wxGetApp().get_tab(Preset::TYPE_PRINT)->load_config(new_print_config);
//on_config_change(new_print_config);
changed_objects(objs_idx);
wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty();
//update everything, easier to code.
//ObjectList* obj = wxGetApp().obj_list();
//obj->update_after_undo_redo();
// automatic selection of added objects
if (!objs_idx.empty() && p->view3D != nullptr) {
// update printable state for new volumes on canvas3D
wxGetApp().plater()->canvas3D()->update_instance_printable_state_for_objects(objs_idx);
Selection& selection = p->view3D->get_canvas3d()->get_selection();
selection.clear();
for (size_t idx : objs_idx) {
selection.add_object((unsigned int)idx, false);
}
// BBS: update object list selection
p->sidebar->obj_list()->update_selections();
if (p->view3D->get_canvas3d()->get_gizmos_manager().is_enabled())
// this is required because the selected object changed and the flatten on face an sla support gizmos need to be updated accordingly
p->view3D->get_canvas3d()->update_gizmos_on_off_state();
}
// arrange if needed, after new settings, to take them into account
if (has_to_arrange) {
//update print config (done at reslice but we need it here)
if (printer_technology() == ptFFF)
fff_print().apply(model(), *config());
arrange();
}
//reslice();
//if (autocenter) {
// //re-enable auto-center after this calibration.
// wxGetApp().app_config->set("autocenter", "1");
//}
//
}
void Plater::import_sl1_archive()

View file

@ -227,6 +227,8 @@ public:
// SoftFever
void calib_pa(bool bowden = false);
void calib_flowrate(int pass);
ModelObject* add_part(ModelObject* model_object, std::string input_file, Vec3d move, Vec3d scale);
//BBS: add only gcode mode
bool only_gcode_mode() { return m_only_gcode; }