Skip to content

Commit

Permalink
support for pressure driven pneumatic dispensers as extruders
Browse files Browse the repository at this point in the history
  • Loading branch information
platsch committed Oct 20, 2020
1 parent c8f0bd3 commit 86cb9ef
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 1 deletion.
26 changes: 25 additions & 1 deletion lib/Slic3r/GUI/PresetEditor.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,7 @@ sub options {
use_volumetric_e
start_gcode end_gcode before_layer_gcode layer_gcode toolchange_gcode between_objects_gcode
nozzle_diameter extruder_offset min_layer_height max_layer_height
pneumatic_extruder pneumatic_extrusion_preamble pneumatic_extrusion_postamble
retract_length retract_lift retract_speed retract_restart_extra retract_before_travel retract_layer_change wipe
retract_length_toolchange retract_restart_extra_toolchange retract_lift_above retract_lift_below
printer_settings_id
Expand Down Expand Up @@ -1501,7 +1502,7 @@ sub _extruders_count_changed {
$self->_update;
}

sub _extruder_options { qw(nozzle_diameter min_layer_height max_layer_height extruder_offset retract_length retract_lift retract_lift_above retract_lift_below retract_speed retract_restart_extra retract_before_travel wipe
sub _extruder_options { qw(nozzle_diameter min_layer_height max_layer_height extruder_offset pneumatic_extruder pneumatic_extrusion_preamble pneumatic_extrusion_postamble retract_length retract_lift retract_lift_above retract_lift_below retract_speed retract_restart_extra retract_before_travel wipe
retract_layer_change retract_length_toolchange retract_restart_extra_toolchange) }

sub _build_extruder_pages {
Expand Down Expand Up @@ -1539,6 +1540,10 @@ sub _build_extruder_pages {
my $optgroup = $page->new_optgroup('Position (for multi-extruder printers)');
$optgroup->append_single_option_line('extruder_offset', $extruder_idx);
}
{
my $optgroup = $page->new_optgroup('Extruder type');
$optgroup->append_single_option_line('pneumatic_extruder', $extruder_idx);
}
{
my $optgroup = $page->new_optgroup('Retraction');
$optgroup->append_single_option_line($_, $extruder_idx)
Expand All @@ -1561,6 +1566,17 @@ sub _build_extruder_pages {
$optgroup->append_single_option_line($_, $extruder_idx)
for qw(retract_length_toolchange retract_restart_extra_toolchange);
}
{
my $optgroup = $page->new_optgroup('Pneumatic extruder settings');
my $preamble_option = $optgroup->get_option('pneumatic_extrusion_preamble', $extruder_idx);
$preamble_option->full_width(1);
$preamble_option->height(150);
$optgroup->append_single_option_line($preamble_option);
my $postamble_option = $optgroup->get_option('pneumatic_extrusion_postamble', $extruder_idx);
$postamble_option->full_width(1);
$postamble_option->height(150);
$optgroup->append_single_option_line($postamble_option);
}
}

# remove extra pages
Expand Down Expand Up @@ -1663,6 +1679,14 @@ sub _update {
my $toolchange_retraction = $config->get_at('retract_length_toolchange', $i) > 0;
$self->get_field('retract_restart_extra_toolchange', $i)->toggle
($have_multiple_extruders && $toolchange_retraction);

# This must happen at the end to overwrite previous toggles
my $have_pneumatic_extruder = $config->get_at('pneumatic_extruder', $i);
$self->get_field($_, $i)->toggle(!$have_pneumatic_extruder)
for qw(retract_length retract_lift retract_lift_above retract_lift_below retract_speed retract_restart_extra retract_before_travel wipe
retract_layer_change retract_length_toolchange retract_restart_extra_toolchange);
$self->get_field($_, $i)->toggle($have_pneumatic_extruder)
for qw(pneumatic_extrusion_preamble pneumatic_extrusion_postamble);
}
}

Expand Down
24 changes: 24 additions & 0 deletions xs/src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,14 @@ GCode::_extrude(ExtrusionPath path, std::string description, double speed)
if (path.role == erExternalPerimeter) comment += ";_EXTERNAL_PERIMETER";
gcode += this->writer.set_speed(F, "", this->enable_cooling_markers ? comment : "");
double path_length = 0;

// start pneumatic extrusion
if(EXTRUDER_CONFIG(pneumatic_extruder)) {
gcode += EXTRUDER_CONFIG(pneumatic_extrusion_preamble);
if(gcode.back() != '\n') gcode += "\n";
}


{
std::string comment = this->config.gcode_comments ? description : "";
Lines lines = path.polyline.lines();
Expand All @@ -697,6 +705,13 @@ GCode::_extrude(ExtrusionPath path, std::string description, double speed)
);
}
}

// end pneumatic extrusion
if(EXTRUDER_CONFIG(pneumatic_extruder)) {
gcode += EXTRUDER_CONFIG(pneumatic_extrusion_postamble);
if(gcode.back() != '\n') gcode += "\n";
}

if (this->wipe.enable) {
this->wipe.path = path.polyline;
this->wipe.path.reverse();
Expand Down Expand Up @@ -802,6 +817,10 @@ GCode::retract(bool toolchange)

if (this->writer.extruder() == NULL)
return gcode;

// air pressure extruder, no retraction possible
if(EXTRUDER_CONFIG(pneumatic_extruder))
return gcode;

// wipe (if it's enabled for this extruder and we have a stored wipe path)
if (EXTRUDER_CONFIG(wipe) && this->wipe.has_path()) {
Expand All @@ -825,6 +844,11 @@ std::string
GCode::unretract()
{
std::string gcode;

// air pressure extruder, no unretraction possible
if(EXTRUDER_CONFIG(pneumatic_extruder))
return gcode;

gcode += this->writer.unlift();
gcode += this->writer.unretract();
return gcode;
Expand Down
36 changes: 36 additions & 0 deletions xs/src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,42 @@ PrintConfigDef::PrintConfigDef()
def->min = 0;
def->default_value = new ConfigOptionInt(3);

def = this->add("pneumatic_extruder", coBools);
def->label = "Pressure driven extruder";
def->tooltip = "Is this a standard filament or air pressure driven extruder?";
def->cli = "pneumatic_extruder!";
{
ConfigOptionBools* opt = new ConfigOptionBools();
opt->values.push_back(false);
def->default_value = opt;
}

def = this->add("pneumatic_extrusion_preamble", coStrings);
def->label = "Extrusion preamble";
def->tooltip = "This will be injected before every pressure driven extrusion line. Open valve, set pressure, wait, etc...";
def->multiline = true;
def->full_width = true;
def->height = 120;
def->cli = "pneumatic_extrusion_preamble=s@";
{
ConfigOptionStrings* opt = new ConfigOptionStrings();
opt->values.push_back(";Extrusion Preamble\nM400 ; Sync printer queue\nM42 P2 S255 ; open pressure nozzle\nG4 P110 ; wait for material flow");
def->default_value = opt;
}

def = this->add("pneumatic_extrusion_postamble", coStrings);
def->label = "Extrusion postamble";
def->tooltip = "This will be injected after every pressure driven extrusion line. Close valve, set pressure, wait, etc...";
def->multiline = true;
def->full_width = true;
def->height = 120;
def->cli = "pneumatic_extrusion_postamble=s@";
{
ConfigOptionStrings* opt = new ConfigOptionStrings();
opt->values.push_back(";Extrusion Postamble\nM400 ; Sync printer queue\nM42 P2 S0 ; close pressure nozzle");
def->default_value = opt;
}

def = this->add("post_process", coStrings);
def->label = "Post-processing scripts";
def->tooltip = "If you want to process the output G-code through custom scripts, just list their absolute paths here. Separate multiple scripts on individual lines. Scripts will be passed the absolute path to the G-code file as the first argument, and they can access the Slic3r config settings by reading environment variables.";
Expand Down
6 changes: 6 additions & 0 deletions xs/src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ class GCodeConfig : public virtual StaticPrintConfig
ConfigOptionFloat max_print_speed;
ConfigOptionFloat max_volumetric_speed;
ConfigOptionString notes;
ConfigOptionBools pneumatic_extruder;
ConfigOptionStrings pneumatic_extrusion_preamble;
ConfigOptionStrings pneumatic_extrusion_postamble;
ConfigOptionFloat pressure_advance;
ConfigOptionString printer_notes;
ConfigOptionFloats retract_length;
Expand Down Expand Up @@ -406,6 +409,9 @@ class GCodeConfig : public virtual StaticPrintConfig
OPT_PTR(max_print_speed);
OPT_PTR(max_volumetric_speed);
OPT_PTR(notes);
OPT_PTR(pneumatic_extruder);
OPT_PTR(pneumatic_extrusion_preamble);
OPT_PTR(pneumatic_extrusion_postamble);
OPT_PTR(pressure_advance);
OPT_PTR(printer_notes);
OPT_PTR(retract_length);
Expand Down

0 comments on commit 86cb9ef

Please sign in to comment.