Replicator2 #853

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants
@Opticalworm

added support to the Replicator 2 and printing via Makerware

Added replicator 2 gcode Flavour which was required for:

  • extruder variable E to A
  • Fan command 126 127

Makerware support:

  • option to disable internal start and end gcode

Opticalworm added some commits Nov 30, 2012

Replicator2 Support
Done:
- Added G-Code flavour for Makerbot Replicator 2
- added Replicator2 Fan comtrol M126 & M127
- Replicator 2 gcode G1 now uses A for the extrude command

Todo:
- not sure why when retracting is trigger, Replicator2 sqrick alot more
plastic than what it snorted.
Added option to disable internal start/end gcode
By adding this option we can give the user the choice to use only there
own start and end gcode or allow 3rd party software to appened there own
setup code.

for example makerware, it implements its own start and end gcode when
importing external gcode sliced by other engines.
@alexrj

This comment has been minimized.

Show comment
Hide comment
@alexrj

alexrj Dec 20, 2012

Member

Uhm, 3713 additions and 3640 deletions... I can't merge this.

Can you describe the change so that I can implement it myself? If I understand correctly, the 'replicator2' flavor should:

  • use A instead of E
  • use M126 T0 instead of M106
  • use M127 T0 instead of M107

Can you confirm the above and provide some background/discussion about the "option to disable internal start and end gcode" you mentioned?

Member

alexrj commented Dec 20, 2012

Uhm, 3713 additions and 3640 deletions... I can't merge this.

Can you describe the change so that I can implement it myself? If I understand correctly, the 'replicator2' flavor should:

  • use A instead of E
  • use M126 T0 instead of M106
  • use M127 T0 instead of M107

Can you confirm the above and provide some background/discussion about the "option to disable internal start and end gcode" you mentioned?

@Opticalworm

This comment has been minimized.

Show comment
Hide comment
@Opticalworm

Opticalworm Dec 21, 2012

Sorry about that. This is my first time using github I'm not quite sure why there's so many addition and deleting when I only really made a few changes. At work I'm used to using SVN with WinMerge with only one other guy on the project.

I added a new flavour for the Replicator2 and went through every instance where makerbot was used to execute alternative code and tagged Replicator2 onto it.

    'gcode_flavor' => {
        label   => 'G-code flavor',
        tooltip => 'Some G/M-code commands, including temperature control and others, are not universal. Set this option to your printer\'s firmware to get a compatible output. The "No extrusion" flavor prevents Slic3r from exporting any extrusion value at all.',
        cli     => 'gcode-flavor=s',
        type    => 'select',
        values  => [qw(reprap teacup makerbot replicator2 mach3 no-extrusion)],
        labels  => ['RepRap (Marlin/Sprinter)', 'Teacup', 'MakerBot', 'Replicator2', 'Mach3/EMC', 'No extrusion'],
        default => 'reprap',
    },

Then In the function GCode.pm -> set_fan I added the if statements for those fan code

sub set_fan {
    my $self = shift;
    my ($speed, $dont_save) = @_;

    if ($self->last_fan_speed != $speed || $dont_save) {
        $self->last_fan_speed($speed) if !$dont_save;
        if ($speed == 0) {
            my $code;
            if ($Slic3r::Config->gcode_flavor eq 'replicator2') {
                $code = 'M127 T0';
            } else {
                $code = $Slic3r::Config->gcode_flavor eq 'teacup' 
                ? 'M106 S0' 
                : 'M107';
            }
            return sprintf "$code%s\n", ($Slic3r::Config->gcode_comments ? ' ; disable fan' : '');
        } else {

            if ($Slic3r::Config->gcode_flavor eq 'replicator2') {
                # Replicator fan is either on or off
                return sprintf "M126 T0 %s\n", ($Slic3r::Config->gcode_comments ? ' ; enable fan' : '');

            } else {            
                return sprintf "M106 %s%d%s\n", ($Slic3r::Config->gcode_flavor eq 'mach3' ? 'P' : 'S'),
                    (255 * $speed / 100), ($Slic3r::Config->gcode_comments ? ' ; enable fan' : '');
            }
        }
    }
    return "";
}

Then I also in Print.pm -> _trigger_config I added Replicator2 on to the following line to change the extrusion Letter from E to A

$self->config->set('extrusion_axis', 'A') if ($self->config->gcode_flavor eq 'mach3' || $self->config->gcode_flavor eq 'replicator2');

I created the option to disable internal gcode for two reasons,

  • First it seem logical that if your willing to write your own Start and End code then your likely to not need Slic3r to generate any extra code on start up.
  • And secondly, MakerWare service crashes when you "make from file" using Gcode that has startup code. ( I know this isn't Slic3r problem but it save people form having to prep Gcode before passing it through MakerWare.

also I searched for Gcode that generated comment when gcode_comments state set to false altered them so they didn't. For example: in Print.pm -> sub write_gcode the following Gcode didn't check gcode_comments State
G90 G21 M83 M82

Also in GCode.pm -> sub set_temperature code M116 and also the following line in the same function.

my $gcode = sprintf "$code %s%d %s; $comment\n",
        ($Slic3r::Config->gcode_flavor eq 'mach3' ? 'P' : 'S'), $temperature,
        (defined $tool && $self->multiple_extruders) ? "T$tool " : "";

Sorry about that. This is my first time using github I'm not quite sure why there's so many addition and deleting when I only really made a few changes. At work I'm used to using SVN with WinMerge with only one other guy on the project.

I added a new flavour for the Replicator2 and went through every instance where makerbot was used to execute alternative code and tagged Replicator2 onto it.

    'gcode_flavor' => {
        label   => 'G-code flavor',
        tooltip => 'Some G/M-code commands, including temperature control and others, are not universal. Set this option to your printer\'s firmware to get a compatible output. The "No extrusion" flavor prevents Slic3r from exporting any extrusion value at all.',
        cli     => 'gcode-flavor=s',
        type    => 'select',
        values  => [qw(reprap teacup makerbot replicator2 mach3 no-extrusion)],
        labels  => ['RepRap (Marlin/Sprinter)', 'Teacup', 'MakerBot', 'Replicator2', 'Mach3/EMC', 'No extrusion'],
        default => 'reprap',
    },

Then In the function GCode.pm -> set_fan I added the if statements for those fan code

sub set_fan {
    my $self = shift;
    my ($speed, $dont_save) = @_;

    if ($self->last_fan_speed != $speed || $dont_save) {
        $self->last_fan_speed($speed) if !$dont_save;
        if ($speed == 0) {
            my $code;
            if ($Slic3r::Config->gcode_flavor eq 'replicator2') {
                $code = 'M127 T0';
            } else {
                $code = $Slic3r::Config->gcode_flavor eq 'teacup' 
                ? 'M106 S0' 
                : 'M107';
            }
            return sprintf "$code%s\n", ($Slic3r::Config->gcode_comments ? ' ; disable fan' : '');
        } else {

            if ($Slic3r::Config->gcode_flavor eq 'replicator2') {
                # Replicator fan is either on or off
                return sprintf "M126 T0 %s\n", ($Slic3r::Config->gcode_comments ? ' ; enable fan' : '');

            } else {            
                return sprintf "M106 %s%d%s\n", ($Slic3r::Config->gcode_flavor eq 'mach3' ? 'P' : 'S'),
                    (255 * $speed / 100), ($Slic3r::Config->gcode_comments ? ' ; enable fan' : '');
            }
        }
    }
    return "";
}

Then I also in Print.pm -> _trigger_config I added Replicator2 on to the following line to change the extrusion Letter from E to A

$self->config->set('extrusion_axis', 'A') if ($self->config->gcode_flavor eq 'mach3' || $self->config->gcode_flavor eq 'replicator2');

I created the option to disable internal gcode for two reasons,

  • First it seem logical that if your willing to write your own Start and End code then your likely to not need Slic3r to generate any extra code on start up.
  • And secondly, MakerWare service crashes when you "make from file" using Gcode that has startup code. ( I know this isn't Slic3r problem but it save people form having to prep Gcode before passing it through MakerWare.

also I searched for Gcode that generated comment when gcode_comments state set to false altered them so they didn't. For example: in Print.pm -> sub write_gcode the following Gcode didn't check gcode_comments State
G90 G21 M83 M82

Also in GCode.pm -> sub set_temperature code M116 and also the following line in the same function.

my $gcode = sprintf "$code %s%d %s; $comment\n",
        ($Slic3r::Config->gcode_flavor eq 'mach3' ? 'P' : 'S'), $temperature,
        (defined $tool && $self->multiple_extruders) ? "T$tool " : "";
@alexrj

This comment has been minimized.

Show comment
Hide comment
@alexrj

alexrj Jan 17, 2013

Member

I just merged/implemented the Sailfish G-code flavor. I have some confusion about Makerbot firmwares and commands.

Does the Sailfish G-code flavor work for you too? If not, what firmware are you using and how does it differ from Sailfish? Isn't Sailfish the only recommended one from Makerbot at the time of writing?

Member

alexrj commented Jan 17, 2013

I just merged/implemented the Sailfish G-code flavor. I have some confusion about Makerbot firmwares and commands.

Does the Sailfish G-code flavor work for you too? If not, what firmware are you using and how does it differ from Sailfish? Isn't Sailfish the only recommended one from Makerbot at the time of writing?

@Opticalworm

This comment has been minimized.

Show comment
Hide comment
@Opticalworm

Opticalworm Jan 27, 2013

Just read through the changes on the Sailfish flavor. Everything looks good to me, however I will have to wait until tomorrow before I can test it. The only thing that is missing is the ability to disable all initialization made by slic3r. If your going to import the G-code from Slic3r into makerware to convert to the new .s3g, you need to make sure that there are now setup code becuase Makeware will be adding its on start and end gcode code.

Just read through the changes on the Sailfish flavor. Everything looks good to me, however I will have to wait until tomorrow before I can test it. The only thing that is missing is the ability to disable all initialization made by slic3r. If your going to import the G-code from Slic3r into makerware to convert to the new .s3g, you need to make sure that there are now setup code becuase Makeware will be adding its on start and end gcode code.

@funbart

This comment has been minimized.

Show comment
Hide comment
@funbart

funbart Feb 6, 2013

I would also like the possibility to disable the internal Gcode. (I'm using Sailfish).
Although Alexrj disagrees, IMO it's logical that when using own specific Gcode for start / layer / change you got all the edit possibilities without internal generated code.
This because when using the User toolchange gcode the result is a double Toolchange which is resulting in no toolchange at all (because of the firmware of the Replicator)
So when I use this:
M108 T0
M104 S220
M6 T0
G92 E0 (internal generated)
M108 T0 (internal generated)
I got NO toolchange.

I have to put a fake prime command in it to get it done. (or postprocess it)
M108 T0
M104 S220 T0
M6 T0
G92 E0
G1 E0.001 F1200
G92 E0 (internal generated)
M108 T0 (internal generated)
I got a toolchange.

About Makerware: I thought they will not only use A for E, but A for extruder T0 and B for extruder T1.
The commands for extruder change seem also to change (in the near future)

Bart

funbart commented Feb 6, 2013

I would also like the possibility to disable the internal Gcode. (I'm using Sailfish).
Although Alexrj disagrees, IMO it's logical that when using own specific Gcode for start / layer / change you got all the edit possibilities without internal generated code.
This because when using the User toolchange gcode the result is a double Toolchange which is resulting in no toolchange at all (because of the firmware of the Replicator)
So when I use this:
M108 T0
M104 S220
M6 T0
G92 E0 (internal generated)
M108 T0 (internal generated)
I got NO toolchange.

I have to put a fake prime command in it to get it done. (or postprocess it)
M108 T0
M104 S220 T0
M6 T0
G92 E0
G1 E0.001 F1200
G92 E0 (internal generated)
M108 T0 (internal generated)
I got a toolchange.

About Makerware: I thought they will not only use A for E, but A for extruder T0 and B for extruder T1.
The commands for extruder change seem also to change (in the near future)

Bart

@funbart

This comment has been minimized.

Show comment
Hide comment
@funbart

funbart Feb 8, 2013

In addition to the above: providing two Gcode fields for an extruder change (like Kisslicer) the problem would mostly be solved as well. One Gcode field before the extruder change, belonging to the previous extruder, Than the internal Gcode for a change and another part/gcode field belonging to the next-extruder.

extruderchange Gcode previous extruder >>
internal extruderchange Gcode >>
extruderchange Gcode next extruder

Bart

funbart commented Feb 8, 2013

In addition to the above: providing two Gcode fields for an extruder change (like Kisslicer) the problem would mostly be solved as well. One Gcode field before the extruder change, belonging to the previous extruder, Than the internal Gcode for a change and another part/gcode field belonging to the next-extruder.

extruderchange Gcode previous extruder >>
internal extruderchange Gcode >>
extruderchange Gcode next extruder

Bart

@alexrj

This comment has been minimized.

Show comment
Hide comment
@alexrj

alexrj Jun 3, 2013

Member

@funbart, @Opticalworm, I wrote a summary about the status of the makerbot and sailfish G-code flavors at the moment. It's in #1034. Let's continue there. I look forward for your feedback about what needs to be done.

Member

alexrj commented Jun 3, 2013

@funbart, @Opticalworm, I wrote a summary about the status of the makerbot and sailfish G-code flavors at the moment. It's in #1034. Let's continue there. I look forward for your feedback about what needs to be done.

@alexrj alexrj closed this Jun 3, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment