Hello Guest it is April 26, 2024, 03:11:53 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Cbyrdtopper

261
Mach4 General Discussion / Re: RefAllHome - then back off.
« on: March 25, 2019, 08:09:59 AM »
API Document in the Docs folder in your Mach4 folder.

262
Mach4 General Discussion / Re: RefAllHome - then back off.
« on: March 24, 2019, 08:12:19 PM »
That's strange. 
Running in MDI it will allow me to use G01 and a feedrate with G53.

263
Mach4 General Discussion / Re: RefAllHome - then back off.
« on: March 24, 2019, 07:42:12 PM »
I'm not sure, maybe it needs to be negative the way your machine is set up.  Manually move the machine to where you want it and see what the machine position is, toggle "Machine Coordinates" or look on the Diagnostics tab.

Also, what does the last line mean?  You can't use G01 and G53 together?

264
Here is what I came up with; I made two buttons and put the code in the Clicked Script inside the button, you can make it a function if you like, but these work to increase and decrease the jog rate by 10%.  You can change that to whatever you like, or add another button to change the resolution of change.


--Jog Rate +10%
local inst = mc.mcGetInstance()
local CurrentRate = mc.mcJogGetRate(inst, 1)
local JogRate = (CurrentRate + 10)
if JogRate <= 100 then
    mc.mcJogSetRate(inst, 0, JogRate)
    mc.mcJogSetRate(inst, 1, JogRate)
    mc.mcJogSetRate(inst, 2, JogRate)
else if JogRate > 100 then
    mc.mcCntlSetLastError(inst, "Can't set Jog Rate higher")
end
end

--Jog Rate -10%
local inst = mc.mcGetInstance()
local CurrentRate = mc.mcJogGetRate(inst, 1)
local JogRate = (CurrentRate - 10)
if JogRate >= 10 then
    mc.mcJogSetRate(inst, 0, JogRate)
    mc.mcJogSetRate(inst, 1, JogRate)
    mc.mcJogSetRate(inst, 2, JogRate)
else if JogRate < 10 then
    mc.mcCntlSetLastError(inst, "Can't set Jog Rate Lower")
end
end

Also,
There is a little glitch; this occurred to someone else, I just remembered that they mentioned it happens so be aware of it.
It won't display correctly when you lower it below 50% unless you first change it to 0% and then you can freely raise and lower it from 0-100%.
I don't know why, that's the way it is.  So, when you start, just manually change the jog rate to 0% and you'll be good to go.

Also, looking at your code, maybe change the Axis to an integer instead of writing out the axis, your code may work just fine.

265
Mach4 General Discussion / Re: RefAllHome - then back off.
« on: March 24, 2019, 06:11:15 PM »
Try changing this line:
mc.mcCntlMdiExecute(inst, "G00 F25 X2 Y2") -- move away from the corner -mac

to this:
mc.mcCntlMdiExecute(inst, "G00 G53 X2. Y2.") -- move away from the corner -mac

You are not specifying the work offset (G54-G59), so it will default to whatever is active; this means that it will move to where ever the work offset thinks is X 2.0 and Y 2.0 and then call it X and Y 0.00. 

G53 is machine position; so when you move to Machine Position X 2. and Y 2. then it will move 2 inches off the home switches and then call them  0.00.  G53 is non modal so it will only be called on the line that is being processed, then it will revert back to the active work offset.
Also, you have an F25 in there, that is not going to do anything unless you use a G01 (Feed Move) instead of a G00 (Rapid).

266
Once I get home to my laptop I will proof some code out and post it.   

267
I think the jog functions need an axis.  So when you get and set the jog rate you need to set it for each axis.   I ran into this problem about a month ago.   
Mc.jog (inst, Axis#, jog rate)
I can't double-check this right now, I'm not at home, but I think that is what it is looking for.  You will need 3 lines to set it for X, Y, and Z.

268
I can't see the code, the picture is too small.
Can you just copy the code into the thread?

269
Mach4 General Discussion / Re: Spindle warm
« on: March 22, 2019, 10:16:28 PM »
I'm with craig, I can't see anything wrong with the code either.
However, why don't you just make a G Code file to warm up your spindle?

%
(Spindle Warm Up)
S12000 M3
G04 P240.0 (4 Min)
S18000
G04 P240.0 (4 Min)
M5
M30
%


I made a G Code file to warm up the spindle, I just keep it saved in my G Code Folder.

You can still put it in a button and make that button call a sub program.
You can save the spindle warm up program as a subprogram, and save it in the Subprogram folder in the Mach4 directory; save it as O9000 or something like that.
Then in the button script, use the MdiExecute API to call the subprogram.  M98 P9000

270
That'w what I was going to suggest. 
It homes as if you clicked the Reference button; command a G53 move close to Axis Zero.