Merge branch 'dev'

This commit is contained in:
supermerill 2020-08-11 15:56:54 +02:00
commit 2e5f70bb5f
23 changed files with 11798 additions and 70 deletions

View File

@ -415,7 +415,7 @@ set(L10N_DIR "${SLIC3R_RESOURCES_DIR}/localization")
add_custom_target(gettext_make_pot
COMMAND xgettext --keyword=L --keyword=_L --keyword=_u8L --keyword=L_CONTEXT:1,2c --keyword=_L_PLURAL:1,2 --add-comments=TRN --from-code=UTF-8 --debug
-f "${L10N_DIR}/list.txt"
-o "${L10N_DIR}/SupserSlicer.pot"
-o "${L10N_DIR}/SuperSlicer.pot"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Generate pot file from strings in the source tree"
)

View File

@ -0,0 +1,57 @@
# How to create / update your own language
## 1) initialisation
open the settings.ini
for each file that can contains useful translation, create / edit a "data" line to point to the said file.
The 'input' property must be the SuperSlicer.pot path
The 'output' must be the SuperSlicer.po
The 'todo' contains the path of the po file to complete.
note that the first data line has the priority over the other ones (the first translation encountered is the one used)
In this exemple, we are going to update the spanish translation.
We are going to use the old slic3++ translation and the prusa one.
So the settings.ini contains these lines :
```
data = es/Slic3r++.po
data = es/PrusaSlicer_es.po
input = SuperSlicer.pot
todo = es/todo.po
output = es/SuperSlicer.po
```
## 2) launch the utility.
* Open a console
* cd into the localization directory,
* execute 'java -jar pomergeur.jar'
It will tell you if you made some mistakes about the paths, the number of translations reused and the number to do.
## 3) complete the translation file
Then, you have to open the es/toto.po file and complete all the translation.
* msgid lines are the english string
* msgstr is the translated one, should be empty string ("").
Important:
* you must write it in one line, use \n to input a line change.
* the %1, %2, ... MUST be put also in the translation, as it's a placeholder for input numbers, if one is missed the software will crash, so be careful. '%%' means '%'.
## 4) relaunch the utility
You can copy/save the todo.po in an other file in case of.
After filling the todo file, change the settings.ini:
```
data = es/todo.po
data = es/SuperSlicer.po
data = es/Slic3r++.po
data = es/PrusaSlicer_es.po
input = SuperSlicer.pot
todo = es/todo.po
output = es/SuperSlicer.po
```
And re-launch the utility.
Repeat (if needed) until you have almost nothing left in your todo.po file (one-letter translation like "." are not copied by the utility)

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,9 @@
data = C:/local/Slic3rcpp/resources/localization/fr/SuperSlicer.po
data = C:/local/Slic3rcpp/resources/localization/PrusaSlicer.pot
data = C:/local/Slic3rcpp/resources/localization/TODO.po
#data = C:/local/Slic3r/resources/localization/lang/TODO.po
#data = C:/local/Slic3r/resources/localization/lang/SuperSlicer.po
data = C:/local/Slic3r/resources/localization/lang/Slic3r++.po
data = C:/local/Slic3r/resources/localization/lang/PrusaSlicer_fr.po
input = C:/local/Slic3rcpp/resources/localization/SuperSlicer_en_US.po
todo = C:/local/Slic3rcpp/resources/localization/TODO.po
output = C:/local/Slic3rcpp/resources/localization/SuperSlicer.po
input = C:/local/Slic3r/resources/localization/SuperSlicer.pot
todo = C:/local/Slic3r/resources/localization/lang/TODO.po
output = C:/local/Slic3r/resources/localization/lang/SuperSlicer.po

View File

@ -16,8 +16,10 @@ group:Retraction
setting:idx:retract_lift_below
setting:idx:retract_lift_not_last_layer
end_line
setting:idx:retract_speed
setting:idx:deretract_speed
line:"Retraction Speed"
setting:idx:retract_speed
setting:idx:label$Deretraction:deretract_speed
end_line
setting:idx:retract_restart_extra
setting:idx:retract_before_travel
setting:idx:retract_layer_change

View File

@ -232,6 +232,7 @@ group:Extrusion width
setting:solid_infill_extrusion_width
setting:top_infill_extrusion_width
setting:support_material_extrusion_width
setting:skirt_extrusion_width
group:Overlap
line:Perimeter overlap
setting:label$External:external_perimeter_overlap

View File

@ -20,6 +20,7 @@ group:Advanced
setting:use_relative_e_distances
setting:use_firmware_retraction
setting:use_volumetric_e
setting:min_length
setting:variable_layer_height
page:Custom G-code:cog

View File

@ -845,6 +845,7 @@ namespace DoExport {
if (config.gcode_flavor.value == gcfMarlin || config.gcode_flavor.value == gcfLerdge) {
normal_time_estimator.set_max_acceleration((float)config.machine_max_acceleration_extruding.values[0]);
normal_time_estimator.set_retract_acceleration((float)config.machine_max_acceleration_retracting.values[0]);
normal_time_estimator.set_max_travel_acceleration((float)config.machine_max_acceleration_travel.values[0]);
normal_time_estimator.set_minimum_feedrate((float)config.machine_min_extruding_rate.values[0]);
normal_time_estimator.set_minimum_travel_feedrate((float)config.machine_min_travel_rate.values[0]);
normal_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::X, (float)config.machine_max_acceleration_x.values[0]);
@ -1757,11 +1758,11 @@ void GCode::print_machine_envelope(FILE *file, Print &print)
fprintf(file, "M204 P%d R%d T%d ; sets acceleration (P, T) and retract acceleration (R), mm/sec^2\n",
int(print.config().machine_max_acceleration_extruding.values.front() + 0.5),
int(print.config().machine_max_acceleration_retracting.values.front() + 0.5),
int(print.config().machine_max_acceleration_extruding.values.front() + 0.5));
int(print.config().machine_max_acceleration_travel.values.front() + 0.5));
if (std::set<uint8_t>{gcfRepRap, gcfKlipper}.count(print.config().gcode_flavor.value) > 0)
fprintf(file, "M204 P%d T%d ; sets acceleration (P, T) and retract acceleration (R), mm/sec^2\n",
fprintf(file, "M204 P%d T%d ; sets acceleration (P, T), mm/sec^2\n",
int(print.config().machine_max_acceleration_extruding.values.front() + 0.5),
int(print.config().machine_max_acceleration_retracting.values.front() + 0.5));
int(print.config().machine_max_acceleration_travel.values.front() + 0.5));
if (std::set<uint8_t>{gcfRepRap}.count(print.config().gcode_flavor.value) > 0)
fprintf(file, "M566 X%.2lf Y%.2lf Z%.2lf E%.2lf ; sets the jerk limits, mm/sec\n",
print.config().machine_max_jerk_x.values.front(),
@ -2133,10 +2134,12 @@ void GCode::process_layer(
std::string gcode;
// Set new layer - this will change Z and force a retraction if retract_layer_change is enabled.
coordf_t previous_print_z = m_layer != nullptr ? m_layer->print_z : 0;
if (! print.config().before_layer_gcode.value.empty()) {
DynamicConfig config;
config.set_key_value("previous_layer_z", new ConfigOptionFloat(previous_print_z));
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index + 1));
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
gcode += this->placeholder_parser_process("before_layer_gcode",
print.config().before_layer_gcode.value, m_writer.tool()->id(), &config)
+ "\n";
@ -2145,6 +2148,7 @@ void GCode::process_layer(
m_layer = &layer;
if (! print.config().layer_gcode.value.empty()) {
DynamicConfig config;
config.set_key_value("previous_layer_z", new ConfigOptionFloat(previous_print_z));
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index));
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
gcode += this->placeholder_parser_process("layer_gcode",
@ -2515,6 +2519,7 @@ void GCode::process_layer(
config.set_key_value("previous_extruder", new ConfigOptionInt((int)current_extruder_filament));
config.set_key_value("next_extruder", new ConfigOptionInt((int)milling_extruder_id));
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index));
config.set_key_value("previous_layer_z", new ConfigOptionFloat(previous_print_z));
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
// Process the start_mill_gcode for the new filament.
gcode += this->placeholder_parser_process("milling_toolchange_start_gcode", start_mill_gcode, current_extruder_filament, &config);
@ -2546,6 +2551,7 @@ void GCode::process_layer(
config.set_key_value("previous_extruder", new ConfigOptionInt((int)milling_extruder_id));
config.set_key_value("next_extruder", new ConfigOptionInt((int)current_extruder_filament));
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index));
config.set_key_value("previous_layer_z", new ConfigOptionFloat(previous_print_z));
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
// Process the end_mill_gcode for the new filament.
gcode += this->placeholder_parser_process("milling_toolchange_start_gcode", end_mill_gcode, current_extruder_filament, &config);
@ -3030,7 +3036,7 @@ std::string GCode::extrude_loop_vase(const ExtrusionLoop &original_loop, const s
}
// reset acceleration
gcode += m_writer.set_acceleration((unsigned int)(m_config.default_acceleration.value + 0.5));
m_writer.set_acceleration((unsigned int)(m_config.default_acceleration.value + 0.5));
//don't wipe here
//if (m_wipe.enable)
@ -3374,7 +3380,7 @@ std::string GCode::extrude_loop(const ExtrusionLoop &original_loop, const std::s
}
// reset acceleration
gcode += m_writer.set_acceleration((unsigned int)(m_config.default_acceleration.value + 0.5));
m_writer.set_acceleration((unsigned int)(m_config.default_acceleration.value + 0.5));
if (m_wipe.enable)
m_wipe.path = paths.front().polyline; // TODO: don't limit wipe to last path
@ -3474,7 +3480,7 @@ std::string GCode::extrude_multi_path(const ExtrusionMultiPath &multipath, const
m_wipe.path.reverse();
}
// reset acceleration
gcode += m_writer.set_acceleration((unsigned int)floor(m_config.default_acceleration.value + 0.5));
m_writer.set_acceleration((unsigned int)floor(m_config.default_acceleration.value + 0.5));
return gcode;
}
@ -3511,7 +3517,7 @@ std::string GCode::extrude_multi_path3D(const ExtrusionMultiPath3D &multipath3D,
m_wipe.path.reverse();
}
// reset acceleration
gcode += m_writer.set_acceleration((unsigned int)floor(m_config.default_acceleration.value + 0.5));
m_writer.set_acceleration((unsigned int)floor(m_config.default_acceleration.value + 0.5));
return gcode;
}
@ -3538,25 +3544,73 @@ void GCode::use(const ExtrusionEntityCollection &collection) {
}
}
std::string extrusion_role_2_string(const ExtrusionRole &er) {
switch (er) {
case erNone: return " none";
case erPerimeter: return " perimeter";
case erExternalPerimeter: return " external_perimeter";
case erOverhangPerimeter: return " overhang_perimeter";
case erInternalInfill: return " internal_infill";
case erSolidInfill: return " solid_infill";
case erTopSolidInfill: return " top_solid_infill";
case erBridgeInfill: return " bridge_infill";
case erThinWall: return " thin_wall";
case erGapFill: return " gap_fill";
case erSkirt: return " skirt";
case erSupportMaterial: return " support_material";
case erSupportMaterialInterface: return " support_material_interface";
case erWipeTower: return " wipe_tower";
case erMilling: return " milling";
case erCustom: return " custom";
case erMixed: return " mixed";
case erCount: return " count";
}
return " unkown";
}
std::string GCode::extrude_path(const ExtrusionPath &path, const std::string &description, double speed) {
// description += ExtrusionRole2String(path.role());
std::string descr = extrusion_role_2_string(path.role());
ExtrusionPath simplifed_path = path;
simplifed_path.simplify(SCALED_RESOLUTION);
std::string gcode = this->_extrude(simplifed_path, description, speed);
if (this->config().min_length.value != 0 && !m_last_too_small.empty()) {
//descr += " trys fusion " + std::to_string(unscaled(m_last_too_small.last_point().x())) + " , " + std::to_string(unscaled(path.first_point().x()));
//ensure that it's a continous thing
if (m_last_too_small.last_point().distance_to_square(path.first_point()) < scale_(this->config().min_length)) {
//descr += " ! fusion " + std::to_string(simplifed_path.polyline.points.size());
simplifed_path.height = (m_last_too_small.height * m_last_too_small.length() + path.height * path.length()) / (m_last_too_small.length() + path.length());
simplifed_path.mm3_per_mm = (m_last_too_small.mm3_per_mm * m_last_too_small.length() + path.mm3_per_mm * path.length()) / (m_last_too_small.length() + path.length());
simplifed_path.polyline.points.insert(simplifed_path.polyline.points.begin(), m_last_too_small.polyline.points.begin(), m_last_too_small.polyline.points.end()-1);
}
m_last_too_small.polyline.points.clear();
}
simplifed_path.simplify(this->config().min_length.value != 0 ? scale_(this->config().min_length) : SCALED_RESOLUTION);
if (this->config().min_length.value != 0 && simplifed_path.length() < scale_(this->config().min_length)) {
m_last_too_small = simplifed_path;
return "";
//"; "+ descr+" .... too small for extrude: "+std::to_string(simplifed_path.length())+" < "+ std::to_string(scale_(this->config().min_length))
//+ " ; " + std::to_string(unscaled(path.first_point().x())) + " : " + std::to_string(unscaled(path.last_point().x()))
//+" =;=> " + std::to_string(unscaled(simplifed_path.first_point().x())) + " : " + std::to_string(unscaled(simplifed_path.last_point().x()))
//+ "\n";
}
std::string gcode = this->_extrude(simplifed_path, description + descr, speed);
//gcode += " ; " + std::to_string(unscaled(path.first_point().x())) + " : " + std::to_string(unscaled(path.last_point().x()));
//gcode += " =;=> " + std::to_string(unscaled(simplifed_path.first_point().x())) + " : " + std::to_string(unscaled(simplifed_path.last_point().x()));
if (m_wipe.enable) {
m_wipe.path = std::move(simplifed_path.polyline);
m_wipe.path.reverse();
}
// reset acceleration
gcode += m_writer.set_acceleration((unsigned int)floor(m_config.default_acceleration.value + 0.5));
m_writer.set_acceleration((unsigned int)floor(m_config.default_acceleration.value + 0.5));
return gcode;
}
std::string GCode::extrude_path_3D(const ExtrusionPath3D &path, const std::string &description, double speed) {
// description += ExtrusionRole2String(path.role());
std::string descr = extrusion_role_2_string(path.role());
//path.simplify(SCALED_RESOLUTION);
std::string gcode = this->_before_extrude(path, description, speed);
std::string gcode = this->_before_extrude(path, description + descr, speed);
// calculate extrusion length per distance unit
double e_per_mm = path.mm3_per_mm
@ -3584,7 +3638,7 @@ std::string GCode::extrude_path_3D(const ExtrusionPath3D &path, const std::strin
m_wipe.path.reverse();
}
// reset acceleration
gcode += m_writer.set_acceleration((unsigned int)floor(m_config.default_acceleration.value + 0.5));
m_writer.set_acceleration((unsigned int)floor(m_config.default_acceleration.value + 0.5));
return gcode;
}
@ -3876,8 +3930,8 @@ std::string GCode::_before_extrude(const ExtrusionPath &path, const std::string
acceleration = m_config.infill_acceleration.value;
} else {
acceleration = m_config.default_acceleration.value;
}
gcode += m_writer.set_acceleration((unsigned int)floor(acceleration + 0.5));
}//TODO: add travel accel?
m_writer.set_acceleration((unsigned int)floor(acceleration + 0.5));
}

View File

@ -161,7 +161,8 @@ public:
m_normal_time_estimator(GCodeTimeEstimator::Normal),
m_silent_time_estimator(GCodeTimeEstimator::Silent),
m_silent_time_estimator_enabled(false),
m_last_obj_copy(nullptr, Point(std::numeric_limits<coord_t>::max(), std::numeric_limits<coord_t>::max()))
m_last_obj_copy(nullptr, Point(std::numeric_limits<coord_t>::max(), std::numeric_limits<coord_t>::max())),
m_last_too_small(ExtrusionRole::erNone)
{}
~GCode() {}
@ -380,6 +381,9 @@ private:
Point m_last_pos;
bool m_last_pos_defined;
// a previous extrusion path that is too small to be extruded, have to fusion it into the next call.
ExtrusionPath m_last_too_small;
std::unique_ptr<CoolingBuffer> m_cooling_buffer;
std::unique_ptr<SpiralVase> m_spiral_vase;
#ifdef HAS_PRESSURE_EQUALIZER

View File

@ -496,6 +496,31 @@ namespace Slic3r {
return m_state.max_acceleration;
}
void GCodeTimeEstimator::set_max_travel_acceleration(float acceleration_mm_sec2)
{
m_state.max_travel_acceleration = acceleration_mm_sec2;
if (acceleration_mm_sec2 > 0)
m_state.travel_acceleration = acceleration_mm_sec2;
}
float GCodeTimeEstimator::get_max_travel_acceleration() const
{
return m_state.max_travel_acceleration;
}
void GCodeTimeEstimator::set_travel_acceleration(float acceleration_mm_sec2)
{
m_state.travel_acceleration = (m_state.max_travel_acceleration == 0) ?
acceleration_mm_sec2 :
// Clamp the acceleration with the maximum.
std::min(m_state.max_travel_acceleration, acceleration_mm_sec2);
}
float GCodeTimeEstimator::get_travel_acceleration() const
{
return m_state.travel_acceleration;
}
void GCodeTimeEstimator::set_retract_acceleration(float acceleration_mm_sec2)
{
m_state.retract_acceleration = acceleration_mm_sec2;
@ -670,7 +695,9 @@ namespace Slic3r {
// Setting the maximum acceleration to zero means that the there is no limit and the G-code
// is allowed to set excessive values.
set_max_acceleration(0);
set_max_travel_acceleration(0);
set_acceleration(DEFAULT_ACCELERATION);
set_travel_acceleration(DEFAULT_ACCELERATION);
set_retract_acceleration(DEFAULT_RETRACT_ACCELERATION);
set_minimum_feedrate(DEFAULT_MINIMUM_FEEDRATE);
set_minimum_travel_feedrate(DEFAULT_MINIMUM_TRAVEL_FEEDRATE);
@ -1087,7 +1114,7 @@ namespace Slic3r {
}
// calculates block acceleration
float acceleration = block.is_extruder_only_move() ? get_retract_acceleration() : get_acceleration();
float acceleration = block.is_extruder_only_move() ? get_retract_acceleration() : block.is_travel_move() ? get_travel_acceleration() : get_acceleration();
for (unsigned char a = X; a < Num_Axis; ++a)
{
@ -1406,8 +1433,7 @@ namespace Slic3r {
set_retract_acceleration(value);
if (line.has_value('T', value)) {
// Interpret the T value as the travel acceleration in the new Marlin format.
//FIXME Prusa3D firmware currently does not support travel acceleration value independent from the extruding acceleration value.
// set_travel_acceleration(value);
set_travel_acceleration(value);
}
}
}

View File

@ -84,6 +84,9 @@ namespace Slic3r {
float acceleration; // mm/s^2
// hard limit for the acceleration, to which the firmware will clamp.
float max_acceleration; // mm/s^2
float travel_acceleration; // mm/s^2
// hard limit for the travel_acceleration, to which the firmware will clamp.
float max_travel_acceleration; // mm/s^2
float retract_acceleration; // mm/s^2
float additional_time; // s
float minimum_feedrate; // mm/s
@ -327,6 +330,13 @@ namespace Slic3r {
void set_max_acceleration(float acceleration_mm_sec2);
float get_max_acceleration() const;
void set_travel_acceleration(float acceleration_mm_sec2);
float get_travel_acceleration() const;
// Maximum acceleration for the machine. The firmware simulator will clamp the M204 Txxx to this maximum.
void set_max_travel_acceleration(float acceleration_mm_sec2);
float get_max_travel_acceleration() const;
void set_retract_acceleration(float acceleration_mm_sec2);
float get_retract_acceleration() const;

View File

@ -61,7 +61,7 @@ std::string GCodeWriter::preamble()
gcode << "G21 ; set units to millimeters\n";
gcode << "G90 ; use absolute coordinates\n";
}
if (FLAVOR_IS(gcfRepRap) || FLAVOR_IS(gcfMarlin) || FLAVOR_IS(gcfTeacup) || FLAVOR_IS(gcfRepetier) || FLAVOR_IS(gcfSmoothie)
if (FLAVOR_IS(gcfRepRap) || FLAVOR_IS(gcfMarlin) || FLAVOR_IS(gcfLerdge) || FLAVOR_IS(gcfTeacup) || FLAVOR_IS(gcfRepetier) || FLAVOR_IS(gcfSmoothie)
|| FLAVOR_IS(gcfKlipper) || FLAVOR_IS(gcfLerdge)) {
if (this->config.use_relative_e_distances) {
gcode << "M83 ; use relative distances for extrusion\n";
@ -188,28 +188,35 @@ std::string GCodeWriter::set_fan(unsigned int speed, bool dont_save)
return gcode.str();
}
std::string GCodeWriter::set_acceleration(unsigned int acceleration)
void GCodeWriter::set_acceleration(unsigned int acceleration)
{
// Clamp the acceleration to the allowed maximum.
if (m_max_acceleration > 0 && acceleration > m_max_acceleration)
acceleration = m_max_acceleration;
if (acceleration == 0 || acceleration == m_last_acceleration)
return std::string();
m_last_acceleration = acceleration;
if (acceleration == 0 || acceleration == m_current_acceleration)
return;
m_current_acceleration = acceleration;
}
std::string GCodeWriter::write_acceleration(){
if (m_current_acceleration == m_last_acceleration || m_current_acceleration == 0)
return "";
m_last_acceleration = m_current_acceleration;
std::ostringstream gcode;
//try to set only printing acceleration, travel should be untouched if possible
if (FLAVOR_IS(gcfRepetier)) {
// M201: Set max printing acceleration
gcode << "M201 X" << acceleration << " Y" << acceleration;
if (this->config.gcode_comments) gcode << " ; adjust acceleration";
gcode << "\n";
// M202: Set max travel acceleration
gcode << "M202 X" << acceleration << " Y" << acceleration;
gcode << "M201 X" << m_current_acceleration << " Y" << m_current_acceleration;
} else if(FLAVOR_IS(gcfMarlin) || FLAVOR_IS(gcfLerdge)){
// M204: Set printing acceleration
gcode << "M204 P" << m_current_acceleration;
} else {
// M204: Set default acceleration
gcode << "M204 S" << acceleration;
gcode << "M204 S" << m_current_acceleration;
}
if (this->config.gcode_comments) gcode << " ; adjust acceleration";
gcode << "\n";
@ -321,10 +328,12 @@ std::string GCodeWriter::set_speed(double F, const std::string &comment, const s
std::string GCodeWriter::travel_to_xy(const Vec2d &point, const std::string &comment)
{
std::ostringstream gcode;
gcode << write_acceleration();
m_pos.x() = point.x();
m_pos.y() = point.y();
std::ostringstream gcode;
gcode << "G1 X" << XYZF_NUM(point.x())
<< " Y" << XYZF_NUM(point.y())
<< " F" << XYZF_NUM(this->config.travel_speed.value * 60.0);
@ -353,7 +362,9 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co
the lift. */
m_lifted = 0;
m_pos = point;
std::ostringstream gcode;
gcode << write_acceleration();
gcode << "G1 X" << XYZF_NUM(point.x())
<< " Y" << XYZF_NUM(point.y());
if (config.z_step > SCALING_FACTOR)
@ -389,9 +400,10 @@ std::string GCodeWriter::travel_to_z(double z, const std::string &comment)
std::string GCodeWriter::_travel_to_z(double z, const std::string &comment)
{
m_pos.z() = z;
std::ostringstream gcode;
if (config.z_step > SCALING_FACTOR)
gcode << write_acceleration(); if (config.z_step > SCALING_FACTOR)
gcode << "G1 Z" << PRECISION(z, 6);
else
gcode << "G1 Z" << XYZF_NUM(z);
@ -419,8 +431,9 @@ std::string GCodeWriter::extrude_to_xy(const Vec2d &point, double dE, const std:
m_pos.x() = point.x();
m_pos.y() = point.y();
bool is_extrude = m_tool->extrude(dE) != 0;
std::ostringstream gcode;
gcode << write_acceleration();
gcode << "G1 X" << XYZF_NUM(point.x())
<< " Y" << XYZF_NUM(point.y());
if(is_extrude)
@ -437,8 +450,9 @@ std::string GCodeWriter::extrude_to_xyz(const Vec3d &point, double dE, const std
m_pos.y() = point.y();
m_lifted = 0;
bool is_extrude = m_tool->extrude(dE) != 0;
std::ostringstream gcode;
gcode << write_acceleration();
gcode << "G1 X" << XYZF_NUM(point.x())
<< " Y" << XYZF_NUM(point.y())
<< " Z" << XYZF_NUM(point.z() + m_pos.z());

View File

@ -65,7 +65,8 @@ public:
std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1) const;
std::string set_bed_temperature(unsigned int temperature, bool wait = false);
std::string set_fan(unsigned int speed, bool dont_save = false);
std::string set_acceleration(unsigned int acceleration);
void set_acceleration(unsigned int acceleration);
std::string write_acceleration();
std::string reset_e(bool force = false);
std::string update_progress(unsigned int num, unsigned int tot, bool allow_100 = false) const;
// return false if this extruder was already selected
@ -100,6 +101,7 @@ private:
bool m_single_extruder_multi_material;
Tool* m_tool;
unsigned int m_last_acceleration;
unsigned int m_current_acceleration;
// Limit for setting the acceleration, to respect the machine limits set for the Marlin firmware.
// If set to zero, the limit is not in action.
unsigned int m_max_acceleration;

View File

@ -1599,7 +1599,9 @@ Flow Print::brim_flow(size_t extruder_id) const
Flow Print::skirt_flow(size_t extruder_id) const
{
ConfigOptionFloatOrPercent width = m_config.first_layer_extrusion_width;
ConfigOptionFloatOrPercent width = m_config.skirt_extrusion_width;
if (width.value <= 0 && m_config.first_layer_extrusion_width.value > 0)
width = m_config.first_layer_extrusion_width;
if (width.value <= 0)
width = m_regions.front()->config().perimeter_extrusion_width;
if (width.value <= 0)
@ -1610,6 +1612,7 @@ Flow Print::skirt_flow(size_t extruder_id) const
extruders and take the one with, say, the smallest index;
The same logic should be applied to the code that selects the extruder during G-code
generation as well. */
/* or select the used extruder with the highest nozzle diameter, to be on the safe side.*/
return Flow::new_from_config_width(
frPerimeter,
width,

View File

@ -335,7 +335,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionFloat(0));
def = this->add("brim_ears", coBool);
def->label = L("");
def->label = ("");
def->full_label = L("Brim ears");
def->category = OptionCategory::skirtBrim;
def->tooltip = L("Only draw brim over the sharp edges of the model.");
@ -534,7 +534,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionBool(true));
def = this->add("duplicate_distance", coFloat);
def->label = L("Distance between copies");
def->label = L("Distance between objects");
def->category = OptionCategory::output;
def->tooltip = L("Distance used for the auto-arrange feature of the plater.");
def->sidetext = L("mm");
@ -1932,17 +1932,27 @@ void PrintConfigDef::init_fff_params()
def = this->add("machine_max_acceleration_extruding", coFloats);
def->full_label = L("Maximum acceleration when extruding");
def->category = OptionCategory::limits;
def->tooltip = L("Maximum acceleration when extruding (M204 S)");
def->tooltip = L("Maximum acceleration when extruding (M204 P)");
def->sidetext = L("mm/s²");
def->min = 0;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats{ 1500., 1250. });
// M204 R... [mm/sec^2]
def = this->add("machine_max_acceleration_retracting", coFloats);
def->full_label = L("Maximum acceleration when retracting");
def->category = OptionCategory::limits;
def->tooltip = L("Maximum acceleration when retracting (M204 R)");
def->sidetext = L("mm/s²");
def->min = 0;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats{ 1500., 1250. });
// M204 T... [mm/sec^2]
def = this->add("machine_max_acceleration_retracting", coFloats);
def->full_label = L("Maximum acceleration when retracting");
def = this->add("machine_max_acceleration_travel", coFloats);
def->full_label = L("Maximum acceleration when travelling");
def->category = OptionCategory::limits;
def->tooltip = L("Maximum acceleration when retracting (M204 T)");
def->tooltip = L("Maximum acceleration when travelling (M204 T)");
def->sidetext = L("mm/s²");
def->min = 0;
def->mode = comAdvanced;
@ -1986,7 +1996,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("max_speed_reduction", coPercents);
def->label = L("Max speed reduction");
def->category = OptionCategory::speed;
def->tooltip = L("Amount of speed you can reduce per extrusion speed.");
def->tooltip = L("Set to 90% if you don't want the speed to be reduced by more than 90%.");
def->sidetext = L("%");
def->min = 0;
def->max = 100;
@ -2051,6 +2061,16 @@ void PrintConfigDef::init_fff_params()
def->mode = comSimple;
def->set_default_value(new ConfigOptionFloats { 0.07 });
def = this->add("min_length", coFloat);
def->label = L("minimum extrusion length");
def->category = OptionCategory::speed;
def->tooltip = L("Too many too small commands may overload the firmware / connection. Put a higher value here if you see strange slowdown."
"\n0 to disable.");
def->sidetext = L("mm");
def->min = 0;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(0.035));
def = this->add("min_width_top_surface", coFloatOrPercent);
def->label = L("minimum top width for infill");
def->category = OptionCategory::speed;
@ -2146,7 +2166,7 @@ void PrintConfigDef::init_fff_params()
def->label = L("Enable Limits");
def->category = OptionCategory::limits;
def->tooltip = L("Slic3r can add M201 M203 M202 M204 and M205 gcodes to pass the machine limits defined here to the firmware."
"Gcodes printed will depends of the firmware selected (please Report an issue if you found something wrong)."
" Gcodes printed will depends of the firmware selected (please Report an issue if you found something wrong)."
"\nIf you want only a selection, you can write your gcode with these value, example: "
"\nM204 P[machine_max_acceleration_extruding] T[machine_max_acceleration_retracting]");
def->mode = comAdvanced;
@ -2190,7 +2210,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionBool(true));
def = this->add("overhangs_width", coFloatOrPercent);
def->label = L("As bridge threshold");
def->label = L("'As bridge' threshold");
def->full_label = L("Overhang bridge threshold");
def->category = OptionCategory::perimeter;
def->tooltip = L("Minimum unsupported width for an extrusion to be considered an overhang. Can be in mm or in a % of the nozzle diameter.");
@ -2605,6 +2625,15 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionInt(1));
def = this->add("skirt_extrusion_width", coFloatOrPercent);
def->label = L("Skirt");
def->category = OptionCategory::width;
def->tooltip = L("Horizontal width of the skirt that will be printed around each object.");
def->sidetext = L("mm");
def->min = 0;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloatOrPercent(0, false));
def = this->add("draft_shield", coBool);
def->label = L("Draft shield");
def->tooltip = L("If enabled, the skirt will be as tall as a highest printed object. "
@ -2750,8 +2779,8 @@ void PrintConfigDef::init_fff_params()
def->full_label = ("Solid infill speed");
def->category = OptionCategory::speed;
def->tooltip = L("Speed for printing solid regions (top/bottom/internal horizontal shells). "
"This can be expressed as a percentage (for example: 80%) over the default infill speed "
"infill speed above. Set to zero for auto.");
"This can be expressed as a percentage (for example: 80%) over the default infill speed."
" Set to zero for auto.");
def->sidetext = L("mm/s or %");
def->ratio_over = "infill_speed";
def->aliases = { "solid_infill_feed_rate" };
@ -3173,7 +3202,7 @@ void PrintConfigDef::init_fff_params()
def->label = L("merging with perimeters");
def->full_label = L("Thin wall merge");
def->category = OptionCategory::perimeter;
def->tooltip = L("Allow the external periemter to merge the thin wals int he path. !!! IF you disable this setting, please explain me why (via help->report issue)"
def->tooltip = L("Allow the external perimeter to merge the thin walls in the path. !!! IF you disable this setting, please explain me why (via help->report issue)"
" because I'm going to DELETE this setting next release, as i don't see why someone may want to disable it.");
def->mode = comExpert;
def->set_default_value(new ConfigOptionBool(true));
@ -3462,7 +3491,7 @@ void PrintConfigDef::init_fff_params()
" The number put in this setting increase the wipe by moving the nozzle again along the loop before the final wipe.");
def->min = 0;
def->sidetext = L("mm");
def->mode = comExpert;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats{ 0.f });
def = this->add("wipe_tower_bridging", coFloat);
@ -3684,7 +3713,7 @@ void PrintConfigDef::init_milling_params()
def->tooltip = L("Put here the gcode to change the toolhead (called after the g-code T[next_extruder]). You have access to [next_extruder] and [previous_extruder]."
" next_extruder is the 'extruder number' of the new milling tool, it's equal to the index (begining at 0) of the milling tool plus the number of extruders."
" previous_extruder is the 'extruder number' of the previous tool, it may be a normal extruder, if it's below the number of extruders."
" The numbe rof extruder is available at [extruder]and the number of milling tool is available at [milling_cutter].");
" The number of extruder is available at [extruder] and the number of milling tool is available at [milling_cutter].");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionStrings(""));
@ -3694,14 +3723,14 @@ void PrintConfigDef::init_milling_params()
def->tooltip = L("Put here the gcode to end the toolhead action, like stopping the spindle. You have access to [next_extruder] and [previous_extruder]."
" previous_extruder is the 'extruder number' of the current milling tool, it's equal to the index (begining at 0) of the milling tool plus the number of extruders."
" next_extruder is the 'extruder number' of the next tool, it may be a normal extruder, if it's below the number of extruders."
" The numbe rof extruder is available at [extruder]and the number of milling tool is available at [milling_cutter].");
" The number of extruder is available at [extruder]and the number of milling tool is available at [milling_cutter].");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionStrings(""));
def = this->add("milling_post_process", coBool);
def->label = L("Milling post-processing");
def->category = OptionCategory::milling;
def->tooltip = L("If activated, at the end of each layer, the printer will switch to a milling ead and mill the external perimeters."
def->tooltip = L("If activated, at the end of each layer, the printer will switch to a milling head and mill the external perimeters."
"\nYou should set the 'Milling extra XY size' to a value high enough to have enough plastic to mill. Also, be sure that your piece is firmly glued to the bed.");
def->mode = comSimple;
def->set_default_value(new ConfigOptionBool(false));
@ -3719,7 +3748,7 @@ void PrintConfigDef::init_milling_params()
def = this->add("milling_after_z", coFloatOrPercent);
def->label = L("Milling only after");
def->category = OptionCategory::milling;
def->tooltip = L("THis setting restrict the post-process milling to a certain height, to avoid milling the bed. It can be a mm of a % of the first layer height (so it can depends of the object).");
def->tooltip = L("This setting restrict the post-process milling to a certain height, to avoid milling the bed. It can be a mm of a % of the first layer height (so it can depends of the object).");
def->sidetext = L("mm or %");
def->ratio_over = "first_layer_height";
def->mode = comAdvanced;

View File

@ -798,8 +798,10 @@ public:
ConfigOptionFloats machine_max_feedrate_e;
// M204 S... [mm/sec^2]
ConfigOptionFloats machine_max_acceleration_extruding;
// M204 T... [mm/sec^2]
// M204 R... [mm/sec^2]
ConfigOptionFloats machine_max_acceleration_retracting;
// M204 T... [mm/sec^2]
ConfigOptionFloats machine_max_acceleration_travel;
// M205 X... Y... Z... E... [mm/sec]
ConfigOptionFloats machine_max_jerk_x;
ConfigOptionFloats machine_max_jerk_y;
@ -823,6 +825,7 @@ protected:
OPT_PTR(machine_max_feedrate_e);
OPT_PTR(machine_max_acceleration_extruding);
OPT_PTR(machine_max_acceleration_retracting);
OPT_PTR(machine_max_acceleration_travel);
OPT_PTR(machine_max_jerk_x);
OPT_PTR(machine_max_jerk_y);
OPT_PTR(machine_max_jerk_z);
@ -883,11 +886,12 @@ public:
ConfigOptionString feature_gcode;
ConfigOptionFloat max_print_speed;
ConfigOptionFloat max_volumetric_speed;
ConfigOptionFloats milling_z_lift;
#ifdef HAS_PRESSURE_EQUALIZER
ConfigOptionFloat max_volumetric_extrusion_rate_slope_positive;
ConfigOptionFloat max_volumetric_extrusion_rate_slope_negative;
#endif
ConfigOptionFloats milling_z_lift;
ConfigOptionFloat min_length;
ConfigOptionPercents retract_before_wipe;
ConfigOptionFloats retract_length;
ConfigOptionFloats retract_length_toolchange;
@ -980,6 +984,7 @@ protected:
OPT_PTR(max_print_speed);
OPT_PTR(max_volumetric_speed);
OPT_PTR(milling_z_lift);
OPT_PTR(min_length);
#ifdef HAS_PRESSURE_EQUALIZER
OPT_PTR(max_volumetric_extrusion_rate_slope_positive);
OPT_PTR(max_volumetric_extrusion_rate_slope_negative);
@ -1091,6 +1096,7 @@ public:
ConfigOptionBools retract_layer_change;
ConfigOptionFloat skirt_distance;
ConfigOptionInt skirt_height;
ConfigOptionFloatOrPercent skirt_extrusion_width;
ConfigOptionBool draft_shield;
ConfigOptionInt skirts;
ConfigOptionInts slowdown_below_layer_time;
@ -1179,6 +1185,7 @@ protected:
OPT_PTR(retract_before_travel);
OPT_PTR(retract_layer_change);
OPT_PTR(skirt_distance);
OPT_PTR(skirt_extrusion_width);
OPT_PTR(skirt_height);
OPT_PTR(draft_shield);
OPT_PTR(skirts);

View File

@ -364,6 +364,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
bool have_skirt = config->opt_int("skirts") > 0;
toggle_field("skirt_height", have_skirt && !config->opt_bool("draft_shield"));
toggle_field("skirt_width", have_skirt);
for (auto el : { "skirt_distance", "draft_shield", "min_skirt_length" })
toggle_field(el, have_skirt);

View File

@ -529,11 +529,69 @@ void FreeCADDialog::on_char_add(wxStyledTextEvent& event) {
stc->InsertText(current_pos, "\"");
}
}
void FreeCADDialog::comment(bool is_switch) {
//if selction, do that for every line
std::vector<int> lines;
if (m_text->LineFromPosition(m_text->GetSelectionStart()) < m_text->LineFromPosition(m_text->GetSelectionEnd()) ) {
for(int i= m_text->LineFromPosition(m_text->GetSelectionStart()); i <= m_text->LineFromPosition(m_text->GetSelectionEnd()); i++)
lines.push_back(i);
} else {
lines.push_back(m_text->GetCurrentLine());
}
//get last \n pos or 0
int saved_pos = m_text->GetCurrentPos();
int begin = m_text->GetSelectionStart();
int end = m_text->GetSelectionEnd();
for (int l : lines) {
int commentpos = m_text->PositionFromLine(l);
//skip ' ' and '\t'
if(is_switch)
while (m_text->GetCharAt(commentpos) == ' ' || m_text->GetCharAt(commentpos) == '\t')
commentpos++;
if (m_text->GetCharAt(commentpos) == '#' && is_switch) {
m_text->SetTargetStart(commentpos);
m_text->SetTargetEnd(commentpos + 1);
m_text->ReplaceTarget("");
if (commentpos < begin) {
begin--;
}
end--;
saved_pos--;
} else {
m_text->InsertText(commentpos, "#");
if (commentpos < begin) {
begin++;
}
end++;
saved_pos++;
}
}
m_text->SetCurrentPos(saved_pos); //TODO +- some if # added/removed
if (begin < end) {
m_text->SetSelectionStart(begin);
m_text->SetSelectionEnd(end);
}
}
void FreeCADDialog::on_char_type(wxKeyEvent &event) {
//std::cout << "on_char_type " << event.GetUnicodeKey() <<", " << event.GetModifiers() << "\n";
if (event.GetUnicodeKey() == 'Q' && event.GetModifiers() == wxMOD_CONTROL) {
comment(true);
} else if (event.GetUnicodeKey() == 'K' && event.GetModifiers() == wxMOD_CONTROL) {
comment(false);
} else {
event.Skip(true);
}
}
// note: this works on KEY, not on CHAR, so be sure the key is the right one for all keyboard layout.
// space, back, del are ok but no ascii char
void FreeCADDialog::on_key_type(wxKeyEvent& event)
{
//std::cout << "on_key_type " << event.GetUnicodeKey() << " ? "<< int('Q') <<", "<< event.GetKeyCode() << ", " << event.GetModifiers() << "\n";
if (event.GetKeyCode() == WXK_SPACE && event.GetModifiers() == wxMOD_CONTROL)
{
//get word, if any
@ -604,6 +662,10 @@ void FreeCADDialog::on_key_type(wxKeyEvent& event)
event.Skip(true);
} else if (event.GetKeyCode() == WXK_ESCAPE && m_text != nullptr && m_text->AutoCompActive()) {
m_text->AutoCompCancel();
}else if (event.GetUnicodeKey() == 'Q' && event.GetModifiers() == wxMOD_CONTROL) {
comment(true);
} else if (event.GetUnicodeKey() == 'K' && event.GetModifiers() == wxMOD_CONTROL) {
comment(false);
} else {
event.Skip(true);
}
@ -635,6 +697,7 @@ void FreeCADDialog::createSTC()
m_text->Bind(wxEVT_STC_MODIFIED, &FreeCADDialog::on_word_change_for_autocomplete, this);
m_text->Bind(wxEVT_STC_CHARADDED, &FreeCADDialog::on_char_add, this);
m_text->Bind(wxEVT_KEY_DOWN, &FreeCADDialog::on_key_type, this);
m_text->Bind(wxEVT_CHAR, &FreeCADDialog::on_char_type, this);
m_text->Bind(wxEVT_STC_AUTOCOMP_COMPLETED, &FreeCADDialog::on_autocomp_complete, this);
m_text->Connect(wxID_ANY,
wxEVT_KEY_DOWN,

View File

@ -68,10 +68,12 @@ protected:
void on_word_change_for_autocomplete(wxStyledTextEvent& event);
void on_char_add(wxStyledTextEvent& event);
void on_key_type(wxKeyEvent& event);
void on_char_type(wxKeyEvent& event);
void on_autocomp_complete(wxStyledTextEvent& event);
bool write_text_in_file(const wxString &towrite, const boost::filesystem::path &file);
bool load_text_from_file(const boost::filesystem::path &file);
void test_update_script_file(std::string &json);
void comment(bool is_switch);
wxStyledTextCtrl* m_text;
wxTextCtrl* m_errors;

View File

@ -1439,7 +1439,7 @@ void GLCanvas3D::Tooltip::render(const Vec2d& mouse_position) const
imgui.set_next_window_pos(mouse_position(0), mouse_position(1) + 16, ImGuiCond_Always, 0.0f, 0.0f);
#endif // ENABLE_CANVAS_CONSTRAINED_TOOLTIP_USING_IMGUI
imgui.begin(_(L("canvas_tooltip")), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoFocusOnAppearing);
imgui.begin(_("canvas_tooltip"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoFocusOnAppearing);
ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindow());
ImGui::TextUnformatted(m_text.c_str());

View File

@ -474,6 +474,7 @@ const std::vector<std::string>& Preset::print_options()
"bridge_acceleration", "first_layer_acceleration", "default_acceleration",
"duplicate_distance",
"skirts", "skirt_distance", "skirt_height",
"skirt_extrusion_width",
"min_skirt_length",
"draft_shield",
"brim_inside_holes",
@ -596,6 +597,7 @@ const std::vector<std::string>& Preset::printer_options()
"printer_technology",
"bed_shape", "bed_custom_texture", "bed_custom_model", "z_offset", "gcode_flavor", "use_relative_e_distances", "serial_port", "serial_speed",
"use_firmware_retraction", "use_volumetric_e", "variable_layer_height",
"min_length",
"host_type", "print_host", "printhost_apikey", "printhost_cafile",
"single_extruder_multi_material", "start_gcode", "end_gcode", "before_layer_gcode", "layer_gcode", "toolchange_gcode",
"feature_gcode",
@ -607,6 +609,7 @@ const std::vector<std::string>& Preset::printer_options()
"wipe_advanced_multiplier",
"wipe_advanced_algo",
"remaining_times", "silent_mode", "machine_max_acceleration_extruding", "machine_max_acceleration_retracting",
"machine_max_acceleration_travel",
"machine_max_acceleration_x", "machine_max_acceleration_y", "machine_max_acceleration_z", "machine_max_acceleration_e",
"machine_max_feedrate_x", "machine_max_feedrate_y", "machine_max_feedrate_z", "machine_max_feedrate_e",
"machine_min_extruding_rate", "machine_min_travel_rate",

View File

@ -2224,6 +2224,7 @@ PageShp TabPrinter::build_kinematics_page()
}
append_option_line_kinematics(optgroup, "machine_max_acceleration_extruding");
append_option_line_kinematics(optgroup, "machine_max_acceleration_retracting");
append_option_line_kinematics(optgroup, "machine_max_acceleration_travel");
optgroup = page->new_optgroup(_(L("Jerk limits")));
for (const std::string &axis : axes) {