Hello Guest it is March 28, 2024, 10:00:33 PM

Author Topic: How to create G-code from entries on the Mach3 screen  (Read 3677 times)

0 Members and 1 Guest are viewing this topic.

How to create G-code from entries on the Mach3 screen
« on: September 21, 2015, 05:21:35 AM »
Good day,

I have a machine that is a knife cutter. It has a rotational axis on A for the knife angle, and the knife is carried on a bridge using the X and Y.

The machine uses 2.5D option to control Z, which is a ram that moves the knife up and down.

The product only needs to be cut vertically or horizontally, so the A axis only needs to move between 0 degrees for horizontal cut and 90 degrees for vertical cuts. (That said, I wondered if the Tangential toggle would be able to automatically rotate the knife to the direction of travel, but I've not tested this yet?)

Therefore, what I would like to do is provide two DROs on the screen for the user to enter, say, the start position of the vertical cut, one for the X distance and one for the Y distance. These values would be given a variable name that would be called into the G-Code.

For example, to perform a vertical cut of the 500mm wide sheet at 1000mm in length, the user would enter the X DRO as 1000 and the Y DRO as 500, and if the operator presses a button called Vertical Cut these values would produce a GCODE something like:

G0 A90
G0 X1000 Y500
G1 Z-1
G1 X1000 Y0
G1 Z1
G0 X0 Y0

The first line positions the knife vertically, and would always be present for GCODE generated when the Vertical Cut button is pressed. The Z commands trigger the ram to plunge the knife down prior to the cut and then lift it back up again. The vertical GCODE for the cut would always be the same X value, and the Y value would always be Y0. i.e. The machine only cuts all the way through the sheet, and does not cut partially. 

For a horizontal cut, the GCODE generated would be the same, but the A command would always be A0 to position the knife horizontally. And the cut motion would be the same Y value as the DRO entry, but the X would return to X0.

Hope this makes sense. If you want to see the machine check our website: www.polycut-uk.com

I've a VB and Mach3 Novice (but I'm learning fast!)

We are using the CS-LAB CSMIO IP-A controller, and KINCO Servo drives for XY and A.

Any advice on how best to do this would be appreciated.

Many thanks
Mark

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: How to create G-code from entries on the Mach3 screen
« Reply #1 on: September 21, 2015, 07:49:02 AM »
Hi Mark,

that is quite easy.

1. put two input fields on your screen with OEMDRO's, lets say OEMDRo 1300 for X-distance and OEMDRo 1301 for Y-distance
2. place a button in screen and fill it with a VB something like this

Sub Main
   XPos=GetOEMDRO(1300)
   YPos=GetOEMDRO(1301)

   Code "G0 A90"
   Code "G0 X" + XPos + "Y" + YPos
   Code "G1 Z-1"
   Code "G1 X" + XPos + "Y0"
   Code "G1 Z1"
   Code "G0 X0 Y0"

End Sub

Thomas
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: How to create G-code from entries on the Mach3 screen
« Reply #2 on: September 21, 2015, 09:27:57 AM »
Hi Thomas,

Thanks for your assistance. I have tried it and it worked first time!

I don't suppose you know about whether the Mach3 program would automatically rotate my Knife A Axis to the direction of travel would it? Haven't tried to test this yet, but it would be great if it does - I think it is something to do with Tangential Control, but I am not sure and the manuals are very brief on this.

Many thanks again for your help
Mark

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: How to create G-code from entries on the Mach3 screen
« Reply #3 on: September 21, 2015, 10:08:40 AM »
Hi Mark,

never used the Tangential functionality, but i think it will rotate the knife,
because this is the basic function of tangential control.

Thomas
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: How to create G-code from entries on the Mach3 screen
« Reply #4 on: September 21, 2015, 11:12:01 AM »
Beware there ARE problems with Tangent control. You would be better to let  CAM do the tangent code work.

(;-)TP