GearHeads Corner
July 23, 2018, 08:17:35 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Script/GCode interface  (Read 971 times)
0 Members and 1 Guest are viewing this topic.
ArtF
Administrator
Hero Member
*****
Posts: 4962



View Profile
« on: January 13, 2016, 11:04:50 AM »

  How was Lunch? Smiley

Well, before we get to involved in the operation s of the scripts, we should probably have a
clear understan ding of what , exactly, the scripts are meant to do. Broadly, the answer is
everythin g, but the object is to hide that from the end user. Other than the GCode subsets
of script the user may wish to learn, the running of the program, though pretty much
all script, should be pretty much opaque.

    Recently, as I explained in the YouTube video, I added the GCode library, this allows
you to add GCode or M Codes to the language of the input file. Natively, Auggie knows
very few M Codes, and not all the G Codes. Ive instantia ted as a system only the basic
ones. However, any G code or M Code not understoo d triggers a script call to a
function named GCodexx where the xx is the number you called in the GCode..
so a
G162 in the GCode file, will call :  GCode162  as script function name.

   Now if no such script exist, a message is printed on the toolpath and a log entry
is made. The file will run regardles s as you may have turned off that GCode to
stop a behavior you don't want. This allows you to check a library to turn it on or off
and turn on or off or swap the meaning of a G code or M Code. It is quite
possible to have G code libraries named for a particula r machine type, and select the
one that matches the device.

   The commands you add to or use from the G code libraries are not the only ones
available to the running program, basically any legal script call or function
can be put in the G code file , so long as it is between { }'s

for example , as of next update anyway, the following would be quite legal..
...
G1X100Y5Z 5
{Notify("ToolChang e will be coming up in about 3 minutes.");}
G1Z-.1
...
...
{Warn("ToolChang e will be coming up in about 1 minutes.");}
G1X4
..
{Alert("ToolChang e in a few seconds.");}


    Notify just puts text in the tool path screen, Warn and Alert do as well,
but also add a sound of urgency from the sound system. These commands
all show up in the auto type mechanism so their not hard to remember.

  The idea here is to add enough GCode and MCode scripts to allow generic GCode to
run, and to allow embellish ment of the code to make it do things  that Auggie will have
the power to do. So most scripts a user writes will add a capabilit y or simply be calls
of scripts pre-written and already in the libraries to add to the GCode.

    There is a Contours facility which will appear as a library shortly as well, which allows a user
to add points to an unlimited amount of profiles, and save them as dxf's, or use them as toolpath
lines, much like a G2 or G3, but beziers , defined shapes and such will also be possible.
  Methods like this will allow for things like constant burning of ever changing serial numbers
and such.

  The system now sends signals on any used signal that changes in either pokeys, so you
may now block on any of over 110 signal names. To have a script service a pin on the Pokeys,
just make sure its enabled. You may now have a script such as

global ServiceIO Pin15 = function()
{
  while(1)
    {
       block("IOPin15");
       //do what you wish to happen
       // on pin15 change here.
    }
}

  And start the process in the main screen init script with

thread( ServiceIO Pin15 );

this will send the  ServiceIO Pin15 script off running on its own,
waking up only when pin15 on the IO Pokeys changes state..
What you do of course ifs up to you. This works for Analogue,
Digital (in and out) Encoders and counters.

  This means you have pretty much full control of over
100 pins of IO mixed in various ways.

  Enough for now, I thought Id try to clarify a bit what the flow of the system is
designed to be.

Thx
Art



   
 

 



   

Logged
Vangoth
Newbie
*
Posts: 8


View Profile
« Reply #1 on: March 30, 2018, 07:36:59 PM »

Good night, a question my auggie does not activate the spindle with the M3 code. Should I add it?
Logged
ArtF
Administrator
Hero Member
*****
Posts: 4962



View Profile
« Reply #2 on: March 30, 2018, 09:49:57 PM »

Hi:

   Have you turned on the spindle libraries? The default one turns on a laser, so you may want to change that so it only turns on a relay. The GCode library calls
the SetSpindl eState macro, you will find the laser example of that macro that may be modified.

Art
Logged
Vangoth
Newbie
*
Posts: 8


View Profile
« Reply #3 on: March 31, 2018, 01:33:48 PM »

yes sir, I have it activated but when I load the code g and start doing the movement, it locks up when it finds the M3 code. and create a new script only with the option to turn on and off plasma with relay # 3 and it does not work either. Here I leave you the scrip that you wrote and the error that appears when the machine finds the M3

global SpindleOn = function ()
{
Pokeys1.S etRelay (3,1);
print ("Plasma Spindle RT Engaged");
 
};
 
global SpindleOf f = function ()
{
Pokeys1.S etRelay (3,0);
print ("Plasma Spindle RT dis-engaged");
 
};




* error m3.jpg (636.31 KB, 1920x1080 - viewed 18 times.)
Logged
ArtF
Administrator
Hero Member
*****
Posts: 4962



View Profile
« Reply #4 on: March 31, 2018, 04:51:48 PM »

Hi:

   The messages seem to show the script being called, can you press the log button at that point and send me a copy of the log? Does an ESTOP happen when you do this or does the spindle just not come on?

Art
Logged
ArtF
Administrator
Hero Member
*****
Posts: 4962



View Profile
« Reply #5 on: March 31, 2018, 07:31:23 PM »

Hi:

 One other test to make, in your SCRIPT tab, enter the following ..

Pokeys1.S etRelay(3,1);

 and press RUN on thge screen. Does the relay turn on? You should hear it
click on the board. Try

 Pokeys1.S etRelay (3,0);

and again press RUN, doe the relay turn off?

Art
Logged
Vangoth
Newbie
*
Posts: 8


View Profile
« Reply #6 on: April 01, 2018, 06:57:31 PM »

yes sir I did the test and the relay is turned on with: Pokeys1.S etRelay (3,1); and it shuts down with Pokeys1.S etRelay (3,0); .

When I run the G code when I reach the M3, the program turns on the N (3) relay and the system locks and the error LED on the screen turns on. Annex image of the error.

I appreciat e your help.


* error.jpg (627.46 KB, 1920x1080 - viewed 22 times.)
Logged
ArtF
Administrator
Hero Member
*****
Posts: 4962



View Profile
« Reply #7 on: April 01, 2018, 08:07:32 PM »

Hi:

 It sounds like maybe an error or typo is in the script.
Can you use the LocalEdit button in the lib to load the
Laser-Spindle Script into the script editor and show me
what the SetSpindl eState macro looks like now?

  There may be soem error in there.

Thx
Art
Logged
Ya-Nvr-No
Moderator
Full Member
*****
Posts: 216



View Profile WWW
« Reply #8 on: April 01, 2018, 08:12:08 PM »

it looks like the G4 X command is the error
G4 is a pause/dwell command followed by a P time value there are some controlle rs that use an X just not sure Auggie does

Side Note:
it is a standard practice to have the spindle M call on and S speed on the same line
most industria l controlle rs will also fault on if a G1 feed move is called before the feed rate is set.
Logged

ArtF
Administrator
Hero Member
*****
Posts: 4962



View Profile
« Reply #9 on: April 01, 2018, 08:14:47 PM »

Hi:

 As YaNvrNo pointed out  the G04X line is an error.

G04 is a dwell but doesnt use X, remove that line and see if the error goes away..
Thx to "YaNvrNo" for pointing this out.

Thx
Art
Logged
Vangoth
Newbie
*
Posts: 8


View Profile
« Reply #10 on: April 01, 2018, 08:51:07 PM »

yes sir thank you very much, indeed the error was the code G4. edit it and it works

Does that mean that I must change the postproce ssor for one that does not generate a g4?
Logged
ArtF
Administrator
Hero Member
*****
Posts: 4962



View Profile
« Reply #11 on: April 01, 2018, 09:08:09 PM »

Hi:

 yes, or edit the files afterward s. The G04 is allowed, but it has to be in the form of G04P.5 for example as a .5 second dwell.
Plasma usually uses this to wait for fire..

Art
Logged
Vangoth
Newbie
*
Posts: 8


View Profile
« Reply #12 on: April 01, 2018, 09:20:42 PM »

yes sir, I am in the task of looking for and testing a postproce ssor that will probe in the Z axis before turning on the torch and then turn on the torch with M3 and pause for 1 second depending on the thickness of the metal so that the Fire penetrate the material and start the cut.

MUCHAS GRACIAS POR SU AYUDA
Logged
ArtF
Administrator
Hero Member
*****
Posts: 4962



View Profile
« Reply #13 on: April 01, 2018, 09:36:31 PM »

You should probably just hook up a home switch on the Z that homes downwards till the switch hits the material and sets it as home.
You just tell Auggie to home the Z then. That can probably be done with a macro call or a simple macro script. Ill check into the GCode
command for telling an axis to home to switch.. I think I added it but Im not sure..

Art
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!