Hello Guest it is July 12, 2020, 09:16:36 PM

Author Topic: Just baffled by G54-56 Offsets  (Read 2101 times)

0 Members and 1 Guest are viewing this topic.

Just baffled by G54-56 Offsets
« on: May 14, 2011, 11:52:01 AM »
Hi, I've been trying to write a macro to set my Z offsets to the same number whether I am using G54 through G59.

See Macro below. I have noticed that without the wait states Mach will not update the Dro's quickly enough and the Z Dro's are still different even with running the macro.

If I single step through the macro, it seems to work as I intended.

Is there another way to achieve the same thing with one command?

Offline BR549

  •  6,932 6,932
    • View Profile
Re: Just baffled by G54-56 Offsets
« Reply #1 on: May 14, 2011, 05:59:44 PM »
OK to start with the use of Code"G4P2" does not really do anything inside of the macro. It is a Gcode pause not VB.

Use while is moving() or sleep

On some systems (computer) you have to add wait states in order for everything to have time to execute OR mach will skip over things as you have seen.

It is just a matter of getting the wait states correct for YOUR system and it will run.

IF you can step through the code and it functions then it is a matter of timing the VBcode to run correctly.

Just a thought, (;-) TP

Offline ger21

  • *
  •  6,282 6,282
    • View Profile
    • The CNC Woodworker
Re: Just baffled by G54-56 Offsets
« Reply #2 on: May 14, 2011, 11:14:07 PM »
I do it like this:

CurrentOffset = GetOEMDRO(46)  ' Get Current Coordinate system 1 = G54, 2 = G55, ....

If CurrentOffset = 1 Then
ElseIf CurrentOffset = 2 Then
ElseIf CurrentOffset = 3 Then
ElseIf CurrentOffset = 4 Then
ElseIf CurrentOffset = 5 Then
ElseIf CurrentOffset = 6 Then
End If

For X = 5223 To 5323 Step 20
SetVar(X, ZOffset)
Next X

2010 Screenset

JointCAM Dovetail and Box Joint software
Re: Just baffled by G54-56 Offsets
« Reply #3 on: May 15, 2011, 10:40:20 AM »
Thanks guys for the advice, As you can see in my macro I was getting desparate and willing to try anything.

On reflection it seems writing to the Dro's in turn and waiting for them to update is a slow way of doing things. I increased the sleep times to 450 and still had problems with some of the offsets not getting set correctly.

Thanks for the script Gerry, I'll give that a go. Looks very tidy.