reading Pokeys pins
Re: reading Pokeys pins
Hi Art
Had a couple questions before I forget I will ask,,
I haven't figured out a way to setup say 10 buttons with the same id name and a different id number
and press any of the ten buttons and then read the id number, can't figure out how to read the id number..
that way hopefully I could just use the id number and a case: statement to do as I want.
also you have a toolbox, can you use the toolbox to keep tract of your current tool# maybe to do a tool change
and change to a tool you may select form the toolbox?
also getting gcode errors created with cambam..
Error--44, G2 X1.547 Y-0.1575 I-0.0305 J0.0
I have other gcode errors but just showing you this one for now.
And i did get the problem fixed about having to run scripts first in the script run screen..
Gary
Had a couple questions before I forget I will ask,,
I haven't figured out a way to setup say 10 buttons with the same id name and a different id number
and press any of the ten buttons and then read the id number, can't figure out how to read the id number..
that way hopefully I could just use the id number and a case: statement to do as I want.
also you have a toolbox, can you use the toolbox to keep tract of your current tool# maybe to do a tool change
and change to a tool you may select form the toolbox?
also getting gcode errors created with cambam..
Error--44, G2 X1.547 Y-0.1575 I-0.0305 J0.0
I have other gcode errors but just showing you this one for now.
And i did get the problem fixed about having to run scripts first in the script run screen..
Gary
Re: reading Pokeys pins
Hi Gary:
What was the scripting problem with the button.. (just so I know..)..
I just got back and Ill fix up the last probe issue this week. ..
kk,buttons. ..You cant really call their ID.. a button will send out a state of 1 when pressed, and 0 when released.
They cant be named the same either or they'll all press when you press one. I do recall making a group button
sequence though,where one buttons turns off all others in the group, Ill have to look up how exactly I did that at the time.
There is no real toolbox in Auggie, I didn't implement one really, Auggie's point was to be fairly simplistic
so a tool table wasnt set up as I didnt want the complexity. You may find command hooks simply to stop errors
but theres likely no underlying functionality.
Is that error perhaps due to the G91 mode for absolute or incremental arcs? There is a list of errors,
Ill take a look at error 44 to see exactly what it is.. I just got in so Im still a bit jetlagged and Im
not sure top of head..
Art
Art
What was the scripting problem with the button.. (just so I know..)..
I just got back and Ill fix up the last probe issue this week. ..
kk,buttons. ..You cant really call their ID.. a button will send out a state of 1 when pressed, and 0 when released.
They cant be named the same either or they'll all press when you press one. I do recall making a group button
sequence though,where one buttons turns off all others in the group, Ill have to look up how exactly I did that at the time.
There is no real toolbox in Auggie, I didn't implement one really, Auggie's point was to be fairly simplistic
so a tool table wasnt set up as I didnt want the complexity. You may find command hooks simply to stop errors
but theres likely no underlying functionality.
Is that error perhaps due to the G91 mode for absolute or incremental arcs? There is a list of errors,
Ill take a look at error 44 to see exactly what it is.. I just got in so Im still a bit jetlagged and Im
not sure top of head..
Art
Art
Re: reading Pokeys pins
Did you have a great trip?
Wasn't expecting a response so soon, I'm getting to that age if I don't post the message when info is on my mind, it may be lost or forgotten by tomorrow ???
Not really having a scripting problem with the buttons
just was hoping there would be a way to read the button id number so if they were all named with the same var name I could use just one button global function for all the buttons in a panel, say I had 16 buttons to do a tool change I would press button for tool1 then move x y z to save position, now move my tool rack in and rotate to tool1. make sense? I figured a case: statement would make it a little easier then creating a global function for each button,..
Just was checking to see if it was in your code, when I create a button I see when editing that button there is a value for a id number in there also.
Toolbox really wouldn't make a big difference to me just checking.
Gary
Wasn't expecting a response so soon, I'm getting to that age if I don't post the message when info is on my mind, it may be lost or forgotten by tomorrow ???
Not really having a scripting problem with the buttons
just was hoping there would be a way to read the button id number so if they were all named with the same var name I could use just one button global function for all the buttons in a panel, say I had 16 buttons to do a tool change I would press button for tool1 then move x y z to save position, now move my tool rack in and rotate to tool1. make sense? I figured a case: statement would make it a little easier then creating a global function for each button,..
Just was checking to see if it was in your code, when I create a button I see when editing that button there is a value for a id number in there also.
Toolbox really wouldn't make a big difference to me just checking.
Gary
Re: reading Pokeys pins
Hi Gary:
>>Did you have a great trip?
It was great. Jamaica is nice and hot this time of year. :)
>>Wasn't expecting a response so soon, I'm getting to that age if I don't post the message when info is on my mind, it may be lost or forgotten by tomorrow Huh
Welcome to my world.
>>Not really having a scripting problem with the buttons
No, I meant the reason why you used to have to run the script before the button script would work..I
was curious as to why that happened.
>>just was hoping there would be a way to read the button id number so if they were all named with the same var name I could use just one button global function for all the buttons in a panel, say I had 16 buttons to do a tool change I would press button for tool1 then move x y z to save position, now move my tool rack in and rotate to tool1. make sense? I figured a case: statement would make it a little easier then creating a global function for each button,..
There is a way to do that, I just cant recall at the moment. Ill take a good to look to see how I used to do that..
>>Toolbox really wouldn't make a big difference to me just checking.
Yeah, a toolbox was one of those things I figured if one need sit, theres always Mach3 or 4.. :)
Art
>>Did you have a great trip?
It was great. Jamaica is nice and hot this time of year. :)
>>Wasn't expecting a response so soon, I'm getting to that age if I don't post the message when info is on my mind, it may be lost or forgotten by tomorrow Huh
Welcome to my world.
>>Not really having a scripting problem with the buttons
No, I meant the reason why you used to have to run the script before the button script would work..I
was curious as to why that happened.
>>just was hoping there would be a way to read the button id number so if they were all named with the same var name I could use just one button global function for all the buttons in a panel, say I had 16 buttons to do a tool change I would press button for tool1 then move x y z to save position, now move my tool rack in and rotate to tool1. make sense? I figured a case: statement would make it a little easier then creating a global function for each button,..
There is a way to do that, I just cant recall at the moment. Ill take a good to look to see how I used to do that..
>>Toolbox really wouldn't make a big difference to me just checking.
Yeah, a toolbox was one of those things I figured if one need sit, theres always Mach3 or 4.. :)
Art
Re: reading Pokeys pins
Art
>It was great. Jamaica is nice and hot this time of year
Probably hotter than here in Florida we have had a couple good weeks high 70's low to min 80's and not humid, only time of year I like being out but went and had rotators cuff surgery in late January so haven't done much since, this is the time of year I ride my horse and work in the garage, but not this year and if a few week to a month it will be to hot.. but then you'll be able to go out and do stuff and I'll be stuck inside :'(.
> No, I meant the reason why you used to have to run the script before the button script would work..I
>was curious as to why that happened.
I'm not totally sure but I think, when I created a script folder and had the scripts off the folder tree then I checked the script but not the script's main folder also
is when I had to run them in the script window... I'm pretty sure I was just checking the script but not the scripts main folder... not a good exaptation hopefully you
can get what I'm trying to say..
> Yeah, a toolbox was one of those things I figured if one need sit, theres always Mach3 or 4..
Yes I figure if I can get a tool change to work, I will know what tool is in what position anyway just won't work for other people but something they could start from..
I seem to have problems with mach4 things work then I edit the screen now it busted a lot of times won't even boot anymore and makes no sense I don't change any of the scripts, had a hell of a time getting the spindle working in mach4, easy in mach3, after many headaches did get it working but I think I already stated this in another post I used ob5(10) for motor 5 and and in the spindle setup set this to ob5(10) and used then set to pin 1 for step and pin 16 for dir it works spindle relay kicks on and speed adjusts fine.
Creating a dialog can't seem to find a command to AddDRo is that in auggie? I see AddButton and many others are there.
also I have a dialog created and ended with WaitDialog.DoModeless("none"); and also a button that call another global function this works great, now if I am in the called global function and I want to add or change the Addstatictext lines is that possible. I haven't been able to figure it out.. WaitDialog.AddStaticText doesn't seem to work..
in the function call from the button..
also I don't think the dialog is being killed I have a button that calls a dialog, now that dialog has a button that calls a function if there is an error the function calls another dialog, when I close the last dialog it go's back to the calling dialog but never finishes the function that was running before the error...
and now if I hit the stop or rewind the mdi doesn't react I have to hit EStop… is the dialog still running even though the window is closed?
Thanks gary
>It was great. Jamaica is nice and hot this time of year
Probably hotter than here in Florida we have had a couple good weeks high 70's low to min 80's and not humid, only time of year I like being out but went and had rotators cuff surgery in late January so haven't done much since, this is the time of year I ride my horse and work in the garage, but not this year and if a few week to a month it will be to hot.. but then you'll be able to go out and do stuff and I'll be stuck inside :'(.
> No, I meant the reason why you used to have to run the script before the button script would work..I
>was curious as to why that happened.
I'm not totally sure but I think, when I created a script folder and had the scripts off the folder tree then I checked the script but not the script's main folder also
is when I had to run them in the script window... I'm pretty sure I was just checking the script but not the scripts main folder... not a good exaptation hopefully you
can get what I'm trying to say..
> Yeah, a toolbox was one of those things I figured if one need sit, theres always Mach3 or 4..
Yes I figure if I can get a tool change to work, I will know what tool is in what position anyway just won't work for other people but something they could start from..
I seem to have problems with mach4 things work then I edit the screen now it busted a lot of times won't even boot anymore and makes no sense I don't change any of the scripts, had a hell of a time getting the spindle working in mach4, easy in mach3, after many headaches did get it working but I think I already stated this in another post I used ob5(10) for motor 5 and and in the spindle setup set this to ob5(10) and used then set to pin 1 for step and pin 16 for dir it works spindle relay kicks on and speed adjusts fine.
Creating a dialog can't seem to find a command to AddDRo is that in auggie? I see AddButton and many others are there.
also I have a dialog created and ended with WaitDialog.DoModeless("none"); and also a button that call another global function this works great, now if I am in the called global function and I want to add or change the Addstatictext lines is that possible. I haven't been able to figure it out.. WaitDialog.AddStaticText doesn't seem to work..
in the function call from the button..
also I don't think the dialog is being killed I have a button that calls a dialog, now that dialog has a button that calls a function if there is an error the function calls another dialog, when I close the last dialog it go's back to the calling dialog but never finishes the function that was running before the error...
and now if I hit the stop or rewind the mdi doesn't react I have to hit EStop… is the dialog still running even though the window is closed?
Thanks gary
Last edited by gburk on Fri Apr 05, 2019 12:23 pm, edited 1 time in total.
Re: reading Pokeys pins
Hi Gary:
I just uploaded version 3.6 of Auggie, it fixes your probing issues. I wasnt correctly setting the
engines current coordinate when you Used SetAxisPos(...).
Getting your spindle to work shouldn't be too bad. If you use the pokeys to setup a PWM channel,
then tell Auggie to set that channel (in the Spindle on and off scripts) to a PWM % of 0 - 100%
with the SetPWMDuty script call it should pretty much do it. You will need to get the current spindle speed
and make whatever scaling you wish for your spindle to make it a demand of 0 - 100% though.
Dialogs I haven't used in quite a while, but in looking to the code, when the script is deleted, the dialog is
closed and killed. If you close a dialog but are still in a script, it will not actually be deleted until the script
ends. I didn't envision a dialog being created in a script that never actually ends. So creating a new dialog
each time may fill you up in memory. Its possible anyway. There is no way to re display the dialog once
a user closes it. Its probably best to make a separate script that creates a dialog, waits while the user uses it,
then sets some globals your main script can read. It can then be called by your main script, it will close
and delete itself when it exits, and the main script never has to exit for the dialog to be deleted.
Dialogs dont have DRO's, they are basically a windows dialog, and have text boxes, which can show numbers
so are kinda windows versions of DRO's.
Im kinda impressed you got dialogs running, I figured they were more my own domain and YaNvrNo's as the complexity involved was higher than I figured any general user of Auggie would get to. YaNvrNo was the
main tester and retester in Auggies development so other than he or I some of the more esoteric
functions of Auggie I figured would never be used. Scripting in the Gcode for example is another one.
Anyway, test this latest version, I suspect your probe will work fine now, and I can tackle your spindle
or whatever thing your focusing on at the moment. :)
Thx
Art
I just uploaded version 3.6 of Auggie, it fixes your probing issues. I wasnt correctly setting the
engines current coordinate when you Used SetAxisPos(...).
Getting your spindle to work shouldn't be too bad. If you use the pokeys to setup a PWM channel,
then tell Auggie to set that channel (in the Spindle on and off scripts) to a PWM % of 0 - 100%
with the SetPWMDuty script call it should pretty much do it. You will need to get the current spindle speed
and make whatever scaling you wish for your spindle to make it a demand of 0 - 100% though.
Dialogs I haven't used in quite a while, but in looking to the code, when the script is deleted, the dialog is
closed and killed. If you close a dialog but are still in a script, it will not actually be deleted until the script
ends. I didn't envision a dialog being created in a script that never actually ends. So creating a new dialog
each time may fill you up in memory. Its possible anyway. There is no way to re display the dialog once
a user closes it. Its probably best to make a separate script that creates a dialog, waits while the user uses it,
then sets some globals your main script can read. It can then be called by your main script, it will close
and delete itself when it exits, and the main script never has to exit for the dialog to be deleted.
Dialogs dont have DRO's, they are basically a windows dialog, and have text boxes, which can show numbers
so are kinda windows versions of DRO's.
Im kinda impressed you got dialogs running, I figured they were more my own domain and YaNvrNo's as the complexity involved was higher than I figured any general user of Auggie would get to. YaNvrNo was the
main tester and retester in Auggies development so other than he or I some of the more esoteric
functions of Auggie I figured would never be used. Scripting in the Gcode for example is another one.
Anyway, test this latest version, I suspect your probe will work fine now, and I can tackle your spindle
or whatever thing your focusing on at the moment. :)
Thx
Art
Re: reading Pokeys pins
Art
Tested the new version it looks good, I have setup a panel with a few dro's Retract height, Travel distance, Touch Off plate thickness..
So I have changed there values a few times and it seems to probe ok and returns to Retract height consistently so if I probe to the Travel distance hit probe
then reset dro to Touch off plate thickness it has so far always reset to the right plate thickness, and now it will also retract to the retract height correctly..
probe to 2" hit probe at .75 then dro resets to .25 then retract to 1" now dro shows 1" so far every time..
As for the dialog I will try a better explanation!
I am working on doing a manual tool change
So I created a DoModeless dialog because it doesn't lock up the gui and I can have the dialog on screen that displays a message to jog to a safe x y z position and also have a button (Z touch off) so after you have changed the tool you can put you touch off plate back on part and hit the button to probe the Z and reset the Z position for the new tool Hight. Problem is from the button I am calling a function to save all the work positions turn off the spindle and flood now call the Z touch to probe the Z
After the call to do the Z touch off it should return from when I called the z touch off, so I can reset the new z position and jog back to the X Y Z original positions
turn on spindle and flood.
The problem I am having it doesn't seem to return to finish anything after the call to function Z touch off, doesn't complete script..
I have tried killing the dialog myself at end of script, but problem doing that its dead, so I have to run it again in the script edit run again..
Make any more sense?
Also I am back to the problem I thought was fixed, I have to run the probing script in the script edit run first or it won't run..
the strange thing is it seems to run the script, I have a few print statements in the script, they are being displayed but the motors and dros do not move
until I run the script in the script edit.. then motors and dros move..
Will worry about spindle later... just had some time on my hands so messed with dialogs
Did you think to check on how you could read the button id numbers?.
Here is an edit to message
I think the probing is working again without running the script first made one change not sure why it made it work again
If I didn't hit the probe and g31 ran to end of travel say 3", the script would not run again endless I reran it in the script edit, I have it sending the message probe not hit enter a higher value and returning a -2 so I added the code for the axis to return to the start of the probe position Right now its the Z height just before the return -2.
Now I don't have to run the script in the script edit anymore seems to run every button press...
Have any thoughts on that?
Thanks gary
Tested the new version it looks good, I have setup a panel with a few dro's Retract height, Travel distance, Touch Off plate thickness..
So I have changed there values a few times and it seems to probe ok and returns to Retract height consistently so if I probe to the Travel distance hit probe
then reset dro to Touch off plate thickness it has so far always reset to the right plate thickness, and now it will also retract to the retract height correctly..
probe to 2" hit probe at .75 then dro resets to .25 then retract to 1" now dro shows 1" so far every time..
As for the dialog I will try a better explanation!
I am working on doing a manual tool change
So I created a DoModeless dialog because it doesn't lock up the gui and I can have the dialog on screen that displays a message to jog to a safe x y z position and also have a button (Z touch off) so after you have changed the tool you can put you touch off plate back on part and hit the button to probe the Z and reset the Z position for the new tool Hight. Problem is from the button I am calling a function to save all the work positions turn off the spindle and flood now call the Z touch to probe the Z
After the call to do the Z touch off it should return from when I called the z touch off, so I can reset the new z position and jog back to the X Y Z original positions
turn on spindle and flood.
The problem I am having it doesn't seem to return to finish anything after the call to function Z touch off, doesn't complete script..
I have tried killing the dialog myself at end of script, but problem doing that its dead, so I have to run it again in the script edit run again..
Make any more sense?
Also I am back to the problem I thought was fixed, I have to run the probing script in the script edit run first or it won't run..
the strange thing is it seems to run the script, I have a few print statements in the script, they are being displayed but the motors and dros do not move
until I run the script in the script edit.. then motors and dros move..
Will worry about spindle later... just had some time on my hands so messed with dialogs
Did you think to check on how you could read the button id numbers?.
Here is an edit to message
I think the probing is working again without running the script first made one change not sure why it made it work again
If I didn't hit the probe and g31 ran to end of travel say 3", the script would not run again endless I reran it in the script edit, I have it sending the message probe not hit enter a higher value and returning a -2 so I added the code for the axis to return to the start of the probe position Right now its the Z height just before the return -2.
Now I don't have to run the script in the script edit anymore seems to run every button press...
Have any thoughts on that?
Thanks gary
Last edited by gburk on Sat Apr 06, 2019 1:57 pm, edited 1 time in total.
Re: reading Pokeys pins
Gary:
You may have to post your dialog code so I can see it. I recommend any dialogs be made
as a library file of their own. Makes it easier to post for debugging or for others to use..
As to buttons as group buttons.. Here is the method I have used. You have to use a script
to initialize your buttons as a group..
Imagine I have 3 buttons and their ID's on your screen are Main_BUT_1 , 2 ,3 and 4.
First we identify a master of the group. We'll use button #1 here..
global MPG1group = Button("Main_BUT_1");
Now we tell Auggie to add the rest of the buttons to our group, meaning only 1 may be pressed
at any time and one will always be pressed. ( Like selecting modes or axis)..
for( x = 2; x < 4; x = x + 1)
{ //connect each button as a slave of this master
MPG1group.SetGroup("Main_BUT_" + x);
}
//finally set the state of the group
MPG1group.SetState(0); //this turns on the first button, all buttons should now act as
// a group of buttons, one turning off all others when it turns on.
Note: Set all buttons to non-toggle button so the state toggle each press.
You can see this work in the MPG panel stored in the example panels.
Art
You may have to post your dialog code so I can see it. I recommend any dialogs be made
as a library file of their own. Makes it easier to post for debugging or for others to use..
As to buttons as group buttons.. Here is the method I have used. You have to use a script
to initialize your buttons as a group..
Imagine I have 3 buttons and their ID's on your screen are Main_BUT_1 , 2 ,3 and 4.
First we identify a master of the group. We'll use button #1 here..
global MPG1group = Button("Main_BUT_1");
Now we tell Auggie to add the rest of the buttons to our group, meaning only 1 may be pressed
at any time and one will always be pressed. ( Like selecting modes or axis)..
for( x = 2; x < 4; x = x + 1)
{ //connect each button as a slave of this master
MPG1group.SetGroup("Main_BUT_" + x);
}
//finally set the state of the group
MPG1group.SetState(0); //this turns on the first button, all buttons should now act as
// a group of buttons, one turning off all others when it turns on.
Note: Set all buttons to non-toggle button so the state toggle each press.
You can see this work in the MPG panel stored in the example panels.
Art
Re: reading Pokeys pins
Hi Art
Here is a mess not good looking code but been hacking it up and down, don't know if you will be able to follow it with not all the peace's I am going to zip up my
scripts and panels and hopefully post a link for you to download the hole mess..
So back to the buttons should I give them a id number and a variable name? or just leave the button named as there default names..?
I have tried to look at the scripts for jog panel I assume that's the mpg you are referring to but they don't show up in the scripter so you I may need a little help finding them how about a auggie for dummies doc. ???
// Library Toolwait
// Created Thursday, April 04, 2019
// Author Gary -- Do not edit above this line
// Enter Global vars below this line.
// the librarian no matter where they are, but its easier
// to find and edit them in one spot.
//The 6 lines previous to a function will appear as
//comments to help users to understand the parameters
//required for use by each function, so try to
//always add as clear a set of instructions in these
//lines as an aid to fellow travellers.
//
global WaitDialog = Dialog();
global ToolWait = function()
{
if ( WaitDialog != null )
{
if ( WaitDialog.IsOpen() )
{
return;
};
};
//global WaitDialog = Dialog();
WaitDialog.SetRect( 25, 20 );
WaitDialog.SetTitle( "Maunal Tool Change " );
WaitDialog.NextPosition( 5,5,80,50 );
WaitDialog.AddStaticText( " Manual Tool Change now Jog to a safe X Y Z Position");
WaitDialog.NextPosition( 5,15,80,50 );
WaitDialog.AddStaticText( " After new Tool is Inserted PRESS Touch OFF Z");
WaitDialog.NextPosition( 40,50,60,70 );
WaitDialog.SystemButtonsOnOff(false);
WaitDialog.AddButton("Touch OFF Z","MyToolChange");
WaitDialog.DoModeless("none");
};
global ProbeErrorDialog = Dialog();
global MyToolChange = function()
{
Touch_OFF = ZTouchOFF();
yield();
print("Touchoff 4 "+Touch_OFF);
if (Touch_OFF == -1 || Touch_OFF == -2 || Touch_OFF == -3 )
{
if ( ProbeErrorDialog != null )
{
if ( ProbeErrorDialog.IsOpen() )
{
return;
};
};
// global ProbeErrorDialog = Dialog();
ProbeErrorDialog.SetRect( 15, 10 );
ProbeErrorDialog.SetTitle( "Probe Error " );
ProbeErrorDialog.NextPosition( 5,5,80,50 );
if (Touch_OFF == -2)
{
ProbeErrorDialog.AddStaticText( "Error Probe not HIT Try jogging closer to Part");
}
else if (Touch_OFF == -3)
{
ProbeErrorDialog.AddStaticText( "Error Probe");
}
else if (Touch_OFF == -1)
{
ProbeErrorDialog.AddStaticText( "Error Probe not known");
};
ProbeErrorDialog.DoModal("none");
return;
}
return;
};
thanks gary
Here is a mess not good looking code but been hacking it up and down, don't know if you will be able to follow it with not all the peace's I am going to zip up my
scripts and panels and hopefully post a link for you to download the hole mess..
So back to the buttons should I give them a id number and a variable name? or just leave the button named as there default names..?
I have tried to look at the scripts for jog panel I assume that's the mpg you are referring to but they don't show up in the scripter so you I may need a little help finding them how about a auggie for dummies doc. ???
// Library Toolwait
// Created Thursday, April 04, 2019
// Author Gary -- Do not edit above this line
// Enter Global vars below this line.
// the librarian no matter where they are, but its easier
// to find and edit them in one spot.
//The 6 lines previous to a function will appear as
//comments to help users to understand the parameters
//required for use by each function, so try to
//always add as clear a set of instructions in these
//lines as an aid to fellow travellers.
//
global WaitDialog = Dialog();
global ToolWait = function()
{
if ( WaitDialog != null )
{
if ( WaitDialog.IsOpen() )
{
return;
};
};
//global WaitDialog = Dialog();
WaitDialog.SetRect( 25, 20 );
WaitDialog.SetTitle( "Maunal Tool Change " );
WaitDialog.NextPosition( 5,5,80,50 );
WaitDialog.AddStaticText( " Manual Tool Change now Jog to a safe X Y Z Position");
WaitDialog.NextPosition( 5,15,80,50 );
WaitDialog.AddStaticText( " After new Tool is Inserted PRESS Touch OFF Z");
WaitDialog.NextPosition( 40,50,60,70 );
WaitDialog.SystemButtonsOnOff(false);
WaitDialog.AddButton("Touch OFF Z","MyToolChange");
WaitDialog.DoModeless("none");
};
global ProbeErrorDialog = Dialog();
global MyToolChange = function()
{
Touch_OFF = ZTouchOFF();
yield();
print("Touchoff 4 "+Touch_OFF);
if (Touch_OFF == -1 || Touch_OFF == -2 || Touch_OFF == -3 )
{
if ( ProbeErrorDialog != null )
{
if ( ProbeErrorDialog.IsOpen() )
{
return;
};
};
// global ProbeErrorDialog = Dialog();
ProbeErrorDialog.SetRect( 15, 10 );
ProbeErrorDialog.SetTitle( "Probe Error " );
ProbeErrorDialog.NextPosition( 5,5,80,50 );
if (Touch_OFF == -2)
{
ProbeErrorDialog.AddStaticText( "Error Probe not HIT Try jogging closer to Part");
}
else if (Touch_OFF == -3)
{
ProbeErrorDialog.AddStaticText( "Error Probe");
}
else if (Touch_OFF == -1)
{
ProbeErrorDialog.AddStaticText( "Error Probe not known");
};
ProbeErrorDialog.DoModal("none");
return;
}
return;
};
thanks gary
Re: reading Pokeys pins
Gary:
Thx, Ill check the dialog to see what I think.
For the buttons example, the MPG panel, you can use the screen loader to load the MPG.panel,
once loaded if you open the scripter and checkout the main init script for that panel youll
see how the buttons are joined together.
You dont need to do this in an init script stored in the panel or screen though, thats just
how I used to do it. Id set each Button with an ID name. Then once your screen is loaded, look
at the name the editor gives you because it may decorate the name with MAIN_ as it loads.
Then in a library script make a global function that uses SetGroup and such to define those
buttons as being joined. Right after defining that function, call it.
ex: (assuming the end name of the buttons are Main_MYTOOLBUTS_1 through 4)
global MYgroup = Button("Main_MYTOOLBUTS_ 1");
Global MyGroupofButtons = function()
{
for( x = 2; x < 5; x = x + 1)
{ //connect each button as a slave of this master
MYgroup.SetGroup ("Main_MYTOOLBUTS_" + x);
}
MYgroup .SetState (0); //this turns on the first button, all buttons should now act as
// a group of buttons, one turning off all others when it turns on.
}
MyGroupofButtons(); //now call it right after defining it so its in effect from the start
global Main_MYTOOLBUTS_1 = function( state )
{
if( state) dothis
else
dothis
}
You may now make scripts named as the buttons ID name and they will be called
when a button is pressed, and all other buttons will turn off. Above is untested, just out
of mind but its how it should work.
Art
Thx, Ill check the dialog to see what I think.
For the buttons example, the MPG panel, you can use the screen loader to load the MPG.panel,
once loaded if you open the scripter and checkout the main init script for that panel youll
see how the buttons are joined together.
You dont need to do this in an init script stored in the panel or screen though, thats just
how I used to do it. Id set each Button with an ID name. Then once your screen is loaded, look
at the name the editor gives you because it may decorate the name with MAIN_ as it loads.
Then in a library script make a global function that uses SetGroup and such to define those
buttons as being joined. Right after defining that function, call it.
ex: (assuming the end name of the buttons are Main_MYTOOLBUTS_1 through 4)
global MYgroup = Button("Main_MYTOOLBUTS_ 1");
Global MyGroupofButtons = function()
{
for( x = 2; x < 5; x = x + 1)
{ //connect each button as a slave of this master
MYgroup.SetGroup ("Main_MYTOOLBUTS_" + x);
}
MYgroup .SetState (0); //this turns on the first button, all buttons should now act as
// a group of buttons, one turning off all others when it turns on.
}
MyGroupofButtons(); //now call it right after defining it so its in effect from the start
global Main_MYTOOLBUTS_1 = function( state )
{
if( state) dothis
else
dothis
}
You may now make scripts named as the buttons ID name and they will be called
when a button is pressed, and all other buttons will turn off. Above is untested, just out
of mind but its how it should work.
Art
Re: reading Pokeys pins
Art
Tested out the buttons a bit, not having any luck, I have 16 buttons and it seems like auggie has named them all the same "ToolChanger_BUT_0" with or without a name var, I tried with a var name of tool1 to tool16 got the same results...
You said load the mpg as a screen don't see how to load the panel as a screen and I don't see a mpg panel or screen the only panel with mpg is the jogpanel..
also can auggie return 4 values from a function I seem to get compile errors when I am trying to return 4 values, like return x,y,z,a; ?
Thanks gary
Tested out the buttons a bit, not having any luck, I have 16 buttons and it seems like auggie has named them all the same "ToolChanger_BUT_0" with or without a name var, I tried with a var name of tool1 to tool16 got the same results...
You said load the mpg as a screen don't see how to load the panel as a screen and I don't see a mpg panel or screen the only panel with mpg is the jogpanel..
also can auggie return 4 values from a function I seem to get compile errors when I am trying to return 4 values, like return x,y,z,a; ?
Thanks gary
Re: reading Pokeys pins
Gary:
Ill check the buttons tomorrow to see why the numbers are sticking .. It is possible I didnt
include the MPG panel in the release, Ill check that too.
The buttons shouldnt have the same ID, I think you need to set each button to a different
ID number as you create them. Ill run a test and see.. You should be able to just enter an ID number instead of a variable name as you make the button.
You cannot return more than 1 item from a function unless the item is a table of values.
You can set multiple globals while in the script though....
Art
Ill check the buttons tomorrow to see why the numbers are sticking .. It is possible I didnt
include the MPG panel in the release, Ill check that too.
The buttons shouldnt have the same ID, I think you need to set each button to a different
ID number as you create them. Ill run a test and see.. You should be able to just enter an ID number instead of a variable name as you make the button.
You cannot return more than 1 item from a function unless the item is a table of values.
You can set multiple globals while in the script though....
Art
Re: reading Pokeys pins
Hi Art
I figured that when you created a button and could give it an id name and id number there would be a way to retrieve either or both
This is what i had in mind but i am assumming the button id number can not be read.
Button.IDnumber is there just for example, Make any sense
All the button tool id names are Tool1 and idNumbers from 1 - 16
so all tool names are the same so doesn't matter what button that's pressed it will go to the same function but with its own id number the only one on the stack..
it could be read..
//Get button ID Number
global Tool1 = function( state )
{
Tool = Button.IDNumber("Tool1")
switch( Tool )
{
case 1:
{
//Too11
return;
}
case 2:
{
//Tool2
return;
}
case 3:
{
//Tool3
return;
}
};
};
just rambling on and on :-\
ok I will try it as a table I have had some trouble when setting global var they seem to want to change back to what its value when declared at originally I will also try that again,
Thanks gary
I figured that when you created a button and could give it an id name and id number there would be a way to retrieve either or both
This is what i had in mind but i am assumming the button id number can not be read.
Button.IDnumber is there just for example, Make any sense
All the button tool id names are Tool1 and idNumbers from 1 - 16
so all tool names are the same so doesn't matter what button that's pressed it will go to the same function but with its own id number the only one on the stack..
it could be read..
//Get button ID Number
global Tool1 = function( state )
{
Tool = Button.IDNumber("Tool1")
switch( Tool )
{
case 1:
{
//Too11
return;
}
case 2:
{
//Tool2
return;
}
case 3:
{
//Tool3
return;
}
};
};
just rambling on and on :-\
ok I will try it as a table I have had some trouble when setting global var they seem to want to change back to what its value when declared at originally I will also try that again,
Thanks gary
Re: reading Pokeys pins
Gary:
Unfortunatley the way the buttons are joined is simply a mechanism to ensure other buttons
in the group turn off so that one button is always exclusively on in the group.
You still need a script for each button as there is no way to tell which one was pressed other
than it calls its own script. Each script though could set a global to a set number, and then call
the same function as all the other buttons where it does a switch statement on that global.
I know it seems like a lot of scripts, but their really all the same with the minor change of what
the script sets the global to. Scripts dont take much memory so having lots of them doesnt really
run into troubles in my experience so far.
Globals will get set back if the scripting system resets. Doesnt usually happen during use, but
when editing and checking in scripts and such a global reset occurs and the scripting system
will reinitialize back to its original state with the declared variables.
Art
Unfortunatley the way the buttons are joined is simply a mechanism to ensure other buttons
in the group turn off so that one button is always exclusively on in the group.
You still need a script for each button as there is no way to tell which one was pressed other
than it calls its own script. Each script though could set a global to a set number, and then call
the same function as all the other buttons where it does a switch statement on that global.
I know it seems like a lot of scripts, but their really all the same with the minor change of what
the script sets the global to. Scripts dont take much memory so having lots of them doesnt really
run into troubles in my experience so far.
Globals will get set back if the scripting system resets. Doesnt usually happen during use, but
when editing and checking in scripts and such a global reset occurs and the scripting system
will reinitialize back to its original state with the declared variables.
Art
Re: reading Pokeys pins
Yes I kind of figured that not a big problem... just running though my head,,
I did notice a funny thing with the dialog when I run the first dialog with the touch off button and let it run to the end I will get the error dialog close out the error box and hit the ztouch button again same thing let it run to error now the second time it displays the error dialog it has 2 of the ok buttons and 2 of the cancel buttons displayed.. Strange
I tried the return mytable; that seems to work fine...
The only problem with buttons is auggie only giving them all the same name all 16 are ToolChange_BUT_0
I am planning on connecting to mill tomorrow and see how the z probing works in real life..
But now I seem to have the problem again with having to run the probe script in the edit run first.. I thing I did say it seems to run all my print statements and are shown on screen in the probe script
but no motor movement till I run the script in the script run..
Also is doing the same thing in any of the button toolchange scripts.
and tried setting up FreeFeed to move 6 and 7 they move but dro's are not moving to entered feed to position and I always get a buffer over run or under run forget which one.
Thanks gary
I did notice a funny thing with the dialog when I run the first dialog with the touch off button and let it run to the end I will get the error dialog close out the error box and hit the ztouch button again same thing let it run to error now the second time it displays the error dialog it has 2 of the ok buttons and 2 of the cancel buttons displayed.. Strange
I tried the return mytable; that seems to work fine...
The only problem with buttons is auggie only giving them all the same name all 16 are ToolChange_BUT_0
I am planning on connecting to mill tomorrow and see how the z probing works in real life..
But now I seem to have the problem again with having to run the probe script in the edit run first.. I thing I did say it seems to run all my print statements and are shown on screen in the probe script
but no motor movement till I run the script in the script run..
Also is doing the same thing in any of the button toolchange scripts.
and tried setting up FreeFeed to move 6 and 7 they move but dro's are not moving to entered feed to position and I always get a buffer over run or under run forget which one.
Thanks gary
Last edited by gburk on Mon Apr 08, 2019 1:42 pm, edited 1 time in total.
Who is online
Users browsing this forum: No registered users and 4 guests