mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-09 23:59:00 +08:00
Merge pull request #3427 from lordofhyphens/repetier-flavor
Added Repetier FW flavor, fixed accel gcode generation for it.
This commit is contained in:
commit
ad9b985772
@ -134,7 +134,7 @@ The author of the Silk icon set is Mark James.
|
||||
(default: 100,100)
|
||||
--z-offset Additional height in mm to add to vertical coordinates
|
||||
(+/-, default: 0)
|
||||
--gcode-flavor The type of G-code to generate (reprap/teacup/makerware/sailfish/mach3/machinekit/smoothie/no-extrusion,
|
||||
--gcode-flavor The type of G-code to generate (reprap/teacup/repetier/makerware/sailfish/mach3/machinekit/smoothie/no-extrusion,
|
||||
default: reprap)
|
||||
--use-relative-e-distances Enable this to get relative E values (default: no)
|
||||
--use-firmware-retraction Enable firmware-controlled retraction using G10/G11 (default: no)
|
||||
|
@ -298,7 +298,7 @@ $j
|
||||
(default: 100,100)
|
||||
--z-offset Additional height in mm to add to vertical coordinates
|
||||
(+/-, default: $config->{z_offset})
|
||||
--gcode-flavor The type of G-code to generate (reprap/teacup/makerware/sailfish/mach3/machinekit/smoothie/no-extrusion,
|
||||
--gcode-flavor The type of G-code to generate (reprap/teacup/repetier/makerware/sailfish/mach3/machinekit/smoothie/no-extrusion,
|
||||
default: $config->{gcode_flavor})
|
||||
--use-relative-e-distances Enable this to get relative E values (default: no)
|
||||
--use-firmware-retraction Enable firmware-controlled retraction using G10/G11 (default: no)
|
||||
|
29
t/gcode.t
29
t/gcode.t
@ -1,4 +1,4 @@
|
||||
use Test::More tests => 23;
|
||||
use Test::More tests => 25;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
@ -215,4 +215,31 @@ use Slic3r::Test;
|
||||
ok !$spiral, 'spiral vase is correctly disabled on layers with multiple loops';
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
# Tests that the Repetier flavor produces M201 Xnnn Ynnn for resetting
|
||||
# acceleration, also that M204 Snnn syntax is not generated.
|
||||
my $config = Slic3r::Config->new_from_defaults;
|
||||
$config->set('gcode_flavor', 'repetier');
|
||||
$config->set('default_acceleration', 1337);
|
||||
my $print = Slic3r::Test::init_print('cube_with_hole', config => $config);
|
||||
|
||||
my $has_accel = 0;
|
||||
my $has_m204 = 0;
|
||||
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
|
||||
my ($self, $cmd, $args, $info) = @_;
|
||||
|
||||
if ($cmd eq 'M201' && exists $args->{X} && exists $args->{Y}) {
|
||||
if ($args->{X} == 1337 && $args->{Y} == 1337) {
|
||||
$has_accel = 1;
|
||||
}
|
||||
}
|
||||
if ($cmd eq 'M204' && exists $args->{S}) {
|
||||
$has_m204 = 1;
|
||||
}
|
||||
});
|
||||
ok $has_accel, 'M201 is generated for repetier firmware.';
|
||||
ok !$has_m204, 'M204 is not generated for repetier firmware';
|
||||
}
|
||||
|
||||
__END__
|
||||
|
@ -22,7 +22,7 @@ _arguments -S \
|
||||
'*--nozzle-diameter[specify nozzle diameter]:nozzle diameter in mm' \
|
||||
'--print-center[specify print center coordinates]:print center coordinates in mm,mm' \
|
||||
'--z-offset[specify Z-axis offset]:Z-axis offset in mm' \
|
||||
'--gcode-flavor[specify the type of G-code to generate]:G-code flavor:(reprap teacup makerware sailfish mach3 machinekit no-extrusion)' \
|
||||
'--gcode-flavor[specify the type of G-code to generate]:G-code flavor:(reprap teacup repetier makerware sailfish mach3 machinekit no-extrusion)' \
|
||||
'(--use-relative-e-distances --no-use-relative-e-distances)'--{no-,}use-relative-e-distances'[disable/enable relative E values]' \
|
||||
'--extrusion-axis[specify letter associated with the extrusion axis]:extrusion axis letter' \
|
||||
'(--gcode-arcs --no-gcode-arcs)'--{no-,}gcode-arcs'[disable/enable G2/G3 commands for native arcs]' \
|
||||
|
@ -54,7 +54,7 @@ GCodeWriter::preamble()
|
||||
gcode << "G21 ; set units to millimeters\n";
|
||||
gcode << "G90 ; use absolute coordinates\n";
|
||||
}
|
||||
if (FLAVOR_IS(gcfRepRap) || FLAVOR_IS(gcfTeacup) || FLAVOR_IS(gcfSmoothie)) {
|
||||
if (FLAVOR_IS(gcfRepRap) || FLAVOR_IS(gcfTeacup) || FLAVOR_IS(gcfRepetier) || FLAVOR_IS(gcfSmoothie)) {
|
||||
if (this->config.use_relative_e_distances) {
|
||||
gcode << "M83 ; use relative distances for extrusion\n";
|
||||
} else {
|
||||
@ -186,7 +186,14 @@ GCodeWriter::set_acceleration(unsigned int acceleration)
|
||||
this->_last_acceleration = acceleration;
|
||||
|
||||
std::ostringstream gcode;
|
||||
gcode << "M204 S" << acceleration;
|
||||
if (FLAVOR_IS(gcfRepetier)) {
|
||||
gcode << "M201 X" << acceleration << " Y" << acceleration;
|
||||
if (this->config.gcode_comments) gcode << " ; adjust acceleration";
|
||||
gcode << "\n";
|
||||
gcode << "M202 X" << acceleration << " Y" << acceleration;
|
||||
} else {
|
||||
gcode << "M204 S" << acceleration;
|
||||
}
|
||||
if (this->config.gcode_comments) gcode << " ; adjust acceleration";
|
||||
gcode << "\n";
|
||||
|
||||
|
@ -467,6 +467,7 @@ PrintConfigDef::PrintConfigDef()
|
||||
def->cli = "gcode-flavor=s";
|
||||
def->enum_keys_map = ConfigOptionEnum<GCodeFlavor>::get_enum_values();
|
||||
def->enum_values.push_back("reprap");
|
||||
def->enum_values.push_back("repetier");
|
||||
def->enum_values.push_back("teacup");
|
||||
def->enum_values.push_back("makerware");
|
||||
def->enum_values.push_back("sailfish");
|
||||
@ -474,7 +475,8 @@ PrintConfigDef::PrintConfigDef()
|
||||
def->enum_values.push_back("machinekit");
|
||||
def->enum_values.push_back("smoothie");
|
||||
def->enum_values.push_back("no-extrusion");
|
||||
def->enum_labels.push_back("RepRap (Marlin/Sprinter/Repetier)");
|
||||
def->enum_labels.push_back("RepRap (Marlin/Sprinter)");
|
||||
def->enum_labels.push_back("Repetier");
|
||||
def->enum_labels.push_back("Teacup");
|
||||
def->enum_labels.push_back("MakerWare (MakerBot)");
|
||||
def->enum_labels.push_back("Sailfish (MakerBot)");
|
||||
|
@ -26,7 +26,7 @@
|
||||
namespace Slic3r {
|
||||
|
||||
enum GCodeFlavor {
|
||||
gcfRepRap, gcfTeacup, gcfMakerWare, gcfSailfish, gcfMach3, gcfMachinekit, gcfNoExtrusion, gcfSmoothie,
|
||||
gcfRepRap, gcfTeacup, gcfMakerWare, gcfSailfish, gcfMach3, gcfMachinekit, gcfNoExtrusion, gcfSmoothie, gcfRepetier,
|
||||
};
|
||||
|
||||
enum InfillPattern {
|
||||
@ -45,6 +45,7 @@ enum SeamPosition {
|
||||
template<> inline t_config_enum_values ConfigOptionEnum<GCodeFlavor>::get_enum_values() {
|
||||
t_config_enum_values keys_map;
|
||||
keys_map["reprap"] = gcfRepRap;
|
||||
keys_map["repetier"] = gcfRepetier;
|
||||
keys_map["teacup"] = gcfTeacup;
|
||||
keys_map["makerware"] = gcfMakerWare;
|
||||
keys_map["sailfish"] = gcfSailfish;
|
||||
|
Loading…
x
Reference in New Issue
Block a user