TCL Commands - cncjob & mirror

Issue #416 resolved
Daniel Friderich created an issue

Hi,

I have 2 issues with TCL command `cncjob` and 1 issue with `mirror`.

  1. `cncjob`requieres -dpp to be set
> cncjob iso-front -outname test-output
ERROR: 'DPP'
PYTHON TRACEBACK: <CLASS 'KEYERROR'>
  FILE "/USERS/DANIEL/APPLICATIONS/FLATCAM/TCLCOMMANDS/TCLCOMMANDCNCJOB.PY", LINE 227, IN EXECUTE > LOCAL_TOOLS_DICT[TOOL_UID]['data']['depthperpass'] = args["dpp"]
  File "/Users/daniel/Applications/flatcam/tclCommands/TclCommand.py", line 344, in execute_call > self.output = self.execute(args, unnamed_args)
    while executing
"cncjob iso-front -outname test-output"

> cncjob iso-front -dpp 10 -outname test-output
Indexing geometry before generating G-Code...
Starting G-Code...
Starting G-Code for tool with diameter: 0.2MM.
Finished G-Code generation... 72  paths traced.
[SUCCESS] G-Code parsing in progress...
Parsing GCode file. Number of lines: 18310
Creating Geometry from the parsed GCode file. ...
[SUCCESS] G-Code parsing finished...
[SUCCESS] Finished G-Code processing...

2. Running `cncjob` with -dpp set, so that it will do multiple passes fails

> cncjob cutout-edge -z_cut -1.0 -dpp 0.4 -outname cnc-test
ERROR: generatecncjob() got an unexpected keyword argument 'dpp'
Python traceback: <class 'TypeError'>
  File "/Users/daniel/Applications/flatcam/tclCommands/TclCommandCncjob.py", line 207, in execute > obj.generatecncjob(use_thread=False, plot=False, **args)
  File "/Users/daniel/Applications/flatcam/tclCommands/TclCommand.py", line 344, in execute_call > self.output = self.execute(args, unnamed_args)
    while executing
"cncjob cutout-edge -z_cut -1.0 -dpp 0.4 -outname cnc-test"

3. `mirror` doesn’t do anything but doesn’t fail

> mirror back -origin (0,0) -axis Y
[SUCCESS] Gerber Mirror done.

I have attached the FlatCAM Project on which I ran these commands. I am running on current Beta, commit 1b8ed46f91be185c5b175cce31130140abfe9a89.

Comments (5)

  1. Marius Stanciu

    Hi Daniel,

    Beta branch is for development. I tried lately not to push the updates there because some people use it and then cried that some things were broken but I started to do it again due of having other people working on it.

    Yet, the issues you mentioned are also in the 8.992 version which is the current version.
    I fixed the issues 1 and 2 and pushed the changes to the Beta repo. But understand that there may be breaking changes in the near future, especially on the Gerber object.

    But the 3 is not an issue, it works as it was supposed to.
    Due of having the Gerber file centered in (0,0) it might be harder to see the change if the object is symmetric. And to see anything you need to also use the plot_objects command (or the more expensive plot_all Tcl command).

    No Tcl command is making changes (at least it is not supposed to) to the plot area unless the user do it by issuing the plot_all command or plot_objects obj command.

  2. Daniel Friderich reporter

    Hi Marius,

    Thank you for your quick response 🙂 My bad for not clearly communicating that I had these issues for 8.992 as well and only then upgraded to the latest commit to see if it was fixed already.

    Regarding 3.: I was unaware that tcl commands don't replot objects that are changed in place (like mirror does). It works as described.

    Regarding 1. and 2.: cncjob is fixed. Thank you!

    I think with your changes to drillcncjob you introduced a new bug (at least for me running commit 853b3a8):

    4. drillcncjob fails to read default value if -endxy is not set

    > drillcncjob alignment -drillz -4 -outname cnc-alignment
    [ERROR] An internal error has occurred. See shell.
    Object (cncjob) failed because: tuple index out of range 
    
    Traceback (most recent call last):
      File "/Users/daniel/Applications/flatcam/FlatCAMApp.py", line 2819, in new_object
        return_value = initialize(obj, self)
      File "/Users/daniel/Applications/flatcam/tclCommands/TclCommandDrillcncjob.py", line 246, in job_init
        xy_end = ','.join([xy_end[0], xy_end[2]])
    IndexError: tuple index out of range
    
    
    > drillcncjob alignment -drillz -4 -outname cnc-alignment -endxy 0,0
    Creating a list of points to drill...
    Starting G-Code...
    Starting G-Code for tool with diameter: 1.0MM.
    Finished G-Code generation...
    Parsing GCode file. Number of lines: 39
    Creating Geometry from the parsed GCode file. ...
    Unifying Geometry from parsed Geometry segments: 9
    

  3. Marius Stanciu

    Thanks,
    Fixed that one too.
    BTW, the copper clear (and maybe the “paint”) capabilities are compromised in the current version and not fixed yet.

    LE:

    I was unaware that tcl commands don't replot objects that are changed in place

    Not only in place. All commands do not plot by default. All require the user to issue a plot_objects or plot_all command in order for the result(s) to be plotted on canvas.
    Some people my want to use the app headless and plotting will crash things in this case. I don’t really support this headless thing but that’s one allowance I am willing to do.

  4. Log in to comment