Hello Guest it is April 20, 2024, 12:16:08 AM

Author Topic: Setting zero positions for G30  (Read 2954 times)

0 Members and 1 Guest are viewing this topic.

Setting zero positions for G30
« on: November 12, 2017, 11:16:28 AM »
I've been trying to use G30, but it seems that no matter what I do, it always goes to machine zero (same as G28).

The Mach4 Mill GCode manual says that the #Variables for the P2 position are #5301, #5302 and #5303 (X, Y and Z respectively).  I've set those to what I want, both using MDI and using the register tool under diagnostics, to no effect.
I found what seems like a red flag, in that when I open up the Fixture Offsets window, the values I set for #5301-#5303 are showing up in the row for G58 fixture offset.
This suggests to me that these may not be the correct addresses.  Is it possible that the manual is out of date with respect to these addresses, or am I missing something?

I'm running a pretty fresh installation of Mach4 Hobby (within the last couple of weeks), 4.2.0.3481.
Re: Setting zero positions for G30
« Reply #1 on: November 15, 2021, 09:05:11 PM »
I'm also having this issue. What it's the deal?
Re: Setting zero positions for G30
« Reply #2 on: November 15, 2021, 10:58:23 PM »
Hi,
I am of the opinion that the pound variables listed in the Mach4 Mill GCode manual are incorrect.

These are I believe correct:
G 30 P2 XPOS       5351
G 30 P2 YPOS       5352
G 30 P2 ZPOS       5353
G 30 P2 APOS       5354
G 30 P2 BPOS       5355
G 30 P2 CPOS       5356
G 30 P3 XPOS       5361
G 30 P3 YPOS       5362
G 30 P3 ZPOS       5363
G 30 P3 APOS       5364
G 30 P3 BPOS       5365
G 30 P3 CPOS       5366
G 30 P4 XPOS       5371
G 30 P4 YPOS       5372
G 30 P4 ZPOS       5373
G 30 P4 APOS       5374
G 30 P4 BPOS       5375
G 30 P4 CPOS       5376

and these were excerpted from the Pound Variables list:
https://www.machsupport.com/forum/index.php?topic=40051.0

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

Offline thosj

*
  •  532 532
    • View Profile
Re: Setting zero positions for G30
« Reply #3 on: November 16, 2021, 09:17:07 AM »
I have the following in my RefAllHome script.

--Set G30 # variables, S1000, and turn on Soft Limits
   mc.mcCntlSetPoundVar(inst,5181,11.7)
   mc.mcCntlSetPoundVar(inst,5182,-.5)
   mc.mcCntlSetPoundVar(inst,5183,-.02)
   mc.mcCntlSetPoundVar(inst,5184,2.00)
   mc.mcCntlGcodeExecuteWait(inst, "S1000")
   mc.mcCntlSetLastError(inst, "G30 # Variables set, S1000 set")
   SetSoftlimits()
   
end

That sets the # variables for G30 to a distance from machine coordinate zero, where ever you want it to be. I'm sure this code could be elsewhere, but the goal is to set the # variables. You might could even set the registers or something, but I chose to code it to be safe!!

Then a Gcode line, G0 G91 G30 X0, goes there.

Strangely, to me, G0 G90 G30 X0 goes to G54 X0 first, or whatever work coordinate you're currently in, then to G30 X0. I learned this the hard way, and for me, at least, I'm usually in G90. I changed my post to post G30's this way, but if you MDI it you gotta remember that.

OH, and you need the P1 G30 # variable, IN the text file Craig referenced, but not stated explicitly as P1. P1 is just my guess and they're way outta the range of the other G30 # variables!!!

I learned all this working with Chad Byrd after he tricked Autodesk into implementing proper G30 a few years ago!!


Tom
« Last Edit: November 16, 2021, 09:21:03 AM by thosj »
--
Tom
Re: Setting zero positions for G30
« Reply #4 on: November 16, 2021, 04:33:12 PM »
Hi,
it would be possible to write a program that detects and indentifies the correct pound variable.

My idea is something like this:

1)G30 P__ X__ Y__ Z__ A__ B__ C__, but write say G30 P0 X1.23456789  where the number associated with the X axis is just some random number.
2)Then I would test each and every pound variable that seems in range, say #5000 to #5500, and test for the value of X being equal to our random number.
3)Assuming a match I would then write a second random number and again test for a match which would confirm the correspondence to a particular pound variable.

The testing of each pound variable could be done in a loop to automate it all.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Setting zero positions for G30
« Reply #5 on: November 16, 2021, 09:19:32 PM »
As the original poster from 4 years ago, I have to say that it's a bit of a sad state of affairs that this is still something that warrants reverse-engineering of Mach4 today...  :P
Re: Setting zero positions for G30
« Reply #6 on: November 17, 2021, 03:24:47 AM »
You don't really need to know the # variable number if you're programming these in lua as you can use enum e.g. mc.SV_G_30_P2_XPOS If you type the first part of this in ZeroBraneEditor then it will display the rest of them. (if you want to see this list easily go to: C:\Mach4Hobby\ZeroBraneStudio\api\lua and then open the mc.lua file in a text editor.)

If you do need to know the number for setting it via gcode then you can just add this enum to the watch window and look at it's value

Offline thosj

*
  •  532 532
    • View Profile
Re: Setting zero positions for G30
« Reply #7 on: November 17, 2021, 08:43:02 AM »
Wah, have I missed the entire point of the first two posters, one admittedly four years ago and unanswered? I thought they were trying to set # variables to some X/Y/Z/A/B/C position so that in their gcode they could have the machine go to this position. My machine does just that and I showed how I did it along with my code. What am I missing with all this programming, looping, watch windows and such?
--
Tom
Re: Setting zero positions for G30
« Reply #8 on: April 24, 2023, 01:16:56 PM »
I'm still very much inexperienced in using Mach4. I've read a ton and done my fair share of searching to get answers.

I found this post while trying to also get G30 to work since I use Fusion360's post processor for Mach4 and wanted to use the G28 retract setting. Setting it to "use G30" allow my machine to go to the rear left corner when it is done running with the correct pound variable set.

The Mach4 G-code manual states that if you use G30 and omit the P# that it would use the 2nd zero return point. Fusion's Post Process doesn't use the P# so it should be using the point held in the location for P2 # variable. The manual says p2 locations are 5301-5303 for the XYZ location. Most of the references in this forum show 5351-5353 but Tom's post said to use 5181-5183. Well, at least for me, Tom's location worked like the charm! After storing my X, Y, and Z locations in pound Variable locations 5181(x), 5182(y), and 5183(z), it worked!

I'm only posting this for future reference for others since I had a tough time finding the information needed to make the G30 work. BTW, I use an AVID Pro 4848 machine with only a slightly modified stock AVID screenset. Not sure if that changes anything about the above information.

Kenny

GOOMBA

*
Re: Setting zero positions for G30
« Reply #9 on: April 26, 2023, 11:11:53 AM »
I fixed the GCODE manual, should be updated in new builds.
I'll also attach it here, let me know if you guys need anything changed.