reading Pokeys pins

C Scripting questions and answers
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

FreeStill worked perfect, so looks like I can go on from here, with the tool change, and probing..

the main reason I was using my own display for tools and probe was the free axis display was small to read.. at least for me

and since I sent you my panels I have added the 8 axis dro's to the probe and tool panels and also 8 zero buttons, but I will add them to the free axis panel and see how it looks, for me bigger is better, as my eyes get older.. 

I did have that problem with ok and cancel with the error dialog I think I mentioned it awhile back.. will check it out.

So next thing that may have to be ironed out would be the T M6 I will do some more testing and see what is causing me the most problems...

Did some testing on the m6, also don't see any buttons created with the error dialog should I turn off the ok cancel and just use the
x to close out the window..?

As for the m6 it seems good on the first m6 call my dialog pops up and then I close it out and hit run the gcode runs fine till the second T M6
at this point seems like auggie's continue dialog takes over, and mine never pops up again then when I hit continue some dro's move but the g code never
moves past this m6 line seems just to loop there and the continue box pops up again with same result stuck on the second m6 call..   


Thanks Gary
Last edited by gburk on Fri May 10, 2019 3:07 am, edited 1 time in total.
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

>>also don't see any buttons created with the error dialog should I turn off the ok cancel and just use the
x to close out the window..?

  No, just6 use as normal. I was getting multipel copies of OK and cancel, but it all seems OK
now here, do you still get too many OK buttons?

>>aAs for the m6 it seems good on the first m6 call my dialog pops up and then I close it out and hit run the gcode runs fine till the second T M6
at this point seems like auggie's continue dialog takes over, and mine never pops up again then when I hit continue some dro's move but the g code never
moves past this m6 line seems just to loop there and the continue box pops up again with same result stuck on the second m6 call..   

Thx, Ill run some tests. Glad to hear things are running better.

Art

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

Re: reading Pokeys pins

Post by ArtF »

Gary:

Version 3.6d is online for you.

  It should fix the warning dialog coming up after a toolchange.

There is an error in your scripts though. In the SetSpindleState you have
a switch statement where you do a if( lookup("SpindleOn") SpindleOn();
  Same for off.
These are not functions, SpindleOn and SpindleOff are
global variables to indicate if the spindle is on or off. You dont need to
tell Auggie , it already knows the spindle is on or off, in your script
all you need to do is set the Pokeys relay or turn on a frequency or whatever
effect you wish from the fact that its on. Thats true of all script calls,
if they are system calls like M3,M5,M7 etc.. the system will set
the internal states itself, you need only turn on whatever relay
you wish for that state or set conditions as appropriate hardware
wise for your system for that call.

  Removing those switch statements allows the scripts to run without
error as the script failure was causing a system stop.

Let me know how it goes. :)

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

Re: reading Pokeys pins

Post by gburk »

>>  No, just6 use as normal. I was getting multipel copies of OK and cancel, but it all seems OK
now here, do you still get too many OK buttons?

No i'm not, I think it was when using DoModeLess now the error dialog uses DoModal seems to fix the button problem.

will check the spindle functions, that's the problem with jumping around to much before getting one function working correct> OCD < ???

looked at the spindle functions and I had them turned off so should not have had any effect, I will make the mods and turn back on later..

will check the new auggie compile out.

Ok here is what I am finding, load the g code run it hit the first T M6 call my dialog runs I change tool and hit the X and not probe don't have it connected right now.
and it runs to the next T M6 but now my dialog doesn't pop up anymore and nor does auggies, but the g code will continue to the next T M6 so we are no longer stuck in the loop at the second T M6.
But my dialog will not pop up anymore after the first time, I even hit estop rewinder and hit run and no pop up at the first T M6 call now.
The M6 Still stops the g code and waits for the run to pressed. i'm sure its running my function I see the messages being displayed just not the dialog..&nbsp;

Thanks gary


Last edited by gburk on Fri May 10, 2019 11:56 am, edited 1 time in total.
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

Seeing there is no peck drilling yet... do you think this code is usable ?
Still in rough form and testing but just a thought...

// G888 P.25 H1 R.2
// G888 = Peck drilling Call with G888 H = Depth to drill R = retract hight P = Peck distance
global GCode888 = function()
{
&nbsp; print("Peck Drilling");
&nbsp; for( pecking = 0; pecking <= ParmsH[0]; pecking+=ParmsPRI[0])
&nbsp; {
&nbsp; &nbsp; if (pecking + ParmsPRI[0] > ParmsH[0])
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; pecking = ParmsH[0];
&nbsp; &nbsp; }
&nbsp; print("Peck Drilling&nbsp; Z "+ParmsXYZ[2]+ " R "+ParmsPRI[1]+" Pecking = "+pecking);
&nbsp; Engine.GCode("G90 G01 Z-"+pecking);
&nbsp; block("MotionStill");
&nbsp; Engine.GCode("G90 G01 Z"+ParmsPRI[1]);
&nbsp; block("MotionStill");
&nbsp; lastpos = pecking;
&nbsp; sleep(2);
&nbsp; };
&nbsp; yield();
&nbsp; print("Finished pecking to the depth of "+lastpos);
Engine.StopProgram();
};

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

Re: reading Pokeys pins

Post by ArtF »

Hi Gary:

&nbsp; A 2 second sleep may be a bit much, but code looks good at a quick perusal.

Im analysing the dialog to see why it wont reopen, it may be better to keep the dialog
local inside a single global function. That way ach call opens a new one and the old one
will be autodeleted after use.

Ill let you know what I find.

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

Re: reading Pokeys pins

Post by gburk »

Art

Will give the local dialog, a try made a few mods to peck
I modified cambam post to use the G888 it seems to work but its putting the same G888 line twice in the g code file so i'll have to figure that one out.

Also the continue dialog is still popping up&nbsp; random at some m6 calls not 100% sure but that seems to mess things up sends the axis's back to 0 the right back to where they were before the continue dialog then it loops there can't run past the m6 line if I single step it will run each line and the continue dialog doesn't pop up.

Tried removing the global from my dialog but didn't change anything..

Think i'm getting ahead of myself again but I assuming auggie will not execute the G888 ?
It works fine In the MDI window, is there a way to have auggie read the script G888 while running the G Code file?

//G888 P.25 H1 R.2 I10
// M888 = Peck drilling Call with G888 H = Depth to drill R = retract hight P = Peck distance I Feed Rate
global GCode888 = function()
{
NegValue = ParmsH[0];
NegValue = ToInt(NegValue);
&nbsp; if (NegValue < 0)
&nbsp; {
&nbsp; NegValue= math.abs(NegValue);
&nbsp; print("ParmsH "+NegValue);
&nbsp; ParmsH[0] = NegValue;
&nbsp; }
&nbsp; else if( NegValue == 0 )
&nbsp; {
&nbsp; &nbsp; return;
&nbsp; };
//ok pos value lets do so pecking
&nbsp; print("Peck Drilling ");
&nbsp; for( pecking = 0; pecking <= ParmsH[0]; pecking+=ParmsPRI[0])
&nbsp; {
&nbsp; &nbsp; if (pecking + ParmsPRI[0] > ParmsH[0])
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; pecking = ParmsH[0];
&nbsp; &nbsp; }
&nbsp; print(" Pecking Z = "+pecking);
&nbsp; Engine.GCode("G90 G01 Z-"+pecking+" F"+ParmsPRI[2]);
&nbsp; block("MotionStill");
&nbsp; Engine.GCode("G90 G01 Z"+ParmsPRI[1]+" F"+ParmsPRI[2]);
&nbsp; block("MotionStill");
&nbsp; lastpos = pecking;
&nbsp; sleep(2);
&nbsp; };
&nbsp; yield();
&nbsp; print("Finished pecking to the depth of "+lastpos);
Engine.StopProgram();
};

Thanks gary
Last edited by gburk on Sun May 12, 2019 1:45 pm, edited 1 time in total.
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

&nbsp; The continue dialog Ill add a switch to stop if one wishes to turn it off. I use it to start a file in the middle
or other location. Its purpose is to move safely to the previous lines end so a program can continue. This works
well as I never offset due to a tool change. Your offsets seem to affect it so Ill add a switch to turn it off
as a config item.

&nbsp; If you create a Gcode script GCode888 it should be called if the Gcode has an G888 in it. Your log, if debug log is
turned on should show the Gcode being called, and should show the parameters as they currently stand due to the call.
Does it show anything?

(Im still checking the dialog cause.)

Art

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

Re: reading Pokeys pins

Post by ArtF »

Gary:

As an example, if I add a G666 to my Gcode file here, you can see it being executed on the toolpath screen and the data
its receiving. Try it and let me know if you get that text data showing 666 works..

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

Re: reading Pokeys pins

Post by ArtF »

Gary:

&nbsp; Auggie is updated to&nbsp; test version 3.6e for you to test.

I made some fairly drastic changes so there may be unexpected
results. I did get your dialogs working on every toolchange, but
it was just the script I changed for that.

The problem was the global nature I think of the dialogs. I changed
the one dialog to this for example..

global ToolWait = function()
{
&nbsp; WaitDialog = Dialog();&nbsp;
&nbsp; WaitDialog.SetRect( 25, 20 );
&nbsp; WaitDialog.SetTitle( "Maunal Tool Change " );
&nbsp; WaitDialog.NextPosition( 5,5,80,50 );
&nbsp; WaitDialog.AddStaticText( " Manual Tool Change now Jog to a safe X Y Z Position");
&nbsp; WaitDialog.NextPosition( 5,15,80,50 );
&nbsp; WaitDialog.AddStaticText( " After new Tool is Inserted&nbsp; PRESS Touch OFF Z");
&nbsp; WaitDialog.NextPosition( 40,50,60,70 );
&nbsp; WaitDialog.SystemButtonsOnOff(true);
&nbsp; WaitDialog.AddButton("Touch OFF Z","MyToolChange");
&nbsp; WaitDialog.DoModeless("none");
};
&nbsp;
&nbsp; As the dialog isnt global it has an easier time dealing with it
at deletion time. Dialogs arent really very reusable in Monkey Script.

Try this new version, it seems to track better. Im sure there still exists
bugs and such, but lets see what this one does.

Art


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

Re: reading Pokeys pins

Post by ArtF »

Gary:

&nbsp; I found I had another weirdness in my scripts in that a G666 would stop the program. While I do make one
press run after a toolchange, other scripts shouldn't require it. So version 3.6f is online which corrects this and
a few other small memory issues. I fond it now seems to operate as I expected it should. It will pause after
a toolchange, but other Gcode commands you may add will not stop unless you call
for a programstop in the script itself.

&nbsp; Good luck testing. Be cautious as I have rejiggered a fair bit. At this point your testfile runs your dialog
on every toolchange, and waits for run to be pressed afterwards. The continue dialog, should it appear,
has a cancel and continue button added so you can basically ignore it by pressing that when it appears.
I left it in because it IS handy if one wants to start a file in the middle.

Let me know your experiences.

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

Re: reading Pokeys pins

Post by gburk »

hi art

Thanks will test it out.. I found out why the G888 Wasn't running in the g code.. my error in script..

I attached the updated script and the g code file I ran in the air, and my dialog did pop up on tool changes never seen the continue dialog at all..

The only thing I see going on with this g code file is that it doesn't show up in the display window. most likely the G888 messing it up, but it did run ok..

I am assuming as long as nothing was weird going on then it didn't call the continue dialog..

Thanks gary
Attachments
XballscrewmountFinal4.zip
(3.83 KiB) Downloaded 284 times
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Hi Gary:

&nbsp; >>I am assuming as long as nothing was weird going on then it didn't call the continue dialog..

&nbsp; I updated the executing line display, I think that was screwing with the continue dialog, it triggers
if you press run and the last line executed doesnt end at your current line. It then wants to safely move there
to continue the file.

>>he only thing I see going on with this g code file is that it doesn't show up in the display window. m

&nbsp; The file doesnt show up? lol, Ill check that out.

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

Re: reading Pokeys pins

Post by ArtF »

Gary:

&nbsp; The file shows up eventually, you have a 2 second delay sleep(2) after each peck, so in loading its executing that,
remove it and the file shows up almost immediately. Ill see some way to ignore a sleep while loading a file. While
loading the file is executed to make a toolpath so the sleeps make it slow to load.

&nbsp; Other than that , I had to fix the SetSpindleState to remove the calls to SpindleOn and SpindleOff, then the file
runs as youd expect and I can see it pecking. File seems to run OK now.

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

Re: reading Pokeys pins

Post by ArtF »

Gary:

&nbsp; I just upped version 3.6g. This fixes your sleeps slowing the load down. Sleep(x) will be interpreted as sleep(0)
during a load ( essentially a yield()), so the slowdown isnt very noticeable. The files loads very quick here now
and when running delays 2 seconds after each peck of the peck drilling as called for.

Art
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests