Hello Guest it is May 05, 2021, 09:21:06 PM

Author Topic: Metric and Imperial Auto Tool Zero Plate  (Read 10679 times)

0 Members and 1 Guest are viewing this topic.

Metric and Imperial Auto Tool Zero Plate
« on: September 11, 2009, 09:39:28 AM »
I created 2 profiles one for metric and one imperial. Both work fine except for the custom auto-tool-zero script. It is obvious that the code is for either metric or imperial and cannot switch. I can do the coding if I know the name of the global variable that tells Mach3 what units it is using.
Can anyone help me out, or maybe someone has already modified the code to account for switching between metric and imperial.
Thanks

Offline poppabear

*
  • *
  •  2,233 2,233
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: Metric and Imperial Auto Tool Zero Plate
« Reply #1 on: September 11, 2009, 09:48:37 AM »
post you code here, and we can help you to make it work like you want.

scott
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/
Re: Metric and Imperial Auto Tool Zero Plate
« Reply #2 on: September 11, 2009, 09:57:09 AM »
This is the code from hoss2006 screen the code on the maching that is connected to the mill is slightly different but same issue.
All the movement lines need to reflect the current profile either metric or imperial. Like I said I can do the coding and really would like to, if I knew if there is a Mach3 constant/variable that holds the current profiles units mode ie: 0 for metric, 1 for imperial.


Code: [Select]
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

If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
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 G31Z-2.0 F4" '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.
Code "G1 Z1.0 F20" 'put the Z retract height you want here
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
End If
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

Offline poppabear

*
  • *
  •  2,233 2,233
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: Metric and Imperial Auto Tool Zero Plate
« Reply #3 on: September 11, 2009, 10:09:35 AM »
Ok I see what you want,

Use "GetOEMLED(801)"  if this is ON then you are in English, if 0 then metric.

Set up a scaling variable that you multiply all your moves by, depending on the value of the measurment system used.

scott
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/
Re: Metric and Imperial Auto Tool Zero Plate
« Reply #4 on: September 11, 2009, 10:32:14 AM »
Yep that is what I'll do, thanks for the help.
Re: Metric and Imperial Auto Tool Zero Plate
« Reply #5 on: September 11, 2009, 10:37:54 AM »
I forgot to ask, is there a PDF listing of all the OEMLED Codes?

Offline budman68

*
  • *
  •  2,354 2,354
    • View Profile
Re: Metric and Imperial Auto Tool Zero Plate
« Reply #6 on: September 11, 2009, 10:58:53 AM »
I believe this may be what you're after? Read the first post in the thread and the codes are there for downloading but it's an xls file.

http://www.machsupport.com/forum/index.php/topic,6657.0.html

Dave
----------------------------------------------------------------------
Just because I'm a Global Moderator, don't assume that I know anything !

Dave->    ;)

Offline Greolt

*
  •  956 956
    • View Profile
Re: Metric and Imperial Auto Tool Zero Plate
« Reply #7 on: September 11, 2009, 07:09:49 PM »
I created 2 profiles one for metric and one imperial. Both work fine except for the custom auto-tool-zero script.

If using a profile for metric and a profile for imperial why not just have a screen set for each. 

So metric profile uses the metric screenset and the imperial profile uses the imperial screenset.

A Button Script, if that is what you are using, lives in the screenset.

Greg
Re: Metric and Imperial Auto Tool Zero Plate
« Reply #8 on: September 11, 2009, 09:48:09 PM »
I'm using the MachBlue screen set and really like it. It should not be too much trouble to add an if statement here and there.

Offline Greolt

*
  •  956 956
    • View Profile
Re: Metric and Imperial Auto Tool Zero Plate
« Reply #9 on: September 11, 2009, 09:58:28 PM »
Yes I am sure you could do that.

Or have a G21 or G20  call in the macro and then have it reset units at the end.

However a screenset  file is only about 20 or so kbs

So you could just save another version and call it "Blue Metric" or "Blue Inch"

Lots of ways to skin a cat.  :)

Greg