Hello Guest it is March 29, 2024, 10:24:49 AM

Author Topic: SFM and Chip Load Calculator  (Read 1106 times)

0 Members and 1 Guest are viewing this topic.

SFM and Chip Load Calculator
« on: January 08, 2019, 07:21:50 PM »
Just for fun.
Got this idea from our Haas controller; it has a chip load and SFM Calculator right on the controller.
I put the SFM and Chip Load DROs in the Spindle Box in Mach4 on my screenset.

Setup:
You need to make 2 DROs; one for Chipload and one for SFM.  Place them wherever you like.
   Chipload DRO named:  droChipload
   SFM DRO named:  droSFM
You need to make a user field in the tool table for the number of flutes on your endmill.
User Field Setup.
   Type:  Float
   Named:  Flutes

Place this code in the PLC Script.

--Calculate SFM and Feed per Tooth
local inst = mc.mcGetInstance()
local Tool = mc.mcToolGetCurrent(inst)
local ToolDiameter = mc.mcToolGetData(inst, mc.MTOOL_MILL_DIA, Tool);
local RPM = mc.mcSpindleGetTrueRPM(inst)
local SFM = RPM * ToolDiameter* 3.14159/12
SFM = math.floor(SFM)
scr.SetProperty('droSFM', 'Value', tostring(SFM));
--Calculate feed per tooth.
local NumberOfFlutes = mc.mcToolGetDataExDbl(inst, Tool, "Flutes")
local FRO = mc.mcCntlGetFRO(inst)
local CurrentFeed = mc.mcCntlGetPoundVar(inst, 4109)
local Feedrate = (CurrentFeed * (FRO/100))

if NumberOfFlutes > 0 then --If the current tool doesn't have the flutes box filled in.  Ignore the feed per tooth.
    if RPM > 0 then
       local FeedPerTooth = ((Feedrate / RPM) / NumberOfFlutes)
       scr.SetProperty('droChipload', 'Value', tostring(FeedPerTooth));
    else
       scr.SetProperty('droChipload', 'Value', tostring(0.0000));
     end
else
    scr.SetProperty('droChipload', 'Value', tostring(0.0000));
end
Chad Byrd