reading Pokeys pins

C Scripting questions and answers
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4647
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

Is it actually opening a dialog on load? I cant find any bad behaviour there, it loads that file and does nothing till I press run and the first dialog opens. What happens there exactly?


..

  Your right on the close function, it would have to be a global dialog at that point as a
button code has no way of knowing its parent. Im finding it difficult to find
a way of allowing  a close command that will work. Ill keep dwelling on it.

I think I will have to add a sim = GlobalGet("Simulation") as a command so that
a script can be self aware that its being called during a load. It occurs to me there
are time you want to define motion during a load so it shows up in a toolpath,
and other times you may not want to activate during a load.. so the above command
would at least allow that. Im not sure I can do a close..but Ill see what I can think of..

Art
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4647
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

  In order to solve the issue of allowing your button script to close a dialog,
the following change has been made. It will be in the next release in a few days.

When adding a button, if you wish it to close the dialog after running your script,
make the call like this..

WaitDialog.AddButton("Touch OFF Z_close","MyToolChange");

  Note the buttons name has "_close" appended to the end. This text will
not show up in the actual button , but is a tag telling the system that this
button, after being processed, should then do an implicit OnCancel() to
close the dialog. This will close it just as if the user had pressed the
cancel button with no other effect.

  Note:  Using _close appended to any control, checkbox, edit window..
anything.. will cause the dialog to close if that function script  is called.
Ive tested this with your Gcode file, seems to work fine. I still
dont see any run on load of the tool change though.


Art

gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Thanks Art

What I am getting when the g code loads is the m6 call seems to run instantly, and the dialog appears and the z axis dro runs to 1"
and that's how I have the m6 script setup it jogs to 1" to do manual tool change..

you are right the code doesn't run, till run is pressed, other that the m6 for some reason, I can hit run now and it will run fine.. jest worries me it does the m6 when g code loaded it could move the axis and mess up things if you don't have the tool in a safe place first ?

I will test it again and let you know the sequence of what exactly is going on.. 

As for the dialog would it be easier to add getting feed back form the OK - Cancel Buttons they close the dialog and then you could react if cancel do this if ok do that.

Thanks gary
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

Ok A clearer picture of what's going on.
I load the g - code it loads fine no call to M6.. good

Now I press RUN it runs to the first M6 call does what its suppose to do, my dialog pops up I close my dialog and now I see the message End of g code run then press RUN the g code seems to rewind and go back to first line.
Now I hit Run again and it stops again at the first M6 my dialog pops up again I exit it, hit Run and now it runs fine, starts running the rest of the g code

Also is there a way to have the g code start running when I close the dialog box so I don't have to keep hitting the RUN button?.

Gary
Last edited by gburk on Sun Jun 16, 2019 7:42 am, edited 1 time in total.
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4647
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

New version is online of Auggie. The "_close" added to any dialog handler's function name  will
tell it to close that dialog when the handler is called. Its like appending a call to OnOK or OnCancel.

  I'm not seeing any ill behaviors per say on this version running your file. IT does stop
after each peck drill, but the script calls StopProgram so Id expect that. The only other
stop is after a tool change and that's a safety of sorts. I will see if I can add a continue
script call to help if one wants to continue after an automated tool change.


Art
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

The G code seems to run fine now no problems when first loading G code with m6..

I'm not sure how exactly you setup the _close, doesn't seem to work it I use dialog._close(); or dialog("_close")  in some of my stuff OnCancel is setup like
CDialog::OnCancel();  so not totally sure how game monkey is handlining it...

Can it be closed in the function called by the dialog.button press?.

Thanks gary
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4647
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

I used it in testing by simply renaming your Z touchoffbutton dialog handler
setting when you added the button to this..

WaitDialog.AddButton("Touch OFF Z_close","MyToolChange");

The button will still read "Touch Off Z" when displayed on the dialog,
and the script MyToolChange will be called, but the OnOK routine
which will close the dialog will be called when the MyToolChange Script
has completed its run.

  So if you change any buttons declaration to having _close added
to the buttons label, that buttons becomes an OK button with your label
and your script.

Art

gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

I Get it now and tried it and it does work.. But Always a But

Now when I run the g code and I get the m6 the dialog pops up but the g code keeps running, so the g code isn't stopping and waiting for the button press the g code continues to run even with the dialog waiting for the button press, the dialog does close when I hit the button..

Sorry I guess I just make problems

Gary
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4647
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

  Its likely due to some changes I made in the logic to keep things running unless told otherwise.
In your toolchange script, call StopProgram() and see if that fixes things. It should work like your
peck drilling does, it stops after its call due to the StopProgram() you put in the script. I
removed the toolchange autostop unless there is no tool change script, if none exists, it
stops on the M6, if a script exists, its up to the script to call StopProgram if it wishes the
program to stop. Unfortunately, a dialog opening is seen as the calling script terminating,
so its assuming your doing an auto tool change with no interaction, the calling script
is finished so it just continues. Add the StopProgram() call and it should stop.

  Downside is youll have to press run after your dialogs are complete. I will try to add a
continue() call, but its complex in there in its interactions so I'm trying not to hurt
scripts I or others have, so you may not have a continue real fast..Im still testing for
ramifications.

Art
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

Will check that out,

Would it just be easier just to add a way to read the OK and Cancel buttons and then call a function depending on the choice?.

I put a Engine.StopProgram(); in the tool change dialog function but didn't have any affect g code sill keeps running with the dialog screen just waiting for input

thank gary
Last edited by gburk on Sun Jun 23, 2019 2:51 am, edited 1 time in total.
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4647
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

For techincal reasons, as the system creates OK and cancel, they really cant be easily hooked.
This makes them kinda useless in my view, better to simply label a button as "OK_close"
and turn off system buttons. Works the same really.

Ill check why that stop doesnt occur..

Art
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4647
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

For the life of me I cant repeat it. If I load all is fine, I press run and I can see internally
the program stop get set. Then a script tells the Z to G1 to 1.0, then another G1Z.125,
then the dialog appears and the program waits for a run command.

  Im not sure what script is telling it to go up, I just verified
its coming in from a script. It then immediately does a g1 to z.125 and stops for the run.

  So Im not sure exactly whats going on, Ill keep looking..

Art
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

DoManualToolChange is sending the script to 1" then calls the wait dialog for tool change..

I tested it again with the same g code I sent you.. I hit RUN the code start running the Z retracts to 1" then the code continues to Drill pecking and my dialog pops up
and sits there but g code is still running doing the pecking never stops and wait for a button press.

Gary
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4647
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

Does it stop after each line of pecking the way mine does?

Art
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

Just keeps pecking the g code doesn't stop does the 4 pecking lines then continues to the cutting the recess the dialog pops up at the m6 lines but the g code keeps running.

it was working ok in the last version of auggie just had the problem when g code loaded running m6 and then g code being rewinded to first line.
That's fixed..

Gary
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests