Hello Guest it is May 14, 2021, 02:15:45 AM

Author Topic: Return to current fixture after running gcode run  (Read 273 times)

0 Members and 1 Guest are viewing this topic.

Offline DAAD

*
  •  103 103
    • View Profile
Return to current fixture after running gcode run
« on: April 16, 2020, 02:34:32 PM »
I'm writing a script which involves using G59 fixture to locate my spindle and router setup to a specific point.
After the code has run i want it to return to the current fixture for example G54/G55.
Anyone who knows with api or variable i need to call and save to get this information?

I've looked trough the list, but don't seem to find the aswer to my question.

Is this even possible?

added som code to show what i want to do:

Code: [Select]
function zControl.ProbeMBZ()
mc.mcCntlSetLastError(inst, "Goto machine bed probe point")
mc.mcCntlGcodeExecute(inst, "G00 G90 G53 Z-20 A-20\n G59 X0 Y0\n G54 ") --Use G59 as workpiece zero for position Return to G54
wx.wxMessageBox("Load the correct tool & lower the bit within 50mm before probing. Attach the MAGNET!!!","If not abort",16)
mc.mcCntlSetLastError(inst, "Probing in progress!")
mc.mcCntlGcodeExecuteWait(inst,"G91 G31 Z-50 F200")
--local ToolSet = -12.8 -- Toolset plate difference machine bed / plate
mc.mcAxisSetPos(inst, mc.Z_AXIS, ToolSet)
mc.mcCntlGcodeExecute(inst,"G00 G90 G53 Z-20")
end

Adam

Keep Safe!
« Last Edit: April 16, 2020, 02:46:09 PM by DAAD »

Offline Graham Waterworth

*
  • *
  •  2,322 2,322
  • Yorkshire Dales, England
    • View Profile
Re: Return to current fixture after running gcode run
« Reply #1 on: April 16, 2020, 05:32:20 PM »
Fixture offsets # numbers

#2501 = G54 X or #5221
#2601 = G54 Y or #5222
#2701 = G54 Z or #5223

#2502 = G55 X or #5241
#2602 = G55 Y or #5242
#2702 = G55 Z or #5243
« Last Edit: April 16, 2020, 05:35:27 PM by Graham Waterworth »
Without engineers the world stops

Offline DAAD

*
  •  103 103
    • View Profile
Re: Return to current fixture after running gcode run
« Reply #2 on: April 16, 2020, 05:43:10 PM »
Thanks!

What i want is that the script “chooses” the correct fixture i am in. For example i am in g56 and do a probe. It returns automatically to the fixture i was in. This way i would prevent screw ups if i dont goto the correct fixture offset.

Offline Graham Waterworth

*
  • *
  •  2,322 2,322
  • Yorkshire Dales, England
    • View Profile
Re: Return to current fixture after running gcode run
« Reply #3 on: April 16, 2020, 05:50:16 PM »
#4014 holds the current fixture offset
Without engineers the world stops

Offline DAAD

*
  •  103 103
    • View Profile
Re: Return to current fixture after running gcode run
« Reply #4 on: April 16, 2020, 05:54:05 PM »
Thank you sir!

Will try to script it tomorrow.

Offline DAAD

*
  •  103 103
    • View Profile
Re: Return to current fixture after running gcode run
« Reply #5 on: April 17, 2020, 06:32:10 AM »
worked out perfectly!

code below:

Code: [Select]
function ProbeMBZ()
mc.mcCntlSetLastError(inst, "Goto machine bed probe point")
local val = mc.mcCntlGetPoundVar(inst, mc.SV_MOD_GROUP_14) --PoundVar 4014 coordinates sytem
local msg = "G00 G90 G53 Z-20 A-20\n G59 X0 Y0\nG"..val--Use G59 as workpiece zero for position Return to current fixture
mc.mcCntlGcodeExecute(inst, msg) --Use G59 as workpiece zero for position Return to G54
wx.wxMessageBox("Load the correct tool & lower the bit within 50mm before probing. Attach the MAGNET!!!","If not abort",16)
mc.mcCntlSetLastError(inst, "Probing in progress!")
mc.mcCntlGcodeExecuteWait(inst,"G91 G31 Z-50 F200")
--local ToolSet = -12.8 -- Toolset plate difference machine bed / plate
mc.mcAxisSetPos(inst, mc.Z_AXIS, ToolSet)
mc.mcCntlGcodeExecute(inst,"G00 G90 G53 Z-20")
end