Hello Guest it is April 26, 2024, 07:41:41 AM

Author Topic: Resetting machine coordinates in G code program  (Read 16131 times)

0 Members and 1 Guest are viewing this topic.

Re: Resetting machine coordinates in G code program
« Reply #10 on: June 30, 2015, 10:03:54 AM »
There are two reasons I want to reset machine coordinates to home after each piece.

First off the preconfigured homing sequence would put the wire in just the right spot. I can even use the home off of switch distance to calibrate the exact distance easily.

These pieces are being bent off of a spool. With the DRO reading in millimeters and each part being roughly 2.5 to 3 meters long the DRO numbers get very big quick.
Re: Resetting machine coordinates in G code program
« Reply #11 on: June 30, 2015, 10:21:02 AM »
So, is there a way to execute the function that is triggered by the screen button called "btnRefX"? If I couldn't execute this button from within my G code program all of my problems would be solved.

dan
Re: Resetting machine coordinates in G code program
« Reply #12 on: June 30, 2015, 01:05:32 PM »
Can you use G53? G53 can send the axis back to home position in machine coordinates.  btnRefX just calls mc.mcAxisHome(inst, 0)  --0 is the X axis id

G53 X0.0

although, try this instead....it would make me feel better, haha

G53 Z0.0
G53 X0.0

If you must "Re-home" the axis and not just send the axis back to home position (machine coordinates) then you would have to pause the run, execute mc.mcAxisHome(inst,0), then return and restart the run (similar to the m6 Tool Change macro) We can code this so it is automated like you wish. I would just have to work on it....I have an idea, to be continued...
« Last Edit: June 30, 2015, 01:14:21 PM by Screwie Louie »
Re: Resetting machine coordinates in G code program
« Reply #13 on: June 30, 2015, 01:29:04 PM »
It just clicked in my head, nevermind G53...it isn't what you want.
Re: Resetting machine coordinates in G code program
« Reply #14 on: June 30, 2015, 02:21:46 PM »
Inks Louie,

That is exactly what I want to do. I tried executing this but it said "Lua error occurred while opening file" when I entered M 100 in the MDI field. Any suggestions would be greatly appreciated.

function m100()
    inst=mc. mc.mcAxisHome(inst, 0)
   
end

if (mc.mcInEditor() == 1) then
    m100()
end

dan
Re: Resetting machine coordinates in G code program
« Reply #15 on: June 30, 2015, 03:17:00 PM »
close!...for example this macro just resets the X DRO in work coordinates:

function m100 ()
    local inst = mc.mcGetInstance ()
    mc.mcAxisSetPos (inst, 0, 0.0)
    mc.mcCntlSetLastError (inst, "Reset X Axis position.")
end

It will not change the machine coordinate DRO.

But you want to actually go through the homing process. For this we need to put the machine state into idle in order to let the axis home, then wait until the axis is homed before moving onto the next block. There are a couple things I'm gonna try and let ya know.
Re: Resetting machine coordinates in G code program
« Reply #16 on: June 30, 2015, 03:42:26 PM »
Louie

I don't really understand the first part of your last email. If it's not resetting the machine coordinates DRO what did it do?

Thank you very much for your offer to poke around with running the  axis homing sequence somehow. Very much appreciated.

dan
Re: Resetting machine coordinates in G code program
« Reply #17 on: June 30, 2015, 03:55:11 PM »
It resets your X axis work offset coordinates back to zero.

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: Resetting machine coordinates in G code program
« Reply #18 on: June 30, 2015, 05:57:01 PM »
dandonegan there`s lot`s of ways to do what you wont can you supply more info on how you are going to go about running the wire bender are you going to use a gcode, dro`s to set bend`s
 and how you are moving the wire into the machine.

if you are doing it in a G code just have it goto machine zero at the end of the G code, just give Screwie Louie all and any info you can and ideas
Re: Resetting machine coordinates in G code program
« Reply #19 on: June 30, 2015, 09:57:34 PM »
I am mending wire are similar to a spring forming machine. The material is being set off of a spool and being fed into the machine by the X axis motor. Those z-axis has a roller which is moving back and forth to bend of the wire as the X axis feeds it passed. I am currently using G code with X and Z movements. The wire that I am bending has perforations. What I would like to do is have a block of code at the beginning of each cycle of the program that would run the X axis homing sequence. This would work in conjunction with a photo eye to align the notches for the next part. It would also prevent the DRO from running up to ridiculous numbers. Particularly seeing as how we are running in millimeters. There is a button on the current machine diagnostics page that performs the function that would work for me; it is labeled "RefX". Is there a way to execute this function from within a G code program?

dan