Hello Guest it is April 18, 2024, 08:19:38 PM

Author Topic: 2 simple lines  (Read 1001 times)

0 Members and 1 Guest are viewing this topic.

Offline Bill_O

*
  •  563 563
    • View Profile
2 simple lines
« on: March 11, 2019, 02:24:02 PM »
Why will the attached work as a button but not as a mcode?

Offline Bill_O

*
  •  563 563
    • View Profile
Re: 2 simple lines
« Reply #1 on: March 11, 2019, 03:39:37 PM »
Ignore the last 2 lines.
They are not in the one I am using.
Re: 2 simple lines
« Reply #2 on: March 11, 2019, 03:57:43 PM »
I believe the state must be 'idle' for the axes to be homed. Therefore you will not be able to use your code in an mcode. If you use the following code in your m100 script and run it, you will most likely get a return value of -18. This is error: MERROR_NOT_NOW - The operation could not be completed at this time.

Code: [Select]
function m100()
--home material and arm
local inst = mc.mcGetInstance()
local rc = mc.mcAxisHome(inst, 0)
mc.mcCntlSetLastError(inst, tostring(rc))
end

if (mc.mcInEditor() == 1) then
m100()
end
Re: 2 simple lines
« Reply #3 on: March 12, 2019, 06:30:31 PM »
Looking in the G Code Mill Manual; I see G28.1:  Home Axis.  I
I have never used this and I'm not at a machine at the moment so I can't test this, but has anyone tried this?
Chad Byrd

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: 2 simple lines
« Reply #4 on: March 12, 2019, 09:23:19 PM »
Used it in a lathe m6 this week. Works a treat (in the last dev. version I know).
;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 Bill_O

*
  •  563 563
    • View Profile
Re: 2 simple lines
« Reply #5 on: March 13, 2019, 09:43:44 AM »
We did end up using G28.1 to do the homing.
Thanks for the tip.

Bill
Re: 2 simple lines
« Reply #6 on: March 13, 2019, 11:51:32 AM »
Bill,
Glad to hear that.
How did you use it?  In the Macro?  Using the MDIExecute or GCodeExecute call?
Chad Byrd

Offline Bill_O

*
  •  563 563
    • View Profile
Re: 2 simple lines
« Reply #7 on: March 13, 2019, 11:54:39 AM »
Chad,

We used the GcodeExecute

Bill