Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 07:54:24 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  How to run a script after each Gcode in single step mode
Pages: 1 2 »   Go Down
Print
Author Topic: How to run a script after each Gcode in single step mode  (Read 1161 times)
0 Members and 1 Guest are viewing this topic.
lfleiva
Active Member

Offline Offline

Posts: 33


View Profile
« on: June 20, 2010, 05:24:35 PM »

Hi!
As title states I am trying to make Mach3 run a script after completing a G0 movement in single step mode.

The application is a turret press punch, I would like to have Mach3 run a punch macro each time it completes a G00 code. Then resume with the next G00 code after completion.  My idea right now is to use single step mode, and somehow resume with a "Start" from within the macro.

Another thought is to detect movement completion from within the macropump. But not really sure how and which would be the implications when jogging or others.

Any ideas?
Thanks!

Luis
Logged
BR549
Active Member

Offline Offline

Posts: 2,551


View Profile
« Reply #1 on: June 20, 2010, 06:09:31 PM »

Not a good idea to have the macropump do motion control. It is dangerous. The macropump runs continuosly and can start machine movement ANY time the conditions are met. Wether you wanted it to or not AND there is no presice way to override/pause the macropump.

Every CNC punchpress I have seen controlled the punch through Gcode
Logged
Ya-Nvr-No
Active Member

Offline Offline

Posts: 268


Scuptris 3D


View Profile
« Reply #2 on: June 20, 2010, 06:43:55 PM »

Gcode or Ladder? Id never use Gcode to control a press. Seems too scary to me.

You would never pass an OSHA safety reg. Keep your phone handy to call 911.
No way to stop it in cycle and now days you have to have that feature on a PP
You might beable to write a brain function to emulate a timed double palm button safety interlock.
But no way to stop it once press is tripped. I dont think the brain is fast enough for that.
There are so many better and safer ways. Just be careful.

Logged
KTM
Active Member

Offline Offline

Posts: 87



View Profile
« Reply #3 on: June 21, 2010, 10:23:41 AM »

Punching machines run in single step mode after an M-Code ie: M25. After every line of code, the pate needs to be punched and then continue until another M-code ie: M22, which cancels punching. The macropump will have to look at the M25(set) and M22 (reset) conditions.

On the safety side, there is a light barrier which is connected in the emergency stop circuit around the punching area.
Logged
BR549
Active Member

Offline Offline

Posts: 2,551


View Profile
« Reply #4 on: June 21, 2010, 06:31:07 PM »

OK IF I follow you correctly Huh   WHere the M25 is a macro that does the punch?  YEP that is all ran from Gcode and you can single step it OR run in auto mode

G1 X1.000 Y1.000 F50
M25 
X2.000 Y2.000
M25
X3.000 Y3.000
M25
Logged
lfleiva
Active Member

Offline Offline

Posts: 33


View Profile
« Reply #5 on: June 21, 2010, 07:05:58 PM »

Thanks for the replies.

I would understand this instead:

G1 X1.000 Y1.000 F50      % No punch
M25
X2.000 Y2.000                   % PUNCH
X3.000 Y3.000                   % PUNCH
M22
X0.000 Y0.000                   % No punch

Regarding the macropump use it really wouldn't actually do motion control or press move with g.code, it will only send a signal to indicate it is time for a punch, and wait for an input signal to acknowledge its completion and then continue with the program.

Is there a way to catch a Gcode the same way M1030 does with M30??

Luis
Logged
BR549
Active Member

Offline Offline

Posts: 2,551


View Profile
« Reply #6 on: June 21, 2010, 07:34:13 PM »

I really dont see the difference. If you want it to punch just add the Mcode to make the punch cycle where you want it. Then everything acts like a NORMAL gcode operation.  The further away from a normal Gcode process you get the harder it is to CAM

No way to catch the Gcode(;-) like you want.

This will do the same thing. AND IF you want to single step just turn on the single step.

G1 X1.000 Y1.000 F50      % No punch
 
X2.000 Y2.000        move           
M25                      PUNCH
X3.000 Y3.000        move         
M25                      PUNCH
X0.000 Y0.000        move
M30
%

OR for a different approach to the move/hold. This allows you to run in move/hold mode before punch OR turn on block delete and run auto mode.

G1 X1.000 Y1.000 F50   
 X2.000 Y2.000        move
/M1                       Optional hold
M25                      PUNCH
X3.000 Y3.000        move
/M1                       Optional hold
M25                      PUNCH
X0.000 Y0.000        move
M30
%

Logged
lfleiva
Active Member

Offline Offline

Posts: 33


View Profile
« Reply #7 on: June 22, 2010, 03:59:44 PM »

X2.000 Y2.000        move           
M25                      PUNCH
X3.000 Y3.000        move         
M25                      PUNCH

Is it possible to tell typical CAM software to write down a M25 (or whatever) after every G00 code ??
If not, this would be quite a pain to do manually.  Undecided
Logged
BR549
Active Member

Offline Offline

Posts: 2,551


View Profile
« Reply #8 on: June 22, 2010, 05:44:22 PM »

SURE the CAM  can handle it in the post with no problem.  

SHEETCAM would work great for this as it is very capable in 2d work like punchpressing, plasma,laser,etc.

Just put drill points at the punch locations and let SC add a drill cycle at each point AND then MOD the post to output the M25 instead of the G81 drill cycle.

Les over at SC is great at supporting his users by helping with posts mods.

THEN it is very simple to convert a standard Cad drawing to a punch file(;-)

SheetCam, Never go to work without it.  (;-)

« Last Edit: June 22, 2010, 05:50:01 PM by BR549 » Logged
lfleiva
Active Member

Offline Offline

Posts: 33


View Profile
« Reply #9 on: June 22, 2010, 06:24:40 PM »

Great tip,
Thanks!
Logged
Pages: 1 2 »   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!