Hello Guest it is March 29, 2024, 04:36:37 AM

Author Topic: Yes/No or Ok/Cancel dialog  (Read 7318 times)

0 Members and 1 Guest are viewing this topic.

Offline Scott

*
  •  139 139
    • View Profile
Yes/No or Ok/Cancel dialog
« on: December 22, 2006, 03:09:18 PM »
Hi,

I'm trying to script a button to run a "Logo" file at an offset location and I have a couple of questions.  First, I would like to ask a yes/no or ok/cancel question as to whether the tool is zeroed on the surface first and I'm not finding if or how I can do that.

Second, I want to do a G92 after moving to a chosen location with a "GetCoord" dialog and after a "LoadRun" of the file and completion, I want to do a 92.1.  Can I do something like close the file when it's done and then do the G92.1in the script or will I have to place the G92.1 at the end of the logo file itself?


Here's what I have so far...

'TLC Logo

Code "(TLC Logo)"
Question=Question ("Do you have the bit zeroed on the surface?")  Here is where I would like to ask Yes/No or Ok/Cancel. I know that I need a If/Then here somewhere.
GetCoord ("Desired X & Y location for offsetting the center of the logo")
Xloc=GetXCoor
Yloc=GetYCoor
Code "G0 X" &Xloc & " Y" &Yloc
While IsMoving ()
Wend
Code "G92 X0 Y0"
While IsMoving
Wend

LoadRun ("C:\Mach3\GCode\TLC Logo.tap")

Can the file be closed when it's finished and then place a G92.1 here or do I need to put it in the logo file itself and just end here?
     

Thanks,
Scott

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Yes/No or Ok/Cancel dialog
« Reply #1 on: December 22, 2006, 07:02:47 PM »
Here is a "Text box/choice box"

Adapted from the cypress enable doc's:

Sub Main ()
    Begin Dialog ZeroToolCheck 60, 60, 160, 70, "Do you have the bit zeroed on the surface?"
               
        CHECKBOX 10, 10, 48, 12, "Yes", .checkInt
        CHECKBOX 10, 30, 48, 12, "No", .checkInt

            OKBUTTON 110, 34, 40, 12
        CANCELBUTTON 110, 54, 40, 12
    End Dialog
    Dim Dlg1 As ZeroToolCheck
    Dialog Dlg1

    'MsgBox Dlg1.checkInt
End Sub

You will have to adapt it to your needs, (recommend reading the Cypress Enable doc of the support docs this website.

Scott "poppabear"


fun times
Re: Yes/No or Ok/Cancel dialog
« Reply #2 on: December 22, 2006, 08:52:55 PM »
Love it Scott! It was not that long ago you didn't know how to do stuff like this and Now here you are telling others...
Grass Hoppa  You have come far!

Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com

Offline Scott

*
  •  139 139
    • View Profile
Re: Yes/No or Ok/Cancel dialog
« Reply #3 on: December 22, 2006, 11:20:14 PM »
Thanks Scott,

I'll give that a try.  I actually have the Cypress Enable doc and I tried the Ok/Cancel part, but wasn't sure how to work with it.  That doc has so much other new-to-me stuff that it's taking me awhile to catch on and put it to use.  Thanks!

How about the G92.1, can that be put after the "LoadRun" somehow or does it have to be placed at the end of the loaded file itself?  Anyone?  By the way it seems to work, it looks like it has to be in the file otherwise it resets the coordinates right after they've been set.

Thanks,
Scott

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Yes/No or Ok/Cancel dialog
« Reply #4 on: December 23, 2006, 09:48:40 AM »
Thanks Brian!!!

Yeap, thats the truth, I had to knuckle down and learn it so I could do all the ATC work, and Wizard work I was doing. You and Art, keep pounding it in to me, and others like me, "The only way to learn it, is to look at others work for examples, read, and DO IT! So, I did.

Scott,

If I understand what your are asking, if you look in the General Config page, go down on the left columb, you will see a "Check box", for "Perform G92.1" on M30.........

Scott "Poppa Bear"
fun times

Amnz

*
Re: Yes/No or Ok/Cancel dialog
« Reply #5 on: December 23, 2006, 12:29:12 PM »
Hi Sergeant poppabear Scott!
  This is a little OT in this thread, but I was wondering if you have posted somewhere lately pictures of your developments to your machine(s).  It would be nice to see all the work you've done!

Thanks and Happy Holidays!

John (Bloy)
P.S. I always wondered how you got your machine(Shoptask) back from Iraq.

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Yes/No or Ok/Cancel dialog
« Reply #6 on: December 23, 2006, 10:57:42 PM »
Conexes, and a few buds in the Motor pool........hehehe

Can't give my secreats totally away, since I suspect I will be redeployed back to the sand box in 08 the way things are going.

I am currently working on a Swap arm and better tool holder grab arm.... I chip away as time, and more importantly money will allow. lately lots of time but no money.......

Scott
fun times

Offline Scott

*
  •  139 139
    • View Profile
Re: Yes/No or Ok/Cancel dialog
« Reply #7 on: December 28, 2006, 12:21:14 PM »
I worked on this a bit while away for the holidays and I have one problem.  The GetCoord dialog pops up behind Mach3 and I can't seem to come up with a way of making it pop up in front of Mach3.  I have to go to the taskbar and click on it to bring it to the front.

Here's what I have.

Thanks.


'TLC Logo

Sub Main ()
    Begin Dialog ZeroToolCheck 200, 50, "Do you have the bit zeroed on the material?"
               
    OKBUTTON 50, 25, 40, 12
    CANCELBUTTON 100, 25, 40, 12
       
    End Dialog
    Dim Dlg1 As ZeroToolCheck
   
    Button = Dialog(ZeroToolCheck)
       
If Button = 0 Then Exit Sub 'Dialog returns -1 for OK, 0 for Cancel


Code "(TLC Logo)"
GetCoord ("Desired X & Y location for the center of the logo")
Xloc=GetXCoor
Yloc=GetYCoor
If Xloc <= 0 Then Exit Sub
If Yloc <= 0 Then Exit Sub
While IsMoving ()
Wend
Code "G0 X" &Xloc & " Y" &Yloc
While IsMoving ()
Wend
Code "G92 X0 Y0"
While IsMoving
Wend

LoadRun ("C:\Mach3\GCode\TLC Logo.tap")

End Sub
« Last Edit: December 28, 2006, 12:23:23 PM by Scott »
Scott
Re: Yes/No or Ok/Cancel dialog
« Reply #8 on: August 23, 2007, 08:07:11 AM »
Hi
Scott Have you had any experiance of using the serial port, and how did you get on do you have any code to share?

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Yes/No or Ok/Cancel dialog
« Reply #9 on: August 23, 2007, 08:26:17 AM »
I have played with it, just to see how it works, tried to send some stuff to a PLC, it sent a few basic things, but I just dont know enough about the serial protocol, and for my apps Modbus was a MUCH better medium. I do know (currently), that you cant recieve info back into mach via serial, Perhaps Brian can fix that.
If you do a Serial Topic Search, there was a guy on here a while back that was sending alot of serial I think to a "PIC" or something like that, and he appeared to be well versed in its use.

Scott
fun times