From 435648171e07369c164eef8ff7c26bc179b14d55 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 16 Dec 2019 19:56:24 +0200 Subject: [PATCH] - fixed the HPGL preprocessor --- README.md | 6 ++++-- flatcamGUI/ObjectUI.py | 2 +- flatcamGUI/PreferencesUI.py | 4 ++-- preprocessors/hpgl.py | 15 +++++++++++++-- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6e866276..96092fd3 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,13 @@ CAD program, and create G-Code for Isolation routing. - in Geometry Editor added support for Jump To function such as that it works within the Editor Tools themselves. For now it works only in absolute jumps - modified the Jump To method such that now allows relative jump from the current mouse location -- fixed the Defaults upgrade overwrting the new version number with the old one +- fixed the Defaults upgrade overwriting the new version number with the old one - fixed issue with clear_polygon3() - the one who makes 'lines' and fixed the NCC Tool -- some small changes in the FlatCAMGeoemtry.on_tool_add() method +- some small changes in the FlatCAMGeometry.on_tool_add() method - made sure that in Geometry Editor the self.app.mouse attribute is updated with the current mouse position (x, y) - updated the preprocessor files +- fixed the HPGL preprocessor + 15.12.2019 diff --git a/flatcamGUI/ObjectUI.py b/flatcamGUI/ObjectUI.py index edbf15a6..c5df313d 100644 --- a/flatcamGUI/ObjectUI.py +++ b/flatcamGUI/ObjectUI.py @@ -883,7 +883,7 @@ class ExcellonObjectUI(ObjectUI): self.ois_tcz_e = OptionalInputSection(self.toolchange_cb, [self.toolchangez_entry]) # Start move Z: - self.estartz_label = QtWidgets.QLabel('%s:' % _("Start move Z")) + self.estartz_label = QtWidgets.QLabel('%s:' % _("Start Z")) self.estartz_label.setToolTip( _("Height of the tool just after start.\n" "Delete the value if you don't need this feature.") diff --git a/flatcamGUI/PreferencesUI.py b/flatcamGUI/PreferencesUI.py index dc0c4e1d..4e1c1c28 100644 --- a/flatcamGUI/PreferencesUI.py +++ b/flatcamGUI/PreferencesUI.py @@ -2584,7 +2584,7 @@ class ExcellonAdvOptPrefGroupUI(OptionsGroupUI): self.toolchangexy_entry = FCEntry() grid1.addWidget(self.toolchangexy_entry, 1, 1) - startzlabel = QtWidgets.QLabel('%s:' % _('Start move Z')) + startzlabel = QtWidgets.QLabel('%s:' % _('Start Z')) startzlabel.setToolTip( _("Height of the tool just after start.\n" "Delete the value if you don't need this feature.") @@ -3429,7 +3429,7 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI): grid1.addWidget(self.toolchangexy_entry, 1, 1) # Start move Z - startzlabel = QtWidgets.QLabel('%s:' % _('Start move Z')) + startzlabel = QtWidgets.QLabel('%s:' % _('Start Z')) startzlabel.setToolTip( _("Height of the tool just after starting the work.\n" "Delete the value if you don't need this feature.") diff --git a/preprocessors/hpgl.py b/preprocessors/hpgl.py index 53e6176a..013e62f1 100644 --- a/preprocessors/hpgl.py +++ b/preprocessors/hpgl.py @@ -49,8 +49,19 @@ class hpgl(FlatCAMPostProc): y = p.y # we need to have the coordinates as multiples of 0.025mm - x = round(x / 0.025) * 25 / 1000 - y = round(y / 0.025) * 25 / 1000 + x = round(x * 40) + y = round(y * 40) + + # constrain the x and y values within the domain of valid values: [-32767 ... 32768] + if x <= -32767: + x = -32767 + if x >= 32768: + x = 32768 + + if y <= -32767: + y = -32767 + if y >= 32768: + y = 32768 return ('PA' + self.coordinate_format + ',' + self.coordinate_format + ';') % \ (p.coords_decimals, x, p.coords_decimals, y)