Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: ronny on December 09, 2014, 10:00:05 PM

Title: neww help for script and button.
Post by: ronny on December 09, 2014, 10:00:05 PM
Hllo,

i have a cnc machine to cut kite board. i usually mill the top and turn the board and mill the bottom. my problem is that when i turn the board i have to line it up perfectly to match  the top cut so i made a laser that i turn on on the output 2 (i use the mist button) and i bring my machine to the center of the board so the laser can be seen on the middle of the board.

i need a button that would say "center board" that would go to this location Y-380 and turn on the laser all in one. would that be difficult for someone that knows what to do?

i tried and i am terrible. did ok at building the machine but the computer part is difficult for me.
i would be happy to pay for time.
Title: Re: neww help for script and button.
Post by: Chaoticone on December 10, 2014, 12:35:32 AM
This has no checks in it (I would at least add a move to get the Z up if it wasn't already) and you may want to change the output to something other than 2 if you have it configured for mist.

Code: [Select]
Code "G00 Y-380"
While IsMoving ()
Sleep 100
Wend
ActivateSignal(OUTPUT2)
Title: Re: neww help for script and button.
Post by: dude1 on December 10, 2014, 03:15:03 AM
zero laser (put it in a button script)

Xs = GetOemDRO(59) 'X-Scale DRO
Ys = GetOemDRO(60) 'Y-Scale DRO
Xmove = -73.3844 * 1/Xs 'Move distance adjusted for X-Scale factor
Ymove = 10.7438 * 1/Ys 'Move distance adjusted for Y-Scale factor
DeActivateSignal(OUTPUT5) 'Turn off laser
Code "G91 G0 X" &Xmove & "Y" &Ymove ' Makes an incremental move the distances that you set
While IsMoving () ' Waits while that happens
Wend
Code "G90" 'Goes back to absolute moves
DoOEMButton (1008) 'Zero X-Axis DRO
DoOEMButton (1009) 'Zero Y-Axis DRO

Laser on off (put it in button script)

f IsOutputActive(OUTPUT5) Then ‘Check to see if its on
DeActivateSignal(OUTPUT5) ‘Its on so turn it off
Else
ActivateSignal(OUTPUT5) ‘Its off so turn it on
End If

this code is from http://www.cooperman.talktalk.net/files/17.htm

I use it every day it works every time for info of how to use it look at web site all thanks go to tweakie.

just edit it to your needs
Title: Re: neww help for script and button.
Post by: ronny on December 10, 2014, 12:59:10 PM
Thanks! will try that,

as for a button do i make one on illustrator and somehow insert it in the gui?

i can design a button that will look decent but not so sure i can insert it . i downloaded the designer, i think its out of my league if someone can help.

thanks friends
Title: Re: neww help for script and button.
Post by: ronny on December 10, 2014, 03:26:58 PM
works,

downloaded mach screen,

made a button, press execute code, entered the code posted above and boom!

thanks so much!


Title: Re: neww help for script and button.
Post by: dude1 on December 10, 2014, 04:57:36 PM
no problem but go read the info on tweakie`s web site for it so you under stand what's going on