Welcome, Guest. Please login or register.
Did you miss your activation email?
September 20, 2017, 01:22:19 PM

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
| | |-+  Gcode does not execute correctly
Pages: 1   Go Down
Print
Author Topic: Gcode does not execute correctly  (Read 1883 times)
0 Members and 1 Guest are viewing this topic.
mariusl
Active Member

Offline Offline

Posts: 17



View Profile WWW
« on: May 27, 2012, 05:22:54 AM »

Hi,
I am new to Wizards, so please be patient. I Looked at some wizards and then created my own that output the following Gcode. Mach gets to line 3 and just get stuck there. What am I screwing up here?

Code:
F1800
G00 Z1
G00 X0 Y0
G01 Y0.5
G01 X199.5
G01 Y2.5
G01 X0.5
G01 Y4.5
G01 X199.5
G01 Y6.5
G01 X0.5
G01 Y8.5
G01 X199.5
G01 Y9.5
G01 X0.5
G00 X0 Y0
M30


And here is the VB that creates the code

Code:
Sub Main()
DoOEMButton (169)
FeedRough = Abs(GetOEMDRO(1070))
ToolDia = Abs(GetOEMDRO(1071))
ToolRad = ToolDia / 2

XPOS = GetOEMDRO(1072)
YPOS = GetOEMDRO(1073)

SafeZ = 1 'Abs(GetOEMDRO(1079))

Length = Abs(GetOEMDRO(1080))
Width = Abs(GetOEMDRO(1075))

StepDepth = Abs(GetOEMDRO(1076))
Clearance = StepDepth * 1.5

If FeedRough = 0 Then
    Code "(MSG,Feed Rate can't be zero)"
End If

If StepDepth = 0 Then
    Code "(MSG,Step down can't be zero)"
End If

If Length = 0 Then
    Code "(MSG,Length can't be zero)"
End If

If Width = 0 Then
    Code "(MSG,Width can't be zero)"
End If

OpenTeachFile "LaserPeenScan.tap"

XStart = XPOS
YStart = YPOS
XFinal = XPOS + Length
YFinal = YPOS + Width

XToolDown = XStart
YToolDown = YStart

PassNumber = 1
Code "F" & FeedRough

DepthofPass = StepDepth

PassType = 1

XStart = XPOS - Offset + ToolRad
YStart = YPOS + ToolRad
XFinal = XPOS + Length - ToolRad
YFinal = YPOS + Width - ToolRad

Code "G00 Z" & SafeZ
Code "G00 X" & XToolDown & " Y" & YToolDown

YpassNo = 0
Do
    YofPass = YStart + (ToolDia * StepDepth  * YpassNo)
    If (YofPass >= YFinal) Then
        Exit Do
    End If
    Code "G01 Y" & YofPass
    Code "G01 X" & XFinal
    PassType = PassType * -1
    YpassNo = YpassNo + 1
   
    YofPass = YStart + (ToolDia * StepDepth * YpassNo)
    If (YofPass >= YFinal) Then
        Exit Do
    End If
    Code "G01 Y" & YofPass
    Code "G01 X" & XStart
   
    PassType = PassType * -1
    YpassNo = YpassNo + 1
Loop
YofPass = YFinal
Code "G01 Y" & YofPass
If (PassType = 1) Then
    Code "G01 X" & XFinal
Else
    Code "G01 X" & XStart
End If

Code "G00 X" & XToolDown & " Y" & YToolDown

Code "M30"
CloseTeachFile

Call LoadTeachFile
End Sub

Main


Logged
ger21
Global Moderator
*
Offline Offline

Posts: 5,534



View Profile WWW
« Reply #1 on: May 27, 2012, 07:58:29 AM »

The g-code runs fine here.

One thing you need to add is a carriage return after the M30, or just a
Code "%"

Otherwise, the M30 won't be recognized.
Logged

Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
mariusl
Active Member

Offline Offline

Posts: 17



View Profile WWW
« Reply #2 on: May 27, 2012, 12:49:42 PM »

Thanks Gerry,
I have a development PC that the code does not run but when I installed on my actual machine PC it worked ok. Strange??
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!