Hello Guest it is September 18, 2019, 09:02:57 AM

Author Topic: Offset for Laser Pointer?  (Read 1997 times)

0 Members and 1 Guest are viewing this topic.

Offset for Laser Pointer?
« on: December 28, 2013, 01:53:08 PM »
I have a couple of questions. I have looked very hard to resolve this on my own but cant seem to find the answer's. My first question is how do I program Mach to always offset form where my tool is to a laser pointer that I will install? I dont have home or limit switches so doing it that way is out. I just want to laser in on my target zero the X and Y then hit go to zero and the tool would go there. Is there a way? Also I want to create 2 buttons on the screen that turn my router and shop vac on or off, it would be a G-Code. Can this be done also? I would really appreiciate somone that could point me in the right direction? Thanks

Offline Greolt

*
  •  956 956
    • View Profile
Re: Offset for Laser Pointer?
« Reply #1 on: December 28, 2013, 03:46:21 PM »
Make an onscreen button and have it run code like this,

Code "G91 G0 X -32.5 Y -56.5" ' put the relevant offset amounts here
While IsMoving ()
Wend
Code "G90"
'set things back to absolute
Msg = "Zero X and Y DROs?" 'question for message box
Style = 4 + 32 + 0
Title = "Laser Zero"
Response = MsgBox(Msg, Style, Title)
If Response = 6 Then
'if reponse is yes then zero the DROs
SetOEMDRO (800,0)
SetOEMDRO (801,0)
End If


Change it to this if wanting to automatically zero X and Y,

Code "G91 G0 X -32.5 Y -56.5" ' put the relevant offset amounts here
While IsMoving ()
Wend
Code "G90
" 'set things back to absolute
SetOEMDRO (800,0)
SetOEMDRO (801,0)
Re: Offset for Laser Pointer?
« Reply #2 on: December 28, 2013, 04:47:01 PM »
Thanks I have found your post on CNCZOne. Now I have to figure out the screen4 editor.
Re: Offset for Laser Pointer?
« Reply #3 on: December 29, 2013, 04:14:23 PM »
Make an onscreen button and have it run code like this,

Code "G91 G0 X -32.5 Y -56.5" ' put the relevant offset amounts here
While IsMoving ()
Wend
Code "G90"
'set things back to absolute
Msg = "Zero X and Y DROs?" 'question for message box
Style = 4 + 32 + 0
Title = "Laser Zero"
Response = MsgBox(Msg, Style, Title)
If Response = 6 Then
'if reponse is yes then zero the DROs
SetOEMDRO (800,0)
SetOEMDRO (801,0)
End If


Change it to this if wanting to automatically zero X and Y,

Code "G91 G0 X -32.5 Y -56.5" ' put the relevant offset amounts here
While IsMoving ()
Wend
Code "G90
" 'set things back to absolute
SetOEMDRO (800,0)
SetOEMDRO (801,0)

Excuse me for being very green. I don't want to mess much with the screen editor, because I don't know what I am doing. So the second part of this I put in the button editor correct, if I switch the laser manually zero in on my material, then hit zero, the machine will go to the offset I put in, being the difference from the laser to my tool center? You posted this I think on the CNCZONE, maybe I will go back to that and read some more.

Offline Greolt

*
  •  956 956
    • View Profile
Re: Offset for Laser Pointer?
« Reply #4 on: December 30, 2013, 12:57:08 AM »
I don't want to mess much with the screen editor, because I don't know what I am doing.

I think that is the best way to learn.  Make a copy of the screen set and MESS WITH IT.  :)

You can't hurt anything.

Greolt
Re: Offset for Laser Pointer?
« Reply #5 on: December 30, 2013, 11:08:44 AM »
Ok I messed with the screen4 designer last night and got me a button on there and was able to edit it in Mach to do this offset thing with the script you posted. Thanks for the Zero touchplate and now the laser. Really speeds things up for me.