From 046c555c9ee99a84d9b07cb2917c8430e4fbfee6 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Wed, 24 Apr 2024 21:35:12 -0500 Subject: [PATCH] add generic post processor --- src/Mod/CAM/CMakeLists.txt | 1 + src/Mod/CAM/Path/Post/scripts/generic_post.py | 87 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 src/Mod/CAM/Path/Post/scripts/generic_post.py diff --git a/src/Mod/CAM/CMakeLists.txt b/src/Mod/CAM/CMakeLists.txt index f60574ded5..7126118b91 100644 --- a/src/Mod/CAM/CMakeLists.txt +++ b/src/Mod/CAM/CMakeLists.txt @@ -140,6 +140,7 @@ SET(PathPythonPostScripts_SRCS Path/Post/scripts/fanuc_post.py Path/Post/scripts/fangling_post.py Path/Post/scripts/gcode_pre.py + Path/Post/scripts/generic_post.py Path/Post/scripts/grbl_post.py Path/Post/scripts/heidenhain_post.py Path/Post/scripts/jtech_post.py diff --git a/src/Mod/CAM/Path/Post/scripts/generic_post.py b/src/Mod/CAM/Path/Post/scripts/generic_post.py new file mode 100644 index 0000000000..8b4ec2482a --- /dev/null +++ b/src/Mod/CAM/Path/Post/scripts/generic_post.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +# *************************************************************************** +# * Copyright (c) 2024 Ondsel * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * 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 Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +import os +from Path.Post.Processor import PostProcessor +import Path +import FreeCAD + +Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule()) + +translate = FreeCAD.Qt.translate + +debug = True +if debug: + Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule()) + Path.Log.trackModule(Path.Log.thisModule()) +else: + Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule()) + + +class Generic(PostProcessor): + def __init__(self, job): + super().__init__( + job, + tooltip=translate("CAM", "Generic post processor"), + tooltipargs=["arg1", "arg2"], + units="kg", + ) + Path.Log.debug("Generic post processor initialized") + + def export(self): + Path.Log.debug("Exporting the job") + + postables = self._buildPostList() + Path.Log.debug(f"postables count: {len(postables)}") + + g_code_sections = [] + for idx, section in enumerate(postables): + partname, sublist = section + + # here is where the sections are converted to gcode. + g_code_sections.append((idx, partname)) + + return g_code_sections + + @property + def tooltip(self): + + tooltip = """ + This is a generic post processor. + It doesn't do anything yet because we haven't immplemented it. + + Implementing it would be a good idea + """ + return tooltip + + @property + def tooltipArgs(self): + argtooltip = """ + --arg1: This is the first argument + --arg2: This is the second argument + + """ + return argtooltip + + @property + def units(self): + return self._units