Merge remote-tracking branch 'origin/master' into tm_colldetection_upgr

This commit is contained in:
tamasmeszaros 2019-02-01 13:21:16 +01:00
commit d65fd9f346
22 changed files with 231 additions and 93 deletions

View file

@ -1622,6 +1622,8 @@ void GCode::process_layer(
unsigned int copy_id = 0;
for (const Point &copy : copies) {
if (this->config().gcode_label_objects)
gcode += std::string("; printing object ") + print_object->model_object()->name + " id:" + std::to_string(layer_id) + " copy " + std::to_string(copy_id) + "\n";
// When starting a new object, use the external motion planner for the first travel move.
std::pair<const PrintObject*, Point> this_object_copy(print_object, copy);
if (m_last_obj_copy != this_object_copy)
@ -1646,7 +1648,9 @@ void GCode::process_layer(
gcode += this->extrude_infill(print,by_region_specific);
}
}
++copy_id;
if (this->config().gcode_label_objects)
gcode += std::string("; stop printing object ") + print_object->model_object()->name + " id:" + std::to_string(layer_id) + " copy " + std::to_string(copy_id) + "\n";
++ copy_id;
}
}
}

View file

@ -13,7 +13,7 @@ class SpiralVase {
SpiralVase(const PrintConfig &config)
: enable(false), _config(&config)
{
this->_reader.z() = this->_config->z_offset;
this->_reader.z() = (float)this->_config->z_offset;
this->_reader.apply_config(*this->_config);
};
std::string process_layer(const std::string &gcode);

View file

@ -43,7 +43,7 @@ public:
}
bool cmd_is(const char *cmd_test) const {
const char *cmd = GCodeReader::skip_whitespaces(m_raw.c_str());
int len = strlen(cmd_test);
size_t len = strlen(cmd_test);
return strncmp(cmd, cmd_test, len) == 0 && GCodeReader::is_end_of_word(cmd[len]);
}
bool extruding(const GCodeReader &reader) const { return this->cmd_is("G1") && this->dist_E(reader) > 0; }

View file

@ -549,11 +549,18 @@ void Model::reset_auto_extruder_id()
std::string Model::propose_export_file_name() const
{
std::string input_file;
for (const ModelObject *model_object : this->objects)
for (ModelInstance *model_instance : model_object->instances)
if (model_instance->is_printable())
return model_object->name.empty() ? model_object->input_file : model_object->name;
return std::string();
if (model_instance->is_printable()) {
input_file = model_object->name.empty() ? model_object->input_file : model_object->name;
if (! input_file.empty())
goto end;
// Other instances will produce the same name, skip them.
break;
}
end:
return input_file;
}
ModelObject::~ModelObject()

View file

@ -127,6 +127,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
"first_layer_speed",
"gcode_comments",
"gcode_flavor",
"gcode_label_objects",
"infill_acceleration",
"layer_gcode",
"min_fan_speed",

View file

@ -67,20 +67,9 @@ std::string PrintBase::output_filename(const std::string &format, const std::str
std::string PrintBase::output_filepath(const std::string &path) const
{
// if we were supplied no path, generate an automatic one based on our first object's input file
if (path.empty()) {
if (path.empty())
// get the first input file name
std::string input_file;
for (const ModelObject *model_object : m_model.objects) {
for (ModelInstance *model_instance : model_object->instances)
if (model_instance->is_printable()) {
input_file = model_object->input_file;
break;
}
if (! input_file.empty())
break;
}
return (boost::filesystem::path(input_file).parent_path() / this->output_filename()).make_preferred().string();
}
return (boost::filesystem::path(m_model.propose_export_file_name()).parent_path() / this->output_filename()).make_preferred().string();
// if we were supplied a directory, use it and append our automatically generated filename
boost::filesystem::path p(path);

View file

@ -930,6 +930,15 @@ void PrintConfigDef::init_fff_params()
def->mode = comExpert;
def->default_value = new ConfigOptionEnum<GCodeFlavor>(gcfRepRap);
def = this->add("gcode_label_objects", coBool);
def->label = "Label objects";
def->tooltip = "Enable this to add comments into the G-Code labeling print moves with what object they belong to,"
" which is useful for the Octoprint CancelObject plugin. This settings is NOT compatible with "
"Single Extruder Multi Material setup and Wipe into Object / Wipe into Infill.";
def->cli = "gcode-label-objects!";
def->mode = comAdvanced;
def->default_value = new ConfigOptionBool(0);
def = this->add("high_current_on_filament_swap", coBool);
def->label = L("High extruder current on filament swap");
def->tooltip = L("It may be beneficial to increase the extruder motor current during the filament exchange"

View file

@ -619,6 +619,7 @@ public:
ConfigOptionStrings filament_ramming_parameters;
ConfigOptionBool gcode_comments;
ConfigOptionEnum<GCodeFlavor> gcode_flavor;
ConfigOptionBool gcode_label_objects;
ConfigOptionString layer_gcode;
ConfigOptionFloat max_print_speed;
ConfigOptionFloat max_volumetric_speed;
@ -690,6 +691,7 @@ protected:
OPT_PTR(filament_ramming_parameters);
OPT_PTR(gcode_comments);
OPT_PTR(gcode_flavor);
OPT_PTR(gcode_label_objects);
OPT_PTR(layer_gcode);
OPT_PTR(max_print_speed);
OPT_PTR(max_volumetric_speed);
@ -730,7 +732,7 @@ protected:
class PrintConfig : public MachineEnvelopeConfig, public GCodeConfig
{
STATIC_PRINT_CONFIG_CACHE_DERIVED(PrintConfig)
PrintConfig() : GCodeConfig(0) { initialize_cache(); *this = s_cache_PrintConfig.defaults(); }
PrintConfig() : MachineEnvelopeConfig(0), GCodeConfig(0) { initialize_cache(); *this = s_cache_PrintConfig.defaults(); }
public:
double min_object_distance() const;
static double min_object_distance(const ConfigBase *config);
@ -808,7 +810,7 @@ public:
ConfigOptionFloat exp_time_first;
protected:
PrintConfig(int) : GCodeConfig(1) {}
PrintConfig(int) : MachineEnvelopeConfig(1), GCodeConfig(1) {}
void initialize(StaticCacheBase &cache, const char *base_ptr)
{
this->MachineEnvelopeConfig::initialize(cache, base_ptr);

View file

@ -56,3 +56,12 @@
#define ENABLE_ANISOTROPIC_FILTER_ON_BED_TEXTURES (1 && ENABLE_1_42_0_ALPHA4)
// Bunch of fixes related to volumes centering
#define ENABLE_VOLUMES_CENTERING_FIXES (1 && ENABLE_1_42_0_ALPHA4)
//====================
// 1.42.0.alpha5 techs
//====================
#define ENABLE_1_42_0_ALPHA5 1
// Toolbar items hidden/shown in dependence of the user mode
#define ENABLE_MODE_AWARE_TOOLBAR_ITEMS (1 && ENABLE_1_42_0_ALPHA5)