Tool number auto increment

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
mpetrasinovic
Posts: 106
Joined: Sat Feb 22, 2020 10:19 am
Location: Belgrade, Serbia
Contact:

Tool number auto increment

Post by mpetrasinovic »

Is there some case that prevents that tool number is auto-incremented when tools are added to the job? Currently, every tool gets number 1 by default and if you want to split the job by tools it won't work as you expect until you change tool numbers.
User avatar
sliptonic
Veteran
Posts: 3459
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Tool number auto increment

Post by sliptonic »

You didn't say if you're using legacy or toolbits. I'll assume it's toolbits since legacy is deprecated and you really _should_ be using toolbits.

Tool controllers get the tool number assigned to them in the tool library.
Generally tools have toolnumbers assigned at the machine so assigning them dynamically in the job doesn't make sense.
User avatar
mpetrasinovic
Posts: 106
Joined: Sat Feb 22, 2020 10:19 am
Location: Belgrade, Serbia
Contact:

Re: Tool number auto increment

Post by mpetrasinovic »

I thought this is unique to toolbits, I am not sure if we are on the same page here. My question is about this table (on image) and tool number property that is later used to split job output.
tool_number.png
tool_number.png (11.11 KiB) Viewed 1525 times
User avatar
sliptonic
Veteran
Posts: 3459
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Tool number auto increment

Post by sliptonic »

The image you're showing is from the Job setup. It's showing the tool numbers assigned to the tool controllers in the Job.
Below you'll see the tool 'dock' for my setup. All the tools have unique numbers that correspond to my mill's tool table. When I add these tools as TCs to the job, the number is maintained. It seems like all the tools in your library have the same tool number (1)
2021-04-14_08-41.png
2021-04-14_08-41.png (60.77 KiB) Viewed 1495 times
User avatar
mpetrasinovic
Posts: 106
Joined: Sat Feb 22, 2020 10:19 am
Location: Belgrade, Serbia
Contact:

Re: Tool number auto increment

Post by mpetrasinovic »

This is not the case, in tool selector, they also have a unique number but the number is not maintained for the job, we use (freshly installed):

OS: Windows 10 Version 2009
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24276 (Git)
Build type: Release
Branch: releases/FreeCAD-0-19
Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/United States (en_US)
tool_selector.png
tool_selector.png (11.04 KiB) Viewed 1491 times
User avatar
sliptonic
Veteran
Posts: 3459
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Tool number auto increment

Post by sliptonic »

Well then I guess it's a little more interesting than I thought :lol:

Ok, Have you duplicated the problem with a brand new job?
User avatar
mpetrasinovic
Posts: 106
Joined: Sat Feb 22, 2020 10:19 am
Location: Belgrade, Serbia
Contact:

Re: Tool number auto increment

Post by mpetrasinovic »

Yes, it is the same every time on multiple PC-s. Tool number is always 1 when it is added to the job.
User avatar
sliptonic
Veteran
Posts: 3459
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Tool number auto increment

Post by sliptonic »

This is the procedure that gets executed when you add the TC from the dock.
https://github.com/FreeCAD/FreeCAD/blob ... #L388-L410

It calls this procecedure to actually add each TC.
https://github.com/FreeCAD/FreeCAD/blob ... #L129-L138

Please make sure these lines are at the beginning of both files and uncommented.

Code: Select all

PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
PathLog.trackModule(PathLog.thisModule())
Also add this line in PathToolBitLibraryGui.py inside the for tool in tools: block around line 408

Code: Select all

            PathLog.track('adding tool number: {}'.format(tool[0]))
Then try it again and look at what's happening in the report view.

I'm seeing this:

Code: Select all

09:33:01  PathToolBitLibraryGui(408).selectedOrAllToolControllers(adding tool number: 11)
09:33:01  PathToolControllerGui(132).Create(<Part::PartFeature>, 11)
herbk
Veteran
Posts: 2660
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Tool number auto increment

Post by herbk »

Hi Sliptonic,

it is here the same:

OS: openSUSE Tumbleweed (KDE//usr/share/xsessions/plasma5)
Word size of FreeCAD: 64-bit
Version: 0.20.24693 (Git) AppImage
Build type: Release
Branch: master
Hash: e01f0d25d5f3ef9ceb66aa087212121e9f2f2e8b
Python version: 3.9.2
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.1
Locale: German/Germany (de_DE)

But only if i put the tools to the Job at the Job setup. If i open the Tool Seelctor and ad the tools from there to an existing Job the tool numbers are correct.

Edit: I don't notice this till now, because i have no toolchanger at my machine and use only one tool per Job...
Gruß Herbert
User avatar
mpetrasinovic
Posts: 106
Joined: Sat Feb 22, 2020 10:19 am
Location: Belgrade, Serbia
Contact:

Re: Tool number auto increment

Post by mpetrasinovic »

I have done everything you said and I only get:

Code: Select all

PathToolControllerGui(133).Create(<Part::PartFeature>, 1)
Does it mean that this line is not even called?
Post Reply