Hello Guest it is May 12, 2021, 08:22:20 PM

Author Topic: Feed Rate Override Absolute Value?  (Read 2932 times)

0 Members and 1 Guest are viewing this topic.

Feed Rate Override Absolute Value?
« on: December 16, 2016, 10:25:15 AM »
Hey everyone,

I'm fairly new to Mach 4 and am setting up a new system. I'm trying to enter a new feed rate for use with the 'Go To Work Zero' button that is on the default screen. I use this very frequently to move in straight cuts as it is a CNC hotwire machine. I need to frequently change the feed rate depending on what material I'm cutting.

the API indicates that mcCntlSetFRO is only be able to change the feed rate by percentage. Is there a method of changing it to an absolute value? Or is there perhaps a way to use a DRO to enter a new value with the 'f' Gcode command?

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Feed Rate Override Absolute Value?
« Reply #1 on: December 16, 2016, 11:03:36 AM »
This runs a function that is within the Screen Load Script that simply runs an mdi code.

Code: [Select]
function GoToWorkZero()
    mc.mcCntlMdiExecute(inst, "G00 X0 Y0 A0")--Without Z moves
    --mc.mcCntlMdiExecute(inst, "G00 G53 Z0\nG00 X0 Y0 A0\nG00 Z0")--With Z moves
end

DazTheGas
Theres always time for a choccy biccy
Re: Feed Rate Override Absolute Value?
« Reply #2 on: December 16, 2016, 11:19:05 AM »
Thanks Daz,

I figured that I could use a button with an mdi/gcode to change the feed rate. Is there a way to use a DRO to enter a variable that I can then use in that function?
I'm assuming I can use the 'on modify script' section in a DRO to run the function, but I'm unsure how to pull a number that I enter into it.

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Feed Rate Override Absolute Value?
« Reply #3 on: December 16, 2016, 12:55:28 PM »
You can link the DRO to a register or a parameter and get those values in your script. You can also assign the DRO to neither and get the value property of the DRO. Like this.......

local rate = scr.GetProperty("droJogRate", "Value")

You can set the jog rate for all axis or each axis individually.

scr.SetProperty("droJogRate", "50")

mc.mcJogSetRate(inst, mc.X_AXIS, 50)

There isn't much you can't do really.
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Feed Rate Override Absolute Value?
« Reply #4 on: December 16, 2016, 12:59:00 PM »
But Daz is right............ if you want to alter how that function works alter it in the function.
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Feed Rate Override Absolute Value?
« Reply #5 on: December 16, 2016, 01:25:03 PM »
Thanks for the help,

I didn't fully understand Daz's original suggestion, I'm not used to being able to edit the pre-defined functions at will.
Re: Feed Rate Override Absolute Value?
« Reply #6 on: December 16, 2016, 02:25:51 PM »
Thanks for the tips however I'm not looking to change the jog rate, just the feed rate. Perhaps I'm not seeing what you're trying to tell me. I'm aware that I can edit the go to zero function to have any specific feed rate I like, but I need to change that feed rate frequently so coding it into the button isn't the best option.

Your example seems to show that I can pull a user entered value from a DRO, but I'm not sure how to change the feed rate with that value. I don't think I can edit the mcCntlSetFRO function to accept an absolute value instead of a percentage. I also don't think I'm able to use a variable in an mdi code.

The only option that I'm seeing is to create individual buttons with mdi commands for each feed rate I would like to use. A possibility, but not an ideal solution.

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Feed Rate Override Absolute Value?
« Reply #7 on: December 16, 2016, 03:39:24 PM »
Not sure exactly what your looking to do but jogging speed is only set as a percentage of max velocity. But with some math you can arrive at what percentage any speed would be.............. so you could have a DRO you enter a speed into.

You can do feed moves at any speed you want but you also have to know what position or distance.

The following example has a little of everything your looking for I think. Down script goes in a buttons down script event and the up script goes in the same buttons up script event. It will get the vale from the JogRate DRO and jog the X axis negative at 50% of that percentage and it will jog the Z axis positive at 100% of that percentage. Lets see what you can do with it........

Code: [Select]
--Down Script

local inst = mc.mcGetInstance()
local rate = scr.GetProperty("droJogRate", "Value")
rate = tonumber(rate)

mc.mcJogSetRate(inst, mc.X_AXIS, (rate/2))
mc.mcJogSetRate(inst, mc.Z_AXIS, rate)
mc.mcJogVelocityStart(inst, mc.X_AXIS, mc.MC_JOG_NEG)
mc.mcJogVelocityStart(inst, mc.Z_AXIS, mc.MC_JOG_POS)

--Up Script
local inst = mc.mcGetInstance()
mc.mcJogVelocityStop(inst, mc.X_AXIS)
mc.mcJogVelocityStop(inst, mc.Z_AXIS)
« Last Edit: December 16, 2016, 03:41:43 PM by Chaoticone »
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Feed Rate Override Absolute Value?
« Reply #8 on: December 21, 2016, 04:13:04 PM »
Thanks for the help Daz and Chaoticone, got it working well now

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Feed Rate Override Absolute Value?
« Reply #9 on: December 21, 2016, 04:34:39 PM »
Good deal!

How about tell us or show us what you did. It may answer others questions.
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!