Hello Guest it is January 17, 2020, 07:37:53 AM

Author Topic: Gcode Conversions  (Read 3057 times)

0 Members and 1 Guest are viewing this topic.

Gcode Conversions
« on: June 09, 2011, 10:12:48 PM »
Several years ago I decided to try Mach3 but couldn't get it to run.  Decided to download and try again and so far it looks promising.  I am very used to TurboCNC.

In TurboCNC there is a command ASK#1, the program will stop running and ask you for a value that will be put into the variable #1.  Is there a way to input a variable during runtime with Mach3?

-=7ofclubs=-

Offline ger21

*
  • *
  •  6,291 6,291
    • View Profile
    • The CNC Woodworker
Re: Gcode Conversions
« Reply #1 on: June 09, 2011, 10:17:49 PM »
You can use MDI and type #1=5, but you'd need to pause or stop first I think.

But that's probably not what you want.
Gerry

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

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Gcode Conversions
« Reply #2 on: June 09, 2011, 11:11:07 PM »
You can use MDI and type #1=5, but you'd need to pause or stop first I think.

But that's probably not what you want.

No that doesn't work.  Another question for you though, is there a way to test the value of a parameter?
Here is an example that doesn't seem to work in Mach3

If #1 < 0 then P1000

Is there a syntax for this I am missing?

Offline BR549

*
  •  6,921 6,921
    • View Profile
Re: Gcode Conversions
« Reply #3 on: June 09, 2011, 11:18:41 PM »
Yes to the ASK#1  question and NO to the conditional Gcode question.

Sorry but MACH does NOT do conditional Gcode like most modern controllers do (;-)

But for your simple conditional statement yes it could be done as long as it only contains a max of 2 conditions and 1 jump statement.

(;-) TP
« Last Edit: June 09, 2011, 11:24:15 PM by BR549 »
Re: Gcode Conversions
« Reply #4 on: June 09, 2011, 11:31:53 PM »
Yes to the ASK#1  question and NO to the conditional Gcode question.

Sorry but MACH does NOT do conditional Gcode like most modern controllers do (;-)

But for your simple conditional statement yes it could be done as long as it only contains a max of 2 conditions and 1 jump statement.

(;-) TP

Sweet! Would you happen to have any code examples?

Offline BR549

*
  •  6,921 6,921
    • View Profile
Re: Gcode Conversions
« Reply #5 on: June 10, 2011, 12:21:58 AM »
For the Ask#1` replacement you would use a macro call  Lets say it was M901. Macros allow up to 3 parameters to be called with the macro call

M901 P# Q# R #            The # would be numbers

You would create theM901 macro like this:

SetVar(Param2(),Param3())
While ISMoving()
Sleep(10)
Wend

This would set the Gcode #var (Q parameter) to the R parameter

Easy enough

Next to use a conditional statement you would use a macro say M902

The macro would look like this:

SetVar(2,Param3())
If  Getvar(Param1()) = Param2() Then
Sleep(10)
Code"M98 P#2"
While Ismoving()
sleep(10)
Wend
end if  

The macro sets up the conditional statement and the parametrs PQR call the comparing values and the JUMP to number


THE GCODE program it is called from looks like this


G0 X0 Y0
M901 Q1 R100       <------------------- This will set #1=100
G1 X5 F100
M902 P1 Q100 R2   <------------------- This will allow the program to skip down to the o2 line and proceed

M1
G0X100
(endof test)

o2
(done Deal)
G1 X0Y0
m30




NOT a very easy way to have to do it But that is the best I can do SEEING how Mach cannot do conditional Gcode.

I have a set of macros set up for all the normal conditional calls that I normally would use.

NOT very conventional BUT it does work in a pinch.

Hope that helps (:-) TP


****** The above statement "Sorry but MACH does NOT do conditional Gcode like most modern controllers do (;-)" Should have been"Sorry but MACH does NOT do conditional Gcode unlike most modern controllers  (;-)"



  

« Last Edit: June 10, 2011, 12:30:06 AM by BR549 »