Offby one in the tool table: Tooltype

Here's the place for discussion related to CAM/CNC and the development of the Path module.
reox
Posts: 664
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Offby one in the tool table: Tooltype

Postby reox » Tue Jan 30, 2018 4:34 pm

Not sure if this is already reported (i had a quick look and it does not appear to be)...
My tooltable shows the wrong ToolType, e.g. SlotCutter instead of EndMill.
I had one old entry (the first one), and as soon as I edited it, it jumped to Tap (which is one before)
2018-01-30-173254_923x283_scrot.png
2018-01-30-173254_923x283_scrot.png (39.17 KiB) Viewed 782 times
OS: Debian GNU/Linux testing (buster)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13180 (Git)
Build type: None
Branch: master
Hash: d9627d5311eadc31dee647bcc1650d02d0a30830
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: German/Austria (de_AT)
mlampert
Posts: 1342
Joined: Fri Sep 16, 2016 9:28 pm

Re: Offby one in the tool table: Tooltype

Postby mlampert » Tue Jan 30, 2018 6:44 pm

could you post your steps please?
herbk
Posts: 1544
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Offby one in the tool table: Tooltype

Postby herbk » Tue Jan 30, 2018 7:20 pm

mlampert wrote:
Tue Jan 30, 2018 6:44 pm
could you post your steps please?
Hi Markus,
open a tooltable and doubleclick an existing tool.

On my installation i get a "Tap" instead of a "Endmill"

OS: "openSUSE Leap 42.3"
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13125 (Git)
Build type: None
Branch: master
Hash: 59dedd12751a3f5730734741ae6258a4ea4f5745
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: German/Germany (de_DE)
Gruß Herbert
mlampert
Posts: 1342
Joined: Fri Sep 16, 2016 9:28 pm

Re: Offby one in the tool table: Tooltype

Postby mlampert » Tue Jan 30, 2018 7:32 pm

Oh boy, I seem to have one of these days - :oops:
Apologies for being slow today. :mrgreen:
mlampert
Posts: 1342
Joined: Fri Sep 16, 2016 9:28 pm

Re: Offby one in the tool table: Tooltype

Postby mlampert » Wed Jan 31, 2018 12:14 am

roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: Offby one in the tool table: Tooltype

Postby roivai » Wed Jan 31, 2018 8:35 am

The reason is that Flycutter seems to be missing from the list in PathToolLibraryManager.py, I think it was added to the ToolEdit.ui quite recently. I cannot create pull request now but I can fix that tonight if @mlampert did not start that already? Maybe it would make sense to remove the duplication of the list and generate the items to the combo box on the fly instead of hard coding them to ToolEdit..?

Pekka
mlampert
Posts: 1342
Joined: Fri Sep 16, 2016 9:28 pm

Re: Offby one in the tool table: Tooltype

Postby mlampert » Wed Jan 31, 2018 5:22 pm

roivai wrote:
Wed Jan 31, 2018 8:35 am
The reason is that Flycutter seems to be missing from the list in PathToolLibraryManager.py, I think it was added to the ToolEdit.ui quite recently. I cannot create pull request now but I can fix that tonight if @mlampert did not start that already? Maybe it would make sense to remove the duplication of the list and generate the items to the combo box on the fly instead of hard coding them to ToolEdit..?

Pekka
Haven't started - your idea of consolidating the enumeration strings into a single place sounds fantastic! Be aware that the Tool/Tooltable implementation is spread between c++ and python which complicates things a bit.
roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: Offby one in the tool table: Tooltype

Postby roivai » Wed Jan 31, 2018 5:51 pm

mlampert wrote:
Wed Jan 31, 2018 5:22 pm

Haven't started - your idea of consolidating the enumeration strings into a single place sounds fantastic! Be aware that the Tool/Tooltable implementation is spread between c++ and python which complicates things a bit.
Oh crap, that's the end of my capabilities. Or maybe a change to finally study how c++ and Python ties together.. :shock: Lets see.. But maybe I'll add Flycutter to the lists right now to get the bug fixed.
roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: Offby one in the tool table: Tooltype

Postby roivai » Wed Jan 31, 2018 9:38 pm

Phew.. That was a tough night of learning C++ after quite a many years.. I think I was able to do it: now the list of tool types and materials exist only in C++ side on Tooltable.cpp and Tooltable.h. The changes are here:
https://github.com/pekkaroi/FreeCAD/com ... c9713e7adb

Some things:
1. I did not read any coding style or naming conventions which I'm sure exist for FreeCAD C++ so it definitely needs a review.
2. Something went wrong with my beloved Atom text editor at some point and I messed with most of the line endings of the files. I returned them to unix encoding, but now git does not see the diff correctly, it thinks the whole file has changed. On command line I can get a decent diff with "git diff --ignore-space-at-eol -b -w --ignore-blank-lines". Any hints to deal with that except to do a git --reset at some branch and copy-paste the changes again..
3. I did not test that all that well and now I am well past my bed time, so that needs to be done tomorrow.
mlampert
Posts: 1342
Joined: Fri Sep 16, 2016 9:28 pm

Re: Offby one in the tool table: Tooltype

Postby mlampert » Thu Feb 01, 2018 1:25 am

Awesome!