Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 06:16:11 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  General Mach Discussion
| | |-+  Zeroing Multiple Z Offsets
Pages: 1   Go Down
Print
Author Topic: Zeroing Multiple Z Offsets  (Read 333 times)
0 Members and 2 Guests are viewing this topic.
dfurlano
Active Member

Offline Offline

Posts: 246


View Profile
« on: March 15, 2011, 04:57:03 PM »

I use the tool macro to set the Z offset:

Call setdro (2,platethickness)

This sets whatever offset you have enabled which is usually G54.  But I would like to set multiple offsets at once like G54, G55, G56, and G57.

Is there are command that I can use to do this?

TIA

Dan.
Logged
ger21
Global Moderator
*
Offline Offline

Posts: 2,619



View Profile WWW
« Reply #1 on: March 15, 2011, 05:06:22 PM »

I do it this way. After zeroing in the current offset, I retrieve that offset and change the other's to match.

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)
Logged

dfurlano
Active Member

Offline Offline

Posts: 246


View Profile
« Reply #2 on: March 15, 2011, 07:00:31 PM »

For some reason this does not work...  G54 gets set to the correct value but the others are all off by some offset.  I tried zeroing all the values in the tool table before I started but that did not work.  I also tried adding a call and a code in front of the setvar and that did nothing.



CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state
PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO


DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P2" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31 Z-1 F5" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the axact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, PlateThickness) 'set the Z axis DRO to whatever is set as plate thickness
Code "G4 P0.25" 'Pause for Dro to update.
SetVar(5243, PlateThickness)
Code "G4 P0.25" 'Pause for Dro to update.
SetVar(5263, PlateThickness)
Code "G4 P0.25" 'Pause for Dro to update.
SetVar(5283, PlateThickness)
Code "G4 P0.25" 'Pause for Dro to update.
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If
Exit Sub    
« Last Edit: March 15, 2011, 07:02:25 PM by dfurlano » Logged
dfurlano
Active Member

Offline Offline

Posts: 246


View Profile
« Reply #3 on: March 15, 2011, 07:15:20 PM »

When I look in the Mach3 manual in section 10 is says that variable 5244 is offset 2 Z, then 5263 is offset 3 Z, and 5283 is offset 4 Z.
Logged
ger21
Global Moderator
*
Offline Offline

Posts: 2,619



View Profile WWW
« Reply #4 on: March 15, 2011, 07:17:39 PM »

Your code works fine, but you're not setting the right value.

The Plate Thickness is not the offset. When you set the Z DRO to the plate thickness, the offset is the current machine coordinate - plate thickness.

For your other offsets, you're just setting the plate thickness.

That's why I read the actual offset from the current coordinate system, then assign that actual offset to the other coordinate systems.
Logged

ger21
Global Moderator
*
Offline Offline

Posts: 2,619



View Profile WWW
« Reply #5 on: March 15, 2011, 07:18:31 PM »

That's a typo in the manual, it's 5243.
Logged

dfurlano
Active Member

Offline Offline

Posts: 246


View Profile
« Reply #6 on: March 15, 2011, 07:34:34 PM »

Thank you.
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!