"Feed and Speed Calculator addon" integration & update including scripted creation of ToolControllers

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!
jescombe
Posts: 90
Joined: Tue Mar 09, 2021 4:19 pm

Re: "Feed and Speed Calculator addon" integration & update including scripted creation of ToolControllers

Post by jescombe »

spanner888 wrote: Thu Nov 18, 2021 11:49 pm Is the "Path Addons" menu item still visible on the Path Menu and then is then the "Feeds and Speeds" sub menu item just a blank menu entry?
Ah sorry, I see whats happening - turns out the addon wasn't being loaded at all - and I realised neither were any others that had been added from the Addon Manger.

Looks like the underlying UserAppData path has changed from ~/.FreeCAD/ to ~/.local/share/FreeCAD/ - have copied the Mod files to there and back in business.. Thanks!
spanner888
Posts: 327
Joined: Tue May 28, 2019 10:51 am

Re: "Feed and Speed Calculator addon" integration & update including scripted creation of ToolControllers

Post by spanner888 »

Glad to see you sorted it out.

I just saw this thread today, it is possibly related and may affect other Linux users of FC/addons.
spanner888
Posts: 327
Joined: Tue May 28, 2019 10:51 am

Re: "Feed and Speed Calculator addon" integration & update including scripted creation of ToolControllers

Post by spanner888 »

jescombe wrote: Fri Oct 01, 2021 2:10 pm Only have one bit of feedback from my initial testing, updating the tool material doesn't seem to change the generated output until another action is taken to trigger this (i.e. changing the machining material to something else and then back again). Appreciate this would usually be set from the tool library anyway, but as it's changeable in the dialog...

A toolbar icon would be a nice addition as well, but suspect that's on the roadmap already?
Pull request submitted for the tool material bug https://github.com/dubstar-04/FeedsAndSpeeds/pull/18. Thanks for the report.

Also have noted the Toolbar icon request
User avatar
onekk
Veteran
Posts: 6206
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: "Feed and Speed Calculator addon" integration & update including scripted creation of ToolControllers

Post by onekk »

Path change is very recent, but in a @wmayer post there is a way to use Preferences or some "internal variables" to obtain the Path without having to hardcode it.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
imm
Posts: 267
Joined: Wed Nov 03, 2021 1:00 pm

Re: "Feed and Speed Calculator addon" integration & update including scripted creation of ToolControllers

Post by imm »

Great Job!

Just my 2 cents....I believe in trying to separate things that should be 'user-accessible' from just code.

It makes programmers lives easier and it ensures 'most' users can maintain a hairline of sanity.

Adding the csv module and defining the 2 functions below allows for the init of the materials list to be in the form of
a csv file in your directory.

Code: Select all

import csv

......

# -- any numeric value that can be converted to float is converted to float.
def fitem(item):
    item.strip()
    try:
        item=float(item)
    except ValueError:
        pass
    return item

# -- takes a header list and row list converts it into a dict. Numeric values converted to float in the row list wherever possible. 
def rowConvert(h,a):
    b=[]
    for x in a:
        b.append(fitem(x))
    k = iter(h)
    it = iter(b)
    res_dct = dict(zip(k, it))
    return res_dct
Then you can modify the load_materials() function as follows....

Code: Select all

def load_materials():
    # Data from Machineries Handbook 28.
    # Kp: Tables 1a, 1b
    # Brinell Hardness: http://www.matweb.com

    # ss_hss = surface speed (m/min) for milling with high speed steel tools (hss)
    # ss_cbd = surface speed (m/min) for milling with carbide tools
    # ss_drill_hss = surface speed (m/min) for drilling with high speed steel tools (hss)
    # ss_drill_cbd = surface speed (m/min) for drilling with carbide tools
    # Kd = workMaterialFactor from Table 31
    # ref: 1 ft/min = 0.3048 m/min
    filename = "../Mod/FeedsAndSpeeds/materials.csv"
    
    materials=[]
 
    with open(filename,'r') as csvin:
        alist=list(csv.reader(csvin))
        firstLine = True
        for a in alist:
            if firstLine:
                if len(a) == 0: continue
                if len(a) == 1: continue
                else:
                    h = a 
                    firstLine = False
            else:
                # print(rowConvert(h,a))
                materials.append(rowConvert(h,a))
            
    return materials

And the 'materials.csv' file is shown below.....you can easily add comments,titles,ownership statements in the commented header space.

Code: Select all

# -- null line below --

# -- whitespace line below --
   
# -- comments here --
#
"material","ss_hss","ss_cbd","ss_drill_hss","ss_drill_cbd","kp","brinell","Kd","Note"
"Softwood",225,255,185,205,0.5,0,3000,"# noqa E241"
"Hardwood",145,275,115,400,0.75,0,4000,"# noqa E241"
"Soft Plastics",225,255,185,205,0.5,0,2000,"# noqa E241"
"Hard Plastics",225,275,115,400,0.75,0,2000,"# noqa E241"
"Aluminium (6061)",175,395,135,310,0.9,95,7000,"# noqa E241"
"Aluminium (7075)",175,395,125,310,0.9,150,7000,"# noqa E241"
"Aluminium (Cast)",175,395,135,310,0.68,150,7000,"# noqa E241"
"Brass (Hard)",200,395,115,350,2.27,120,14000,"# noqa E241"
"Brass (Medium)",175,350,115,350,1.36,120,14000,"# noqa E241"
"Brass (Soft)",125,300,115,350,0.68,120,7000,"# noqa E241"
"Carbon Steel",35,120,25,90,1.88,130,24000,"# noqa E241"
"Tool Steel",12,45,10,30,1.88,400,340000,"# noqa E241"
"Stainless (303)",25,85,20,65,2.07,200,200000,"# noqa E241"
"Stainless (304)",10,37.5,10,30,2.07,125,22000,"# noqa E241"
"Stainless (316)",7.5,25,5,20,2.07,80,24000,"# noqa E241"
The whole thing provides a drop-in replacement for the hard-coded array that was there previously.
And with a little documentation the end-user can freely view and expand upon the materials properties without mucking with the coding.
:D

Hope someone finds it useful.
spanner888
Posts: 327
Joined: Tue May 28, 2019 10:51 am

Re: "Feed and Speed Calculator addon" integration & update including scripted creation of ToolControllers

Post by spanner888 »

imm wrote: Fri Nov 26, 2021 1:05 pm Adding the csv module and defining the 2 functions below allows for the init of the materials list to be in the form of
a csv file in your directory.
...snip
The whole thing provides a drop-in replacement for the hard-coded array that was there previously.
And with a little documentation the end-user can freely view and expand upon the materials properties without mucking with the coding.
:D
Thanks !

This could be a big help for the materials and also Chip Load (feed per tooth) and loading your own lists of tools etc.
spanner888
Posts: 327
Joined: Tue May 28, 2019 10:51 am

Re: "Feed and Speed Calculator addon" integration & update including scripted creation of ToolControllers

Post by spanner888 »

imm wrote: Fri Nov 26, 2021 1:05 pm Adding the csv module and defining the 2 functions below allows for the init of the materials list to be in the form of
a csv file in your directory.
In fact just used several times to load some ChipLoad data into a test plot script as part of looking to expand the Feeds & speeds calculator. Seems ChipLoad is mostly, but not only dependent on tool Diameter and Material.
Chip Load vs Tool dia for different materials
Chip Load vs Tool dia for different materials
Feeds #2.png (55.4 KiB) Viewed 2370 times
Thanks !
acp693
Posts: 127
Joined: Wed Dec 15, 2021 7:41 pm

Re: "Feed and Speed Calculator addon" integration & update including scripted creation of ToolControllers

Post by acp693 »

Hi,

This looks very interesting! I find github confusing , I can’t see a .zip file anywhere on the linked page? Could someone point me to it?

Many thanks

Albert
jescombe
Posts: 90
Joined: Tue Mar 09, 2021 4:19 pm

Re: "Feed and Speed Calculator addon" integration & update including scripted creation of ToolControllers

Post by jescombe »

acp693 wrote: Wed Dec 22, 2021 12:44 pm I can’t see a .zip file anywhere on the linked page? Could someone point me to it?
If you click on the green 'Code' button, there should be a "Download Zip" option..

Cheers, Jon
acp693
Posts: 127
Joined: Wed Dec 15, 2021 7:41 pm

Re: "Feed and Speed Calculator addon" integration & update including scripted creation of ToolControllers

Post by acp693 »

Got it! Thanks Jon!
Post Reply