Hello Guest it is July 07, 2025, 12:13:44 PM

Author Topic: edit macro for threading  (Read 6475 times)

0 Members and 1 Guest are viewing this topic.

edit macro for threading
« on: June 22, 2024, 02:35:35 AM »
Good morning
I found this macro for threading online, it works well but I would like to ask if it is possible to modify it, for my cnc I have to do more passes for example for M6 on the radius set first pass 0.20, second 0.50, third 0.80, last 1.2 and each time I have to create a gcode. Is it possible to modify the macro making it do it automatically? Since I am not capable of it I ask if someone can help me
I attach macro


Title$ = "Filettatura interna"
Prompt$ = "Inserisci RAGGIO ( R ) in mm"
Prompt3$ = "Inserisci valore di profondità ( -Z ) in mm"
Prompt4$ = "Inserisci passo di profondità in mm"
Prompt5$ = "Inserisci avanzamento F"
Default_x$ = "10"
Default_z$ = "2"
Default_st$ = "0.5"
Default_f$ = "1000"
X% = 100
Y% = 100
x = Abs(InputBox$(Prompt$, Title$, Default_x$, X%, Y%))
z = Abs(InputBox$(Prompt3$, Title$, Default_z$, X%, Y%))
st = Abs(InputBox$(Prompt4$, Title$, Default_st$, X%, Y%))
f = InputBox$(Prompt5$, Title$, Default_f$, X%, Y%)
OpenTeachFile "priam.tap"
code "G90"
code "G49"
code "M3 S18000"
code "G1 Z0" & " F800"
code "G0 X0 Y0"
code "G1 X"&x/2
code "F" &f
For i=st To z Step st
code "G2 X"&x/2 & " Y0" & " I-"&x/2 & " J0" & " Z-"&i
Next
code "G1 X0 Y0" & " F800"
code "G1 Z0"
code "M30"
CloseTeachFile
Call LoadTeachFile


example gcode

G90
G49
M3 S12000
G1 Z0 F300
G0 X0 Y0
G1 X0.1
F100
G2 X0.1 Y0 I-0.1 J0 Z-1
G2 X0.1 Y0 I-0.1 J0 Z-2
G2 X0.1 Y0 I-0.1 J0 Z-3
G2 X0.1 Y0 I-0.1 J0 Z-4
G2 X0.1 Y0 I-0.1 J0 Z-5
G2 X0.1 Y0 I-0.1 J0 Z-6
G2 X0.1 Y0 I-0.1 J0 Z-7
G2 X0.1 Y0 I-0.1 J0 Z-8
G2 X0.1 Y0 I-0.1 J0 Z-9
G2 X0.1 Y0 I-0.1 J0 Z-10
G1 X0 Y0 F100
G1 Z0
M30
Re: edit macro for threading
« Reply #1 on: June 25, 2024, 06:23:05 AM »
good morning
thanks Graham Waterworth for the reply, I appreciate your interest, but the macro published is a bit complex for my knowledge (almost nothing in programming), the one I published would be enough for me if it could be modified as described above, in addition to that I would like to modify the direction in which it threads let me explain:
now
G2 X0.1 Y0 I-0.1 J0 Z-1
G2 X0.1 Y0 I-0.1 J0 Z-2
G2 X0.1 Y0 I-0.1 J0 Z -3
G2 X0.1 Y0 I-0.1 J0 Z-4
G2 X0.1 Y0 I-0.1 J0 Z-5
G2 X0.1 Y0 I-0.1 J0 Z-6
G2 X0.1 Y0 I-0.1 J0 Z-7
G2X0.1 Y0 I-0.1 J0 Z-8
G2 X0.1 Y0 I-0.1 J0 Z-9
G2 X0.1 Y0 I-0.1 J0 Z-10

it would be better if it is possible:
G2 X0.1 Y0 I-0.1 J0 Z-10
G2 X0.1 Y0 I-0.1 J0 Z-9
G2 X0.1 Y0 I-0.1 J0 Z -8
G2 X0.1 Y0 I-0.1 J0 Z-7
G2 X0.1 Y0 I-0.1 J0 Z-6
G2 X0.1 Y0 I-0.1 J0 Z-5
G2 X0.1 Y0 I-0.1 J0 Z-4
G2X0.1 Y0 I-0.1 J0 Z-3
G2 X0.1 Y0 I-0.1 J0 Z-2
G2 X0.1 Y0 I-0.1 J0 Z-1

I don't know if it is feasible, it is not in my capabilities I use the machine in hobby field.
regards
Re: edit macro for threading
« Reply #2 on: June 25, 2024, 12:21:34 PM »
Some confusion here as the OP's macro appears to be for an internal fillet not a thread!  Please clarify.

Offline Graham Waterworth

*
  • *
  •  2,783 2,783
  • Yorkshire Dales, England
Re: edit macro for threading
« Reply #3 on: June 25, 2024, 04:55:42 PM »
Okay, I am out.
Without engineers the world stops