multiple breakage in output file naming.

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
freman
Veteran
Posts: 2200
Joined: Tue Nov 27, 2018 10:30 pm

multiple breakage in output file naming.

Post by freman »

Hi,

recent master is showing multiple defects in naming GCODE output file.

1. cancelling file save dlg throws about ten lines of red letter errors in report view.
2. hover hint inconsistent. It says " /home/cnc/%d.g-code" will store file in /home/freecad !
3. %d not processed, it comes out as %d in the file name.
4. any supplied suffix like the suggested ".g-code" gets lost and proposed filename has no extension.
5. Hitting save btn does nothing on first attempt, Needs two clicks .
...

There's probably more. Any recent changes in this code need proper testing.

Cheers.

Code: Select all

OS: Fedora Linux 35 (Thirty Five) (LXQt//usr/share/xsessions/lxqt)
Word size of FreeCAD: 64-bit
Version: 0.21.29966 (Git)
Build type: Release
Branch: master
Hash: 3818534cd6bbf78b3a57c946ac73f33650233f6c
Python 3.10.5, Qt 5.15.2, Coin 4.0.0, Vtk 9.0.3, OCC 7.5.0
Locale: English/United Kingdom (en_GB)
Installed mods: 
  * FreeCAD_Assembly4 0.11.10
  * FreeCAD_assembly3
jescombe
Posts: 90
Joined: Tue Mar 09, 2021 4:19 pm

Re: multiple breakage in output file naming.

Post by jescombe »

@sliptonic
This change fixes the output file file naming for me. Without it, I just get the unprocessed substitution strings in the current working directory. (Am guessing the unit tests don't actually open the save dialog and therefore missed it). Can submit as a PR if preferred..?

Code: Select all

diff --git a/src/Mod/Path/PathScripts/PathPost.py b/src/Mod/Path/PathScripts/PathPost.py
index f185678..937c388 100644
--- a/src/Mod/Path/PathScripts/PathPost.py
+++ b/src/Mod/Path/PathScripts/PathPost.py
@@ -238,7 +238,7 @@ def resolveFileName(job, subpartname, sequencenumber):
 
     if openDialog:
         foo = QtGui.QFileDialog.getSaveFileName(
-            QtGui.QApplication.activeWindow(), "Output File", filename
+            QtGui.QApplication.activeWindow(), "Output File", fullPath
         )
         if foo[0]:
             fullPath = foo[0]
User avatar
freman
Veteran
Posts: 2200
Joined: Tue Nov 27, 2018 10:30 pm

Re: multiple breakage in output file naming.

Post by freman »

Thanks jescomb, which of the 5 points that I raise does this fix ?

I think whoever had been making changes in this code recently needs to review the commits. With the possible exception of 2) all this seems to be recent regression.
jescombe
Posts: 90
Joined: Tue Mar 09, 2021 4:19 pm

Re: multiple breakage in output file naming.

Post by jescombe »

freman wrote: Sun Aug 28, 2022 11:42 am Thanks jescomb, which of the 5 points that I raise does this fix ?
The last three work properly for me now, your first two points are still valid I believe..
User avatar
freman
Veteran
Posts: 2200
Joined: Tue Nov 27, 2018 10:30 pm

Re: multiple breakage in output file naming.

Post by freman »

That's weird, you did well to suss that out. Thanks.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: multiple breakage in output file naming.

Post by Kunda1 »

jescombe wrote: Sun Aug 28, 2022 11:34 amCan submit as a PR if preferred..?
Pleas do! :)
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
freman
Veteran
Posts: 2200
Joined: Tue Nov 27, 2018 10:30 pm

Re: multiple breakage in output file naming.

Post by freman »

If you go to the trouble of creating a PR, it would be nice to fix the hover hint too.
2. hover hint inconsistent. It says " /home/cnc/%d.g-code" will store file in /home/freecad !
Since /home is linux specific it maybe better to use %D which creates a file in the same directory as the FCStd file. That means it is platform agnostic and also gives another useful code example.
"%D%d.gcode will store output file in the same location as the FCStd file and with the same name with the suffix gcode. "
jescombe
Posts: 90
Joined: Tue Mar 09, 2021 4:19 pm

Re: multiple breakage in output file naming.

Post by jescombe »

freman wrote: Sun Aug 28, 2022 4:27 pm If you go to the trouble of creating a PR, it would be nice to fix the hover hint too.
Will do, I'll wait to hear from sliptonic though - as I was just having a look at problem #1

Have raised issue #7410 on GitHub in the meantime..
User avatar
sliptonic
Veteran
Posts: 3457
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: multiple breakage in output file naming.

Post by sliptonic »

Makes sense to me. Please send PR
jescombe
Posts: 90
Joined: Tue Mar 09, 2021 4:19 pm

Re: multiple breakage in output file naming.

Post by jescombe »

sliptonic wrote: Tue Aug 30, 2022 6:06 pm Makes sense to me. Please send PR
Thanks, have raised PR issue #7428 for the output file dialog fixes.
I haven't addressed the hover hint, as frankly I wasn't sure what I was doing with the .ui & .ts files!
Last edited by Kunda1 on Sat Sep 03, 2022 4:35 pm, edited 1 time in total.
Reason: added bbcode
Post Reply