diff options
Diffstat (limited to 'PyArcWelder/py_arc_welder_extension.h')
-rw-r--r-- | PyArcWelder/py_arc_welder_extension.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/PyArcWelder/py_arc_welder_extension.h b/PyArcWelder/py_arc_welder_extension.h new file mode 100644 index 0000000..7a3786d --- /dev/null +++ b/PyArcWelder/py_arc_welder_extension.h @@ -0,0 +1,78 @@ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Arc Welder: Anti-Stutter Python Extension for the OctoPrint Arc Welder plugin. +// +// Compresses many G0/G1 commands into G2/G3(arc) commands where possible, ensuring the tool paths stay within the specified resolution. +// This reduces file size and the number of gcodes per second. +// +// Copyright(C) 2020 - Brad Hochgesang +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// This program is free software : you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the +// GNU Affero General Public License for more details. +// +// +// You can contact the author at the following email address: +// FormerLurker@pm.me +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma once +#ifdef _DEBUG +#undef _DEBUG +#include <Python.h> +#define _DEBUG +#else +#include <Python.h> +#endif +#include <string> +#include "py_logger.h" +extern "C" +{ +#if PY_MAJOR_VERSION >= 3 + PyMODINIT_FUNC PyInit_PyGcodeArcConverter(void); +#else + extern "C" void initPyGcodeArcConverter(void); +#endif + static PyObject* ConvertFile(PyObject* self, PyObject* args); +} + +struct py_gcode_arc_args { + py_gcode_arc_args() { + source_file_path = ""; + target_file_path = ""; + resolution_mm = 0.05; + g90_g91_influences_extruder = false; + log_level = 0; + } + py_gcode_arc_args(std::string source_file_path_, std::string target_file_path_, double resolution_mm_, bool g90_g91_influences_extruder_, int log_level_) { + source_file_path = source_file_path_; + target_file_path = target_file_path_; + resolution_mm = resolution_mm_; + g90_g91_influences_extruder = g90_g91_influences_extruder_; + log_level = log_level_; + } + std::string source_file_path; + std::string target_file_path; + double resolution_mm; + bool g90_g91_influences_extruder; + int log_level; +}; + +static bool ParseArgs(PyObject* py_args, py_gcode_arc_args& args, PyObject** p_py_progress_callback); + +// global logger +py_logger* p_py_logger = NULL; +/* +static void AtExit() +{ + if (p_py_logger != NULL) delete p_py_logger; +}*/ + + + + + |