From d35226b889f5e51f928ce4adb088c2bac7c6d817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20R=C3=B6ssler?= Date: Wed, 7 Jan 2015 21:20:58 +0100 Subject: [PATCH] added support Machinekit flavour GCode --- README.md | 6 +++--- slic3r.pl | 2 +- utils/zsh/functions/_slic3r | 2 +- xs/src/libslic3r/PrintConfig.cpp | 2 ++ xs/src/libslic3r/PrintConfig.hpp | 5 +++-- xs/t/15_config.t | 4 +++- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ee97e5b65..7095f56e2 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Slic3r [![Build Status](https://travis-ci.org/alexrj/Slic3r.png?branch=master)]( Slic3r takes 3D models (STL, OBJ, AMF) and converts them into G-code instructions for 3D printers. It's compatible with any modern printer based on the RepRap toolchain, including all those based on the Marlin, Sprinter and Repetier firmware. It also works -with Mach3 and LinuxCNC controllers. +with Mach3, LinuxCNC and Machinekit controllers. See the [project homepage](http://slic3r.org/) at slic3r.org and the [manual](http://manual.slic3r.org/) for more information. @@ -30,7 +30,7 @@ Key features are: * **multi-platform** (Linux/Mac/Win) and packaged as standalone-app with no dependencies required * complete **command-line interface** to use it with no GUI * multi-material **(multiple extruders)** object printing -* multiple G-code flavors supported (RepRap, Makerbot, Mach3 etc.) +* multiple G-code flavors supported (RepRap, Makerbot, Mach3, Machinekit etc.) * ability to plate **multiple objects having distinct print settings** * **multithread** processing * **STL auto-repair** (tolerance for broken models) @@ -130,7 +130,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/no-extrusion, + --gcode-flavor The type of G-code to generate (reprap/teacup/makerware/sailfish/mach3/machinekit/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) diff --git a/slic3r.pl b/slic3r.pl index 84590b197..810d61bf3 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -282,7 +282,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/no-extrusion, + --gcode-flavor The type of G-code to generate (reprap/teacup/makerware/sailfish/mach3/machinekit/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) diff --git a/utils/zsh/functions/_slic3r b/utils/zsh/functions/_slic3r index 41a36963f..df1cecb03 100644 --- a/utils/zsh/functions/_slic3r +++ b/utils/zsh/functions/_slic3r @@ -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 no-extrusion)' \ + '--gcode-flavor[specify the type of G-code to generate]:G-code flavor:(reprap teacup 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]' \ diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index c7afe9fbc..f11d64dc2 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -380,12 +380,14 @@ PrintConfigDef::build_def() { Options["gcode_flavor"].enum_values.push_back("makerware"); Options["gcode_flavor"].enum_values.push_back("sailfish"); Options["gcode_flavor"].enum_values.push_back("mach3"); + Options["gcode_flavor"].enum_values.push_back("machinekit"); Options["gcode_flavor"].enum_values.push_back("no-extrusion"); Options["gcode_flavor"].enum_labels.push_back("RepRap (Marlin/Sprinter/Repetier)"); Options["gcode_flavor"].enum_labels.push_back("Teacup"); Options["gcode_flavor"].enum_labels.push_back("MakerWare (MakerBot)"); Options["gcode_flavor"].enum_labels.push_back("Sailfish (MakerBot)"); Options["gcode_flavor"].enum_labels.push_back("Mach3/LinuxCNC"); + Options["gcode_flavor"].enum_labels.push_back("Machinekit"); Options["gcode_flavor"].enum_labels.push_back("No extrusion"); Options["infill_acceleration"].type = coFloat; diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index 19ae75928..869ae5caa 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -6,7 +6,7 @@ namespace Slic3r { enum GCodeFlavor { - gcfRepRap, gcfTeacup, gcfMakerWare, gcfSailfish, gcfMach3, gcfNoExtrusion, + gcfRepRap, gcfTeacup, gcfMakerWare, gcfSailfish, gcfMach3, gcfMachinekit, gcfNoExtrusion, }; enum InfillPattern { @@ -29,6 +29,7 @@ template<> inline t_config_enum_values ConfigOptionEnum::get_enum_v keys_map["makerware"] = gcfMakerWare; keys_map["sailfish"] = gcfSailfish; keys_map["mach3"] = gcfMach3; + keys_map["machinekit"] = gcfMachinekit; keys_map["no-extrusion"] = gcfNoExtrusion; return keys_map; } @@ -410,7 +411,7 @@ class GCodeConfig : public virtual StaticPrintConfig std::string get_extrusion_axis() const { - if (this->gcode_flavor.value == gcfMach3) { + if ((this->gcode_flavor.value == gcfMach3) || (this->gcode_flavor.value == gcfMachinekit)) { return "A"; } else if (this->gcode_flavor.value == gcfNoExtrusion) { return ""; diff --git a/xs/t/15_config.t b/xs/t/15_config.t index e051d9a86..43bfe501c 100644 --- a/xs/t/15_config.t +++ b/xs/t/15_config.t @@ -4,7 +4,7 @@ use strict; use warnings; use Slic3r::XS; -use Test::More tests => 108; +use Test::More tests => 110; foreach my $config (Slic3r::Config->new, Slic3r::Config::Full->new) { $config->set('layer_height', 0.3); @@ -51,6 +51,8 @@ foreach my $config (Slic3r::Config->new, Slic3r::Config::Full->new) { is $config->serialize('gcode_flavor'), 'teacup', 'serialize enum'; $config->set_deserialize('gcode_flavor', 'mach3'); is $config->get('gcode_flavor'), 'mach3', 'deserialize enum (gcode_flavor)'; + $config->set_deserialize('gcode_flavor', 'machinekit'); + is $config->get('gcode_flavor'), 'machinekit', 'deserialize enum (gcode_flavor)'; $config->set_deserialize('fill_pattern', 'line'); is $config->get('fill_pattern'), 'line', 'deserialize enum (fill_pattern)';