Hello Guest it is March 28, 2024, 09:41:33 AM

Author Topic: help required for Reference all Axis script  (Read 831 times)

0 Members and 1 Guest are viewing this topic.

help required for Reference all Axis script
« on: May 31, 2020, 03:52:36 AM »
Dear all
 I would really appreciate anyone who could help me sort out this screen function I am trying to modify.
I would like the machine to perform a G0 Z20 before starting the ref all axis routine.
I tried this but it does not work
It just goes to Z20 and ignores the rest
Any help would be greatly appreciated

 mc.mcCntlGcodeExecute(inst, 'G00 Z20')
    mc.mcAxisDerefAll(inst)  --Just to turn off all ref leds
    mc.mcAxisHomeAll(inst)
    coroutine.yield() --yield coroutine so we can do the following after motion stops
    ----See ref all home button and plc script for coroutine.create and coroutine.resume
    wx.wxMessageBox('Referencing is complete')
end
Re: help required for Reference all Axis script
« Reply #1 on: May 31, 2020, 07:19:42 AM »
Hi,
so you want the machine to go to Z20 before you start.....but where is Z20?......if your machine is referenced already then yes Z20
makes sense but if its not referenced then G0 Z20 could be anywhere. I can't quite see the logic of what you are trying to achieve.

That does not change the fact that you have coded  incorrectly.

the Line:
mc.mcCntlGcodeExecute(inst, 'G00 Z20')
starts the move, but while the move is still executing the function returns. You need to use:

mc.mcCntlGcodeExecuteWait(inst,'g0z20')

As a side matter Machs Gcode interpreter converts all Gcode to lowercase, strips out leading zeros and whitespace. Thus 'G00 Z20'
becomes 'g0z20' It should, in theory, mean the same thing, but there are occasions when the translation does not work and you will
struggle to identify the fault. My suggestion is to write the Gcode exactly as the interpreter requires rather than rely on its translation
of what you have written.

Craig


'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline Stuart

*
  •  311 311
    • View Profile
Re: help required for Reference all Axis script
« Reply #2 on: May 31, 2020, 09:15:49 AM »
Craig
Beat me to it I was just about to post since I read this earlier but had a part on the mill first run new code you know the drill.

Anyway I concur entirely where I’d the move starting from z20 from ............ I do not know

perhaps the OP Could enlighten use to the type of mill/router . Does it have home limits  or is it home in place

I am lost with this one

Stuart
Re: help required for Reference all Axis script
« Reply #3 on: May 31, 2020, 06:33:41 PM »
Thank you both for your kind attention

The request is for the situation where the machine is referenced already. As the origin of the workpiece that I have is nearly always away from the machine origin I frequently require to perform the ref all axis . Many times I do it with the spindle deep in the material as I forget to raise it before performing the ref all axis.
The sequence I follow is to lift the z axis well above the work surface then perform the X and Y ref and finally the Z which is located at the position x=0 and y=0. My z probe is adjustable and I align it with the work surface for each job.
For a tool change i would ref all axis , perform the change and perform the ref all axis function.