Hello Guest it is April 25, 2024, 03:53:22 AM

Author Topic: How to Implement Logical IF Then Expressions in MACH3  (Read 3064 times)

0 Members and 1 Guest are viewing this topic.

Offline Osker

*
  •  41 41
    • View Profile
How to Implement Logical IF Then Expressions in MACH3
« on: December 25, 2007, 11:47:41 AM »
Hello,  I am transitioning from TurboCNC to MACH3 and need assistance with implementing Logical IF Then Statements within MACH3.  The following code snippet within TurboCNC would be used to cut a profile on a lathe (Radius, with X.0 being the Center) by comparing the current cutting depth to the targeted profile depth of cut.  If the target profile depth of cut is below the current depth of cut, there is no change in the depth of the X axis.  If the target profile depth of cut is greater than the current depth of cut, the profile depth of cut is used.  This approach uses the results of a Logical "IF Less Than or Equal to".  If there is a way within MACH3 to implement a similar approach, please point me in the right direction.

Thanks in advance for your consideration.

Regards,

Dan


The concept is to start as some X position that is greater than the stock radius, and decrement the value each pass, until the target depth is achieved.  #3 is the starting radius, #4 is the target X profile coordinate.  #6 is the target Z profile depth of cut.  For example,

N10 #3 = 0.1
N20  #4 = 0.0375  #6 = -0.2878 M98o770
N30  #4 = 0.0575  #6 = -0.3108 M98o770

%RH Profile Subroutine

N770 If #4 LE #3 M97o800  //If target X <= Current  X , then cut at current X depth
N780 G01 X#4 Z#6 F#2  //Else cut at X & Z coordinates
N790 M99  //Return to Main Program
N800 G01 X#3 Z#6 F#2  //Cut at current X depth
N810 M99  //Return to Main Program