Преглед изворни кода

- fixed the HPGL code geometry rendering when travel
- fixed the message box layout when asking to save the current work
- made sure that whenever the HPGL postprocessor is selected the Toolchange is always ON and the MultiDepth is OFF
- the HPGL postprocessor entry is not allowed in Excellon Object postprocessor selection combobox as it is only applicable for Geometry

Marius Stanciu пре 7 година
родитељ
комит
7ea6ee4a85
5 измењених фајлова са 56 додато и 14 уклоњено
  1. 10 10
      FlatCAMApp.py
  2. 29 2
      FlatCAMObj.py
  3. 2 2
      ObjectUI.py
  4. 7 0
      README.md
  5. 8 0
      camlib.py

+ 10 - 10
FlatCAMApp.py

@@ -88,7 +88,7 @@ class App(QtCore.QObject):
 
     # Version
     version = 8.902
-    version_date = "2019/01/19"
+    version_date = "2019/01/20"
     beta = True
 
     # URL for update checks and statistics
@@ -2093,9 +2093,9 @@ class App(QtCore.QObject):
         if self.collection.get_list():
             msgbox = QtWidgets.QMessageBox()
             # msgbox.setText("<B>Save changes ...</B>")
-            msgbox.setInformativeText("There are files/objects opened in FlatCAM. "
-                                      "\n\n"
-                                      "Do you want to Save the project?")
+            msgbox.setText("There are files/objects opened in FlatCAM. "
+                           "\n"
+                           "Do you want to Save the project?")
             msgbox.setWindowTitle("Save changes")
             msgbox.setWindowIcon(QtGui.QIcon('share/save_as.png'))
             msgbox.setStandardButtons(QtWidgets.QMessageBox.Cancel | QtWidgets.QMessageBox.Ok)
@@ -2229,9 +2229,9 @@ class App(QtCore.QObject):
         if self.collection.get_list():
             msgbox = QtWidgets.QMessageBox()
             # msgbox.setText("<B>Save changes ...</B>")
-            msgbox.setInformativeText("There are files/objects opened in FlatCAM. "
-                                      "\n\n"
-                                      "Do you want to Save the project?")
+            msgbox.setText("There are files/objects opened in FlatCAM. "
+                           "\n"
+                           "Do you want to Save the project?")
             msgbox.setWindowTitle("Save changes")
             msgbox.setWindowIcon(QtGui.QIcon('share/save_as.png'))
             msgbox.setStandardButtons(QtWidgets.QMessageBox.Cancel | QtWidgets.QMessageBox.Ok)
@@ -3962,9 +3962,9 @@ class App(QtCore.QObject):
         if self.collection.get_list():
             msgbox = QtWidgets.QMessageBox()
             # msgbox.setText("<B>Save changes ...</B>")
-            msgbox.setInformativeText("There are files/objects opened in FlatCAM. "
-                                      "Creating a New project will delete them.\n\n"
-                                      "Do you want to Save the project?")
+            msgbox.setText("There are files/objects opened in FlatCAM.\n"
+                           "Creating a New project will delete them.\n"
+                           "Do you want to Save the project?")
             msgbox.setWindowTitle("Save changes")
             msgbox.setWindowIcon(QtGui.QIcon('share/save_as.png'))
             msgbox.setStandardButtons(QtWidgets.QMessageBox.Cancel | QtWidgets.QMessageBox.Ok)

+ 29 - 2
FlatCAMObj.py

@@ -1134,6 +1134,9 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
         })
 
         for name in list(self.app.postprocessors.keys()):
+            # the HPGL postprocessor is only for Geometry not for Excellon job therefore don't add it
+            if name == 'hpgl':
+                continue
             self.ui.pp_excellon_name_cb.addItem(name)
 
         # Fill form fields
@@ -2104,8 +2107,13 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         self.ui.tool_offset_entry.hide()
         self.ui.tool_offset_lbl.hide()
 
-        assert isinstance(self.ui, GeometryObjectUI), \
-            "Expected a GeometryObjectUI, got %s" % type(self.ui)
+        # used to store the state of the mpass_cb if the selected postproc for geometry is hpgl
+        self.old_pp_state = self.default_data['multidepth']
+        self.old_toolchangeg_state = self.default_data['toolchange']
+
+        if not isinstance(self.ui, GeometryObjectUI):
+            log.debug("Expected a GeometryObjectUI, got %s" % type(self.ui))
+            return
 
         self.ui.geo_tools_table.setupContextMenu()
         self.ui.geo_tools_table.addContextMenu(
@@ -2116,6 +2124,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         self.ui.plot_cb.stateChanged.connect(self.on_plot_cb_click)
         self.ui.generate_cnc_button.clicked.connect(self.on_generatecnc_button_click)
         self.ui.paint_tool_button.clicked.connect(self.app.paint_tool.run)
+        self.ui.pp_geometry_name_cb.activated.connect(self.on_pp_changed)
 
     def set_tool_offset_visibility(self, current_row):
         if current_row is None:
@@ -2793,6 +2802,24 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
             item[0] = str(item[0])
         return table_tools_items
 
+    def on_pp_changed(self):
+        current_pp = self.ui.pp_geometry_name_cb.get_value()
+        if current_pp == 'hpgl':
+            self.old_pp_state = self.ui.mpass_cb.get_value()
+            self.old_toolchangeg_state = self.ui.toolchangeg_cb.get_value()
+
+            self.ui.mpass_cb.set_value(False)
+            self.ui.mpass_cb.setDisabled(True)
+
+            self.ui.toolchangeg_cb.set_value(True)
+            self.ui.toolchangeg_cb.setDisabled(True)
+        else:
+            self.ui.mpass_cb.set_value(self.old_pp_state)
+            self.ui.mpass_cb.setDisabled(False)
+
+            self.ui.toolchangeg_cb.set_value(self.old_toolchangeg_state)
+            self.ui.toolchangeg_cb.setDisabled(False)
+
     def on_generatecnc_button_click(self, *args):
 
         self.app.report_usage("geometry_on_generatecnc_button")

+ 2 - 2
ObjectUI.py

@@ -882,7 +882,7 @@ class GeometryObjectUI(ObjectUI):
         self.toolchangeg_cb = FCCheckBox("Tool change")
         self.toolchangeg_cb.setToolTip(
             "Include tool-change sequence\n"
-            "in G-Code (Pause for tool change)."
+            "in the Machine Code (Pause for tool change)."
         )
         self.toolchangez_entry = LengthEntry()
 
@@ -982,7 +982,7 @@ class GeometryObjectUI(ObjectUI):
         pp_label = QtWidgets.QLabel("PostProcessor:")
         pp_label.setToolTip(
             "The Postprocessor file that dictates\n"
-            "Gcode output."
+            "the Machine Code (like GCode, RML, HPGL) output."
         )
         self.grid3.addWidget(pp_label, 16, 0)
         self.pp_geometry_name_cb = FCComboBox()

+ 7 - 0
README.md

@@ -9,6 +9,13 @@ CAD program, and create G-Code for Isolation routing.
 
 =================================================
 
+20.01.2019
+
+- fixed the HPGL code geometry rendering when travel
+- fixed the message box layout when asking to save the current work
+- made sure that whenever the HPGL postprocessor is selected the Toolchange is always ON and the MultiDepth is OFF
+- the HPGL postprocessor entry is not allowed in Excellon Object postprocessor selection combobox as it is only applicable for Geometry
+
 19.01.2019
 
 - added initial implementation of HPGL postprocessor

+ 8 - 0
camlib.py

@@ -5218,6 +5218,14 @@ class CNCjob(Geometry):
                 command['G'] = 0
                 command['X'] = float(match_pa.group(1).replace(" ", ""))
                 command['Y'] = float(match_pa.group(2).replace(" ", ""))
+            match_pen = re.search(r"^(P[U|D])", gline)
+            if match_pen:
+                if match_pen.group(1) == 'PU':
+                    # the value does not matter, only that it is positive so the gcode_parse() know it is > 0,
+                    # therefore the move is of kind T (travel)
+                    command['Z'] = 1
+                else:
+                    command['Z'] = 0
 
         else:
             match = re.search(r'^\s*([A-Z])\s*([\+\-\.\d\s]+)', gline)