Welcome! Log In Create A New Profile

Advanced

Source code change - dual extrusion

Posted by tomMulholland 
Source code change - dual extrusion
August 16, 2017 10:45AM
I would like to change Slic3r's source code to allow me to change the build order of dual-extrusion parts. Currently, the extruders alternate every layer; e.g. layer 3 uses extruder 1, then extruder 2; layer 4 uses extruder 2, then extruder 1.

Long story short, I need to make sure extruder 1 prints first on every layer in order to have finer control over the toolpath generation. I would appreciate if anyone has an idea where to look in the code, and what other issues may arise.

Thank you!
Re: Source code change - dual extrusion
August 16, 2017 12:59PM
I think I found the right section of code to change, but my Perl isn't good (it's non-existent). The code snippet is below, from lib/Slic3r/Print/GCode.pm. I don't want to start with $last_extruder_id, but always order it extruder 1, extruder 2, extruder 3, etc.


# tweak extruder ordering to save toolchanges
my @extruders = sort { $a <=> $b } keys %by_extruder;
if (@extruders > 1) {
my $last_extruder_id = $self->_gcodegen->writer->extruder->id;
if (exists $by_extruder{$last_extruder_id}) {
@extruders = (
$last_extruder_id,
grep $_ != $last_extruder_id, @extruders,
);
}
}
Re: Source code change - dual extrusion
August 16, 2017 03:41PM
Solved - see the Stack Overload thread here: [stackoverflow.com]
And the forked version of Slic3r here: [github.com]
Re: Source code change - dual extrusion
September 16, 2017 09:48AM
I can see where this code change should be controlled by a new option. It can then be merged into the main slic3r repository.

Edited 1 time(s). Last edit at 09/16/2017 09:49AM by b-morgan.
Sorry, only registered users may post in this forum.

Click here to login