Hello Guest it is March 28, 2024, 07:57:43 AM

Author Topic: Just baffled by G54-56 Offsets  (Read 2707 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,965 6,965
    • 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,295 6,295
    • 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
ZOffset=GetVar(5223)
ElseIf CurrentOffset = 2 Then
ZOffset=GetVar(5243)
ElseIf CurrentOffset = 3 Then
ZOffset=GetVar(5263)
ElseIf CurrentOffset = 4 Then
ZOffset=GetVar(5283)
ElseIf CurrentOffset = 5 Then
ZOffset=GetVar(5303)
ElseIf CurrentOffset = 6 Then
ZOffset=GetVar(5323)
End If

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

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
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.