Hello Guest it is April 20, 2019, 12:55:12 PM

Author Topic: NC Programing using variables directly in the code usin ASK command  (Read 2359 times)

0 Members and 1 Guest are viewing this topic.

Hi!

I have started my transition from TurboCNC 4 to Mach3.

The first feel:
- much more complex but far less than EMC
- poses no limits to 99% of hobby and semi pro needs
- Great!  ;D

One of the first things I want to do is reuse this code:

What it does it is that it asks the operator for number of holes and positions to start drilling a grid of holes with countersink, and it does the depth probing while doing so.

=======================================

( START OF MAIN PROGRAM )
#010=5000      ; drilling speed
#050=15        ; start value x-position first hole
#060=30        ; hole grid
#065=0         ; first hole offset
#070=0         ; curent x value
#080=0         ; curent hole number
#90=0
#100=0         ; defult hole number
#200=150       ; start and end safe z
#210=10        ; safe z during transfer
#220=2         ; dril start and retract z value

G00 Z#200
ASK #100       ; How many holes? - this is the line I am having problem with!  ???
ASK #065       ; Number of offset grid? - this is the line I am having problem with!  ???

M03            ; Spindle on
#070=[#070+#050+(#065*#060)] ; calculates start of x position

( start of hole drill loop )
N100 G00 X#070
#080=[#080+1]  ; hole number value

N200 M98 O500

#070=[#070+#060]         ; next hole position
IF #080 LT #100 M97 O100 ; jump to N100 if not all holes are drilled
( end of hole drilling   )

( CONTINUE AFTER HOLE DRILLING)
SAY#0
N300
G00 Z#200     ; retract to safe z
G00 X-80      ; back to start
M05           ; spindle off
M30
( END OF MAIN PROGRAM )

( SUBROUTINE for hole drilling and depth probing )
N500
#90=[#100-#080]   ; Number of remaining holes
SAY #90           ; Prints result to user screen:
G00 Z#220         ; safe retract
G78 Z-18 I2 F#010 ; depth 18mm, at 2mm peck cycle
G31 Z-22 F#010    ; drilling to depth of 22 with probe
SAY#0
G00 Z#210         ; safe retract
M99               ; end of peck drill subroutine

=========================================

I could not find any comment on the ASK command or similar in Mach3 manual neither on the forum.
What ASK does is it pauses the program until a value is keyed in and than continues.

Does anyone have experience with this or can help me with suggestion how to overcome this?
Conversation with user during machining seems a good function to me and I would like to keep it.
I know I could write a macro for it but I would prefer to keep it this way.

Thanks in advance for any input.

Matjaz

Offline Graham Waterworth

*
  • *
  •  1,851 1,851
  • West Yorkshire, England
    • View Profile
Re: NC Programing using variables directly in the code usin ASK command
« Reply #1 on: October 19, 2008, 07:13:52 PM »
You can only enter values in to a DRO on a mach screen, then read them with your code.

Mach also has no IF statement, you would be better using a macro.

Graham
America gave us powered flight, England the steam train and Germany the car.  Who invented the first boat?
Re: NC Programing using variables directly in the code usin ASK command
« Reply #2 on: October 20, 2008, 11:44:40 AM »
Hi Graham!

Thanks for your answer.

It looks I will need to learn how to write a macro...

Matjaz