Tools, old Tool, new ToolBit and other fun stuff

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!
Post Reply
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Tools, old Tool, new ToolBit and other fun stuff

Post by mlampert »

Heads up:

A few weeks ago (maybe a little more than just a few) @dubstar, @sliptonic and I had a conversation about tools and how we could possibly change them to move forward.

We implemented a proof of concept and the feature is by no means complete or thoroughly tested. And therein lies the crux - we're all pretty busy and we need validation of the principle. So the idea is to get feedback right from You, as early as possible.

We will merge the POC into master and it will be available iff you enable the experimental features. Additionally, you will have to edit the Path preferences and deselect "Use legacy tools". Once you do that opening the Tool Library Manager will open the new library manager and creating a Job (without any template) will also create a TC for the new Tool(Bit).

Note that any Job templates with old tools will still work as before - in fact, you can mix and match old and new tools as you please even within a Job. If that doesn't work it's a bug (I'm the one to blame for all of those) so please report it.

If you enable the experimental features you'll notice a few more menu items, all related to tools, tool libraries and tool controllers.

What changes:
* the type for new tools is "ToolBit"
* ToolBit is implemented entirely in python, making it more accessible for changes and contributions
* ToolBit has a real Shape representing the actual geometry
* Shapes for ToolBit are regular FCStd files which follow a few simple rules
* Shapes are fully parametric
* Anybody can create their own (arbitrary) shapes with their own parameters for their tools
* the user can add arbitrary properties to the ToolBit, there is currently a predefined list, not extensible but the plan is that each user can customize that for themselves
* a ToolBit is stored as a json file on disk and converted/constructed to a solid when loaded or while it is edited
* ToolBits have the file extension '.fctb' (FreeCAD ToolBit)
* ToolBits, tool libraries and tool shapes are independent of the FC user configuration, so you can blow that away as often as you like without risking losing your tools.
* each ToolBit is its own object in the tree, independent of a TC
* multiple TCs can reference the same ToolBit object
* a Tool Library is a json file on disk referencing the tool json files
* thereby, a ToolBit can be referenced by multiple libraries and doesn't need to be copied
* a Tool Library has the file extension '.fctl' (FreeCAD Tool Library)
* everyone is free to store their tools, libraries and personal shapes wherever they want and organize them as they see fit
* due to tools and libraries being regular json files they can be generated by a script, archived, version controlled, batch modified ...
* in case the tools are stored under the Marco or the Path directory the following directory tree is additionally searched for the corresponding files:

Code: Select all

   Tools
     +- Bit      ... for ToolBit json files
     +- Library  ... for tool library json files
     +- Shape    ... for ToolBit shape files
This is just a convention though, no requirement. A set of shapes and tools and library are currently included to showcase the system and get everyone started

There are some additional details and background information in the Tools/README.md file. If you want to create your own tool shapes it might be of interest. Just looking at the existing shapes you'll figure out what's going on, it's not that complicated. Note that the readme talks about "templates" - that turned out to be too confusing with "Job templates" so they got renamed to "shapes".

The ask:
* give it a run, try it out, play with it
* let us know if you hate it or love it
* comment on every aspect of it
- what's missing
- what doesn't work
- what works very well
- what do you wan to see
- ....

As mentioned before, this is a POC, so anything and everything can change/go/be added depending on feedback. And if it doesn't work at all we'll remove it again. So don't hold back :)

Happy tooling!
Last edited by mlampert on Thu Jan 02, 2020 7:27 pm, edited 1 time in total.
herbk
Veteran
Posts: 2660
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Tools, old Tool, new ToolBit and other fun stuff

Post by herbk »

Hi Markus,

again some stuff which sounds great...

Would you please give a hint if it's in the Appimage ? Or do i see it if it's in ?
Gruß Herbert
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: Tools, old Tool, new ToolBit and other fun stuff

Post by mlampert »

I'm sure it'll become available in the app image once the PR gets merged. The PR is currently still up and the Windows build failed again due to a time out in the automatic build. I'll post here again once the PR is merged.
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: Tools, old Tool, new ToolBit and other fun stuff

Post by mlampert »

I figured I'll bump this thread since the changes have been merged a while ago and the new ToolBit is available in master, and hopefully all builds/distributions. For details and how to activate it please see the initial post.

As mentioned before, this is a POC and the important part is to validate the approach. So if you play around with it, maybe create your own tools with their own shapes, different sizes and multiple libraries and let us know how it goes.
chrisb
Veteran
Posts: 54152
Joined: Tue Mar 17, 2015 9:14 am

Re: Tools, old Tool, new ToolBit and other fun stuff

Post by chrisb »

Sorry for not giving any feedback. I simply use it since it is in master, and it all works as expected :D . So I thought there was no need for feedback.

There are two and a half things to mention:
- half: On first testing I got the tool twice, but I could not reproduce
- If I create new tools they are created even if I "Cancel"
- "Delete" could be active for multiple selections as well.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
m0n5t3r
Posts: 138
Joined: Fri Feb 03, 2017 2:55 pm

Re: Tools, old Tool, new ToolBit and other fun stuff

Post by m0n5t3r »

I'm on ubuntu 16.04 and am getting all sorts of QT-related tracebacks when trying to load the toolbit stuff (library, create bit, etc.); I guess I'll upgrade to 18.04 one of these days, I'm guessing it's some QT api mismatch
User avatar
roerich_64
Veteran
Posts: 1465
Joined: Thu May 21, 2015 7:00 pm
Location: Ostfriesland

Re: Tools, old Tool, new ToolBit and other fun stuff

Post by roerich_64 »

Hi,

i found issues with the backward compatibility.

My system:

Code: Select all

OS: Linux Mint 19.2 (X-Cinnamon/cinnamon)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19093 (Git) AppImage
Build type: Release
Branch: master
Hash: 9e4710d679d44613a1ae4264b86ef9f6d12f4e5a
Python version: 3.7.6
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
And the old one:
(nice to see: it reads not the correct OS... it is Linux Mind 19.2)

Code: Select all

OS: Linux 4.15.0-54-generic
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.14555 (Git shallow)
Build type: Release
Branch: (HEAD detached at 0.18.4)
Hash: 980bf9060e28555fecd9e3462f68ca74007b70f8
Python version: 2.7.15
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
* can not delete the dressups of older files and the structure of the old job was damaged:
The file for tests:
schublade_60.FCStd
(173.93 KiB) Downloaded 82 times

* the job_*.json files must be in the /home/user/.FreeCAD/Macro directory.
In the preferences of PATH i gave the folder to my template folder, but still it reads the /home/user/.FreeCAD/Macro directory.
preferences.jpg
preferences.jpg (55.89 KiB) Viewed 4046 times
Walter
Die Liebe wird siegen, denn sie ist unzerstörbar :) ;)
User avatar
roerich_64
Veteran
Posts: 1465
Joined: Thu May 21, 2015 7:00 pm
Location: Ostfriesland

Re: Tools, old Tool, new ToolBit and other fun stuff

Post by roerich_64 »

p.s.

I think the stumbling stone of backward compatibility was the new code around the 'Order By' routine:
orderBy.jpg
orderBy.jpg (251.42 KiB) Viewed 4039 times
The code should ignore the missing info of older files...

Code: Select all

Running the Python command 'Path_Job' failed:
Traceback (most recent call last):
  File "/tmp/.mount_FreeCA10JEEE/usr/Mod/Path/PathScripts/PathJobCmd.py", line 67, in Activated
    dialog.setupModel()
  File "/tmp/.mount_FreeCA10JEEE/usr/Mod/Path/PathScripts/PathJobDlg.py", line 168, in setupModel
    self.dialog.modelTree.setModel(self.model)

'PySide2.QtWidgets.QWidget' object has no attribute 'setModel'PathJobGui.INFO: Uncreate Job
The Job was created without fixture support.  Please delete and recreate the job
Die Liebe wird siegen, denn sie ist unzerstörbar :) ;)
memfis
Posts: 588
Joined: Tue Nov 15, 2016 7:58 pm

Re: Tools, old Tool, new ToolBit and other fun stuff

Post by memfis »

OS: Arch Linux (GNOME/gnome-xorg)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19107 (Git) AppImage
Build type: Release
Branch: master
Hash: ad952191297fe53593c4d4b0ac80b43fd6664b22
Python version: 3.7.6
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Russian/Russia (ru_RU)


for those who use appimage - it is believed that samples of the installation files can be taken directly from https://github.com/FreeCAD/FreeCAD/tree ... Path/Tools ?

However, even if you download these files, create a pair of fctb + fsctd, you can not get from the use when creating the path. Appimage I just load the processor when trying, for example, to open the standard tool (t9) and at least change the path to the file fsctd. And then it hangs.

Hence the question - how exactly do we achieve in appimage the ability to edit and use our tools?

It would also be correct to explicitly specify which specific size names are nailed, because you have to change the size name in fctb and try to load the tool into the library.
So far, from the list of parameters -

{
"CuttingEdgeHeight." "30,000 mm."
"Diameter." "3,000 mm."
"Length": "50,000 mm",
"ShankDiameter." "3.000 mm"
}

only the word Diameter should be kept unchanged (when it is changed, the tool breaks, the other parameters allow to change it arbitrarily) -
{
"version": 1,
"name": "Радиусная d12.75 R6.35",
"shape": "radius_vogn.fcstd",
"attribute": {},
"parameter": {
"L": "50.000 mm",
"ds": "6.35 mm",
"Diameter": "12.75 mm",
"hR": "5.35 mm",
"H": "10.02 mm"
}
}
Attachments
radius_vogn.FCStd
(11.44 KiB) Downloaded 73 times
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: Tools, old Tool, new ToolBit and other fun stuff

Post by mlampert »

memfis wrote: Thu Jan 02, 2020 2:41 pm It would also be correct to explicitly specify which specific size names are nailed, because you have to change the size name in fctb and try to load the tool into the library.
Great - thanks for going through the process and making a tool. Diameter is the only required constraint. It is mentioned in the section about making a new tool but I agree it could be more prominent, or there could be some other support.

I saw you didn't add any tooltips to the parameters - is that by choice or do you find the mechanism to do so cumbersome? I'm not too excited about that whole construct/approach/convention - hence the question.
Post Reply