Hello Guest it is October 30, 2020, 09:32:56 AM

Author Topic: Moving off home switch during RefAllHome ? (Mach4)  (Read 5860 times)

0 Members and 1 Guest are viewing this topic.

Moving off home switch during RefAllHome ? (Mach4)
« on: June 23, 2016, 06:55:24 AM »
I would like to include a movement off my home switches during a RefAllHome action.  I understand this is possible by editing the RefAllHome scripts but need some guidance in finding this script and then how to edit.  I assume that this edit will simply be increasing an existing value in the script as the standard home script must already have some value to 'back off' the switch. 
Thanks in advance - Wado.

Why?... well my home switch is a mechanical plunger which is located about 1/8" after my limit switch and therefore after home is found the machine is in an limit error state.  I can override the limits and go to 0 when using a home offset but I'd rather have this automated directly into the RefAllHome function.

Offline DazTheGas

  •  752 752
  • DazTheGas
    • View Profile
Re: Moving off home switch during RefAllHome ? (Mach4)
« Reply #1 on: June 23, 2016, 11:04:47 AM »
There is a setting in the mach config panel called "Home Offset" this will do it for you.

Theres always time for a choccy biccy

Offline Chaoticone

  • *
  •  5,628 5,628
  • Precision Chaos
    • View Profile
Re: Moving off home switch during RefAllHome ? (Mach4)
« Reply #2 on: June 23, 2016, 11:23:05 AM »
Not sure how much luck your going to have if limits are active at end of homing routine. Sounds like they are positioned exactly backwards. Limits should not be active when homing (unless they are both the same switch) but home switch being active when limit is is not an issue. Home switches are only looked at while homing. Limits are watched all the time (except in homing routine if the home and limit switch are one in the same).

I just added some things to help with this exact scenario. You will need to get the prerelease discussed here http://www.machsupport.com/forum/index.php/topic,27039.msg227697.html#msg227697

Once you have it installed and have created your own custom profile open the custom profile and choose operator, edit screen.

The first thing to do is save the screen as something unique.

Then edit the RefAllHome function in the Screen Load Script to do what you want. It will look something like this.....

Code: [Select]
function RefAllHome()
    mc.mcAxisDerefAll(inst)  --Just to turn off all ref leds
    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')
    mc.mcCntlGcodeExecute(inst, G0 G53 X10 Y10)

You might find this video helpful too. https://www.youtube.com/watch?v=TH944Qq86kc
;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!
Re: Moving off home switch during RefAllHome ? (Mach4)
« Reply #3 on: June 27, 2016, 06:54:52 AM »
Daz - I actually have that feature working ok - just want to automatically move to that value now.

Chaoticone - thanks for the info - I'll likely wait until this version becomes official and then give it a go then as I still have other items to work out.

Re: Moving off home switch during RefAllHome ? (Mach4)
« Reply #4 on: July 15, 2016, 11:20:14 AM »

I am not using any external home/limit switch on my cnc. and when I enable machine coordinates and drive x-axis it shows maximum 5 inches, whether my cncX-axis is about 96 inches. same is the problem with Y-axis.
how can I set the coordinates without using any external limit switches

Re: Moving off home switch during RefAllHome ? (Mach4)
« Reply #5 on: July 15, 2016, 04:27:58 PM »
If you don't have home switches, you need to enable the "home in place" feature in Mach4, as follows:

(1) Go to the "Configure" menu and select "Mach4...".
(2) Click on the "Homing/SoftLimits" tab
(3) For each of your axes, put a green check mark in the "Home In Place" column.
(4) Click on 'OK" to save the settings.

Now, jog each axis of the machine to the place you want to be "home" (i.e. zero).  Once all of the axes are in place, click on the "Reference All Axes (Home)" button on the main Mach4 tab (presuming that you are using the "wx4" screen set).  This will set the current position of each axis as that axis' "zero" position.

If you only want to home one axis at a time, click on the "Machine Diagnostics" tab.  In the top center of that screen you will see "Ref X", "Ref Y", etc. buttons.  Jog the X axis to where you want zero to be then click on the "Ref X" button.  Then jog the Y axis to where you want it's zero to be and click on the "Ref Y" button.  Then do the same for the Z axis.

There is no need to switch in and out of machine coordinates.  Leave machine coordinates turned off so that you are displaying "user" coordinates as this is what any GCode commands and any soft limit settings reference.

Re: Moving off home switch during RefAllHome ? (Mach4)
« Reply #6 on: July 18, 2016, 08:16:26 AM »
I worked on it.. And by "Refrence all axes(home)" button , do you mean it to set it before cutting? As in I set the refrence point perticularly for that design.

Or if you meant to set it for setting the coordinates, then how can I set the maximum and minimum limit for all the axis.
Re: Moving off home switch during RefAllHome ? (Mach4)
« Reply #7 on: July 18, 2016, 09:22:22 AM »
First: I was wrong about soft limits referencing "user" units.  Soft limits always apply to "machine" coordinates.  GCode motions *does* apply to "user" units.  Sorry for the confusion.

The "Reference All Axes (Home)" button sets a known position relative to the absolute position of the axes (usually 0,0,0 but not always).

A typical startup procedure for machines without home switches looks like this:
- Power on the machine and start Mach4

- Manually jog the machine to a known position (usually this is at or near the limits of travel, though some people use the center of travel), then click on "Reference All Axes (Home)".  This sets the "machine coordinates" to whatever values you have in the "Home Offset" column of the "Homing/SoftLimits" configuration tab.
Note that your soft limits should be defined based on THIS position.  Also, you must have the "Home in Place" feature checked in the "Homing/SoftLimits" configuration tab in order for this to work.

- Put your work piece on the machine

- Position your machine to the reference point for the work piece.  This is usually the position that the GCode will use as zero.

- Click on the "Zero X", "Zero Y" and "Zero Z" buttons to set "user" coordinates for use with your GCode.

Now you are ready to run your GCode file, and the soft limits will prevent any Mach4-generated motion (GCode, jogging, etc.) from going beyond the allowable MACHINE coordinates.

Re: Moving off home switch during RefAllHome ? (Mach4)
« Reply #8 on: July 20, 2016, 03:30:25 PM »
Thank you bob,
It helped alot. But it do not help when I ckick zero X, zero Y, zero Z. The point where I have to start my design I jog the machine at that point and then click "refrence all axes". It makes the three axis zero. And then follow the code. But I am confuse about it because this method also disturb the max and min soft limits.

And one more thing . The gcode shape that appears in mach4 right in the cnc coordinates. The machine starts cutting right at that point where the shape appears. How can I relocate thee shape within the given coordinates.
Re: Moving off home switch during RefAllHome ? (Mach4)
« Reply #9 on: July 20, 2016, 05:45:21 PM »
"Ref All Home" is *not* meant to zero the axes when you jog to your work piece.  That is what the individual "Zero X", "Zero Y" and "Zero Z" buttons are for.  You should only do the "Ref All Home" one time after starting the machine and Mach4, and that should be done with the axes jogged near the limits of travel, and at the position on which you base the soft limit settings.  This sets the "Machine Coordinates".

Then, jog to what you want to be the zero reference point of your work piece (i.e. where ever the GCode file considers (0,0,0)), then click on "Zero X", "Zero Y" and "Zero Z".  This set what I call the "user" coordinates, which are used for the GCode file movement.  This will NOT change the soft limits, as they *always* are in "machine" units.  It may *look* like it changes the soft limits.

For example: You jog near the lower left corner of your usable travel and click "Ref All Axes (Home)".  The DROs now how all zeros (presuming that your "Home Offset" is zero for each axis).  At this point, the machine units and user units are the same.

Now presume that your X axis soft limits are 0 to 10.  Mach4 won't let you jog beyond 0 or +10 in either machine or user units (because they are the same, so far).

Now, jog the X axis to 1.000 and click on "Zero X".  You are now are 1.000 in machine units and 0.000 in user units.  The soft limits are still 0.0 to +10.0 in MACHINE units, but in user units they are -1.0 to +9.0.  You haven't actually changed the soft limits.  You've just shifted the user units.

OK, now on to your real question: "how can I relocate the shape within the given coordinate"?  Does the Mach4 toolpath display show your shape starting at (0,0)?  Or is it offset from that?  If it is offset (i.e. not starting at 0,0) then you need to figure out where the GCode file thinks zero is relative to the shape.  Or you can use probing to determine work offsets.  This is beyond my knowledge.  I suggest you start another thread (i.e. new subject, something like "how do I set work offsets") and hopefully someone else will respond.