Browse Source

- fixed the TclCommand cncjob to use the -outname parameter
- added some more keywords in the data_model for auto-completer

Marius Stanciu 6 years ago
parent
commit
8b3e1b5a77
5 changed files with 37 additions and 14 deletions
  1. 5 2
      FlatCAMApp.py
  2. 5 2
      FlatCAMObj.py
  3. 2 0
      README.md
  4. 20 6
      tclCommands/TclCommandCncjob.py
  5. 5 4
      tclCommands/TclCommandDrillcncjob.py

+ 5 - 2
FlatCAMApp.py

@@ -1905,7 +1905,7 @@ class App(QtCore.QObject):
 
         self.ordinary_keywords = ['all', 'angle_x', 'angle_y', 'axis', 'axisoffset', 'box', 'center_x', 'center_y',
                                   'columns', 'combine', 'connect', 'contour', 'depthperpass', 'dia', 'diatol', 'dist',
-                                  'drilled_dias', 'drillz',
+                                  'drilled_dias', 'drillz', 'pp',
                                   'endz', 'extracut', 'factor', 'False', 'false', 'feedrate', 'feedrate_rapid',
                                   'filename', 'follow', 'gaps', 'gapsize', 'grid', 'gridoffset', 'gridoffsetx',
                                   'gridoffsety', 'gridx', 'gridy', 'has_offset', 'holes', 'margin', 'method',
@@ -1914,7 +1914,10 @@ class App(QtCore.QObject):
                                   'overlap', 'passes', 'postamble', 'ppname_e', 'ppname_g', 'preamble', 'radius', 'ref',
                                   'rest', 'rows', 'scale_factor', 'spacing_columns', 'spacing_rows', 'spindlespeed',
                                   'toolchange', 'toolchangez', 'tooldia', 'tools', 'travelz', 'True', 'true', 'type',
-                                  'use_threads', 'value', 'x', 'x0', 'x1', 'y', 'y0', 'y1', 'z_cut', 'z_move'
+                                  'use_threads', 'value', 'x', 'x0', 'x1', 'y', 'y0', 'y1', 'z_cut', 'z_move',
+                                  'default', 'feedrate_z', 'grbl_11', 'grbl_laser', 'hpgl', 'line_xyz', 'marlin',
+                                  'Paste_1', 'Repetier', 'Toolchange_Custom', 'Roland_MDX_20', 'Toolchange_manual',
+                                  'Toolchange_Probe_MACH3', 'dwell', 'dwelltime', 'toolchange_xy'
                                   ]
 
         self.tcl_keywords = [

+ 5 - 2
FlatCAMObj.py

@@ -4518,7 +4518,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
             self.app.inform.emit('[ERROR_NOTCL] %s' %
                                  _("Failed. No tool selected in the tool table ..."))
 
-    def mtool_gen_cncjob(self, tools_dict=None, tools_in_use=None, segx=None, segy=None, use_thread=True):
+    def mtool_gen_cncjob(self, outname=None, tools_dict=None, tools_in_use=None, segx=None, segy=None, use_thread=True):
         """
         Creates a multi-tool CNCJob out of this Geometry object.
         The actual work is done by the target FlatCAMCNCjob object's
@@ -4537,7 +4537,10 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         """
 
         # use the name of the first tool selected in self.geo_tools_table which has the diameter passed as tool_dia
-        outname = "%s_%s" % (self.options["name"], 'cnc')
+        if outname is None:
+            outname = "%s_%s" % (self.options["name"], 'cnc')
+        else:
+            outname = outname
 
         tools_dict = self.sel_tools if tools_dict is None else tools_dict
         tools_in_use = tools_in_use if tools_in_use is not None else self.get_selected_tools_table_items()

+ 2 - 0
README.md

@@ -17,6 +17,8 @@ CAD program, and create G-Code for Isolation routing.
 - fixed issue in ToolPaint that could not allow area painting of a geometry that was a list and not a Geometric element (polygon or MultiPolygon)
 - fixed UI showing before the initialization of FlatCAM is finished when the last state of GUI was maximized
 - finished updating the TclCommand cncjob to work for multi-geo Geometry objects with the parameters from the args
+- fixed the TclCommand cncjob to use the -outname parameter
+- added some more keywords in the data_model for auto-completer
 
 14.09.2019
 

+ 20 - 6
tclCommands/TclCommandCncjob.py

@@ -41,7 +41,7 @@ class TclCommandCncjob(TclCommandSignaled):
         ('spindlespeed', int),
         ('dwell', bool),
         ('dwelltime', float),
-        ('ppname_g', str),
+        ('pp', str),
         ('outname', str)
     ])
 
@@ -71,7 +71,7 @@ class TclCommandCncjob(TclCommandSignaled):
             ('dwell', 'True or False; use (or not) the dwell'),
             ('dwelltime', 'Time to pause to allow the spindle to reach the full speed'),
             ('outname', 'Name of the resulting Geometry object.'),
-            ('ppname_g', 'Name of the Geometry postprocessor. No quotes, case sensitive')
+            ('pp', 'Name of the Geometry postprocessor. No quotes, case sensitive')
         ]),
         'examples': ['cncjob geo_name -tooldia 0.5 -z_cut -1.7 -z_move 2 -feedrate 120 -ppname_g default']
     }
@@ -92,6 +92,7 @@ class TclCommandCncjob(TclCommandSignaled):
             args['outname'] = str(name) + "_cnc"
 
         obj = self.app.collection.get_by_name(str(name), isCaseSensitive=False)
+
         if obj is None:
             self.raise_tcl_error("Object not found: %s" % str(name))
 
@@ -119,7 +120,7 @@ class TclCommandCncjob(TclCommandSignaled):
         args["dwell"] = args["dwell"] if "dwell" in args else obj.options["dwell"]
         args["dwelltime"] = args["dwelltime"] if "dwelltime" in args else obj.options["dwelltime"]
 
-        args["ppname_g"] = args["ppname_g"] if "ppname_g" in args else obj.options["ppname_g"]
+        args["pp"] = args["pp"] if "pp" in args else obj.options["ppname_g"]
 
         args["toolchange"] = True if "toolchange" in args and args["toolchange"] == 1 else False
         args["toolchangez"] = args["toolchangez"] if "toolchangez" in args else obj.options["toolchangez"]
@@ -128,9 +129,19 @@ class TclCommandCncjob(TclCommandSignaled):
 
         del args['name']
 
+        for arg in args:
+            if arg == "toolchange_xy" or arg == "spindlespeed":
+                continue
+            else:
+                if args[arg] is None:
+                    self.raise_tcl_error('One of the command parameters that have to be not None, is None.\n'
+                                         'The parameter that is None is in the default values found in the list \n'
+                                         'generated by the TclCommand "list_sys geom". or in the arguments.')
+
         # HACK !!! Should be solved elsewhere!!!
         # default option for multidepth is False
         obj.options['multidepth'] = False
+
         if not obj.multigeo:
             obj.generatecncjob(use_thread=False, **args)
         else:
@@ -155,7 +166,10 @@ class TclCommandCncjob(TclCommandSignaled):
                     local_tools_dict[tool_uid]['data']['spindlespeed'] = args["spindlespeed"]
                     local_tools_dict[tool_uid]['data']['dwell'] = args["dwell"]
                     local_tools_dict[tool_uid]['data']['dwelltime'] = args["dwelltime"]
-                    local_tools_dict[tool_uid]['data']['ppname_g'] = args["ppname_g"]
-                    print(local_tools_dict[tool_uid]['data'])
-            obj.mtool_gen_cncjob(tools_dict=local_tools_dict, tools_in_use=[], use_thread=False)
+                    local_tools_dict[tool_uid]['data']['ppname_g'] = args["pp"]
+            obj.mtool_gen_cncjob(
+                outname=args['outname'],
+                tools_dict=local_tools_dict,
+                tools_in_use=[],
+                use_thread=False)
             # self.raise_tcl_error('The object is a multi-geo geometry which is not supported in cncjob Tcl Command')

+ 5 - 4
tclCommands/TclCommandDrillcncjob.py

@@ -1,6 +1,7 @@
 from ObjectCollection import *
 from tclCommands.TclCommand import TclCommandSignaled
 
+
 class TclCommandDrillcncjob(TclCommandSignaled):
     """
     Tcl shell command to Generates a Drill CNC Job from a Excellon Object.
@@ -27,7 +28,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
         ('toolchangez', float),
         ('toolchangexy', tuple),
         ('endz', float),
-        ('ppname_e', str),
+        ('pp', str),
         ('outname', str),
         ('opt_type', str),
         ('diatol', float)
@@ -52,7 +53,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
             ('toolchangez', 'Z distance for toolchange (example: 30.0).'),
             ('toolchangexy', 'X, Y coordonates for toolchange in format (x, y) (example: (2.0, 3.1) ).'),
             ('endz', 'Z distance at job end (example: 30.0).'),
-            ('ppname_e', 'This is the Excellon postprocessor name: case_sensitive, no_quotes'),
+            ('pp', 'This is the Excellon postprocessor name: case_sensitive, no_quotes'),
             ('outname', 'Name of the resulting Geometry object.'),
             ('opt_type', 'Name of move optimization type. B by default for Basic OR-Tools, M for Metaheuristic OR-Tools'
                          'T from Travelling Salesman Algorithm. B and M works only for 64bit version of FlatCAM and '
@@ -64,7 +65,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
                        'in Excellon will be processed. Float number.')
         ]),
         'examples': ['drillcncjob test.TXT -drillz -1.5 -travelz 14 -feedrate 222 -feedrate_rapid 456 -spindlespeed 777'
-                     ' -toolchange True -toolchangez 33 -endz 22 -ppname_e default\n'
+                     ' -toolchange True -toolchangez 33 -endz 22 -pp default\n'
                      'Usage of -feedrate_rapid matter only when the posptocessor is using it, like -marlin-.']
     }
 
@@ -157,7 +158,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
                 if "feedrate_rapid" in args else obj.options["feedrate_rapid"]
 
             job_obj.spindlespeed = args["spindlespeed"] if "spindlespeed" in args else None
-            job_obj.pp_excellon_name = args["ppname_e"] if "ppname_e" in args \
+            job_obj.pp_excellon_name = args["pp"] if "pp" in args \
                 else obj.options["ppname_e"]
 
             job_obj.coords_decimals = int(self.app.defaults["cncjob_coords_decimals"])