WHILE DO LOOP IN A CNC MILL PROGRAM
Вставка
- Опубліковано 27 сер 2024
- Learn how to use "WHILE DO" statements in a CNC Mill program to change your depth of cut using common variables and relational operators.
O0001(WHILE DO LOOP)
(2.00 X 2.00 SQUARE)
#100=.250 (FIRST DEPTH OF CUT)
#101=.250 (DEPTH PER PASS)
#102=1.500 (TOTAL DEPTH)
N300
G0G17G40G80G49
G91G28Z0.
T3M6
S2500M3
G90G0G54X-.25Y.5
G43H3Z1.M8
WHILE[#100LE#102]DO1
G1Z-#100F50.
G1Y.25F20.
G1X2.25
G1Y-2.25
G1X-.25
G1Y.3
G0Z.25
G0X-.25Y.5
#100=#100+#101
END1
G0Z1.
M5
M9
G91G28Z0.
G28Y0.
G90
M30
%
Always such a good delivery of information - watched it more than once ;)
Mr. Stikkleman, your instrution videos are the most understanding and pleasing to watch. You take time in explaining the rudements of CNC. I have seen in some other videos where they are showing of their talents by moving cursor fast and changing geometry. Please keepup the excellent work.Thank youSubhash
Subhash Gandhi Thank you very much for that feedback. I hope you learn a lot.
Mr Stikkelman, THANK YOU. Clear and helpful.
Great!! Thanks for watching!
Wow... Brings me back to the days I was writing macros!!!!! One of my first ones was when I added an aluminum sub-plate to the machine and I wrote a macro to center drill, drill, countersink and tap using one short program. Great job
Hi, new to macro programming. Could you please share this code if you still have it or direct me towards a site of videos further explaining macros? Thank you
Thanks, Tom! As usual, a very helpful lesson as I slowly dip my toes in the CNC waters.
Best wishes,
Tom Z
My english it's not good but i understand almost all what you said and I'm learning a lot of things from these videos!
Thank you very much Tom!
That's great Dolk Anoj. Thank you for that feedback and thanks for watching my channel. Tom
Tom Stikkelman mr Tom can you teach us some basic of programming. Please. Where is your current location?
This is a good starting point.
I'm used to do this with a different aproach, because sometimes you need to fix depth parameters, and it is useful to do the dividing job to the CN.
For example (using millimeters, I can't understand why using medieval units on a NC machine 😉):
#100=0(starting plane, Z0 for example)
#101=20(finished depth of the cut)
#102=5(number of passes)
#103=[[#100-#101]/#102]
WHILE[#100NE#101]DO1
(Starting position coordinates)
G1Z#100+1F1000
#100=[#100-#103]
G1Z#100F150
(Working coordinates)
G0Z5
END1
This can be a little bit more complex, but when you starting using it it isn't.
It allows you to adjust depth parameters without problems only modifying the #102 parameter.
It is also a lot useful when you work, like me, on a lathe with live tooling when you have to mill complex surfaces with a round edge mill on the diameter.
Adding some parameters you can work with C-Z interpolation making a potentially infinite number of passes, with the same program style, adding also calculation for conicity you can rough and finish for example a conical pocket.
This is only my way of working, I started with basical parametric programmation and then I applied some logic to do what I need with shorter programs.
Are You working on Y axis lathe?
@@TheVist7 Yes, it is since 2017 that I changed factory and I haven't the Y here, but the same approach work also on the Y machines.
Thank you I was trying to use "number of passes" instead of "depth of each pass" !!!!!
@@Sneildog you can do it simply.
Thanks Mr. Stikkelman this is just great.
Very clear explanation- very helpful Tom!
I wisa Porgam. Cnc basis setup okoma cnc porgam tack.My fan
Thank you Tom...this is an productive lesson. Its very appreciated.
This just helped me with an assignment
Very nicely explained!
Ing. gracias por compartir ese conocimiento, seria genial si se animara a compartirnos un tutorial minucioso de programar con Macros. gracias y un saludo
Mr Stikkelman, keep up the great work...I am thoroughly enjoying your tutorials. I am very new to this so I have a question. Can this be used along with the circle milling variable? Do they have to be integrated or do they run inline? and if so, which goes first?
Thanks!
Thanks for the video Tom :)
VERY NICE
isang taon mula ngaun ma2master ko rn yan!!!
Thank you so much! Finally got it!
Hi Tom my name is Hannes. I have been following your videos on macro b programming. We are incorporating the probe on a VTL lathe but I am having issues using the while loop on machining inside and outside diameters. Please could you share some InSite into how the while do will work on diameters when machining a profile that consists of chamfers and two or three different diameters. I will really appreciate the help. I have done a CNC program that uses a canned cycle to rough the profile to 5 mm from size. I want to use the while do statement to machine off the balance of the material before the probe goes and measures the dimension again. Once measured I will make an offset and rerun the same final profile cycle to recut the diameter in question. Thank you in advance
Me salvastes la vida perroooo, gracias :)
Hi Tom, once again thanks so ever for this video. You really helping us to get our feet into cnc. As stated, would you please provide us with some MASTERCAM SURFACING ( parallel, raster, waterline, scallop, optirough, opticore.......) videos
NicePlease, post more parametric programs.
Thank you
thanks for the above lesson, i wish to learn more about macro programming do you have any videos #500-#999 programs?
Mr Stikkelman Thank you for your clear explanations on G programing. Could you explain us how to program a NPT thread in a milling machine by interpolation? I did oone time ago in it was a lot of calculations for a 1 inch NPT
good
Always remember on using variables in macro b programming that Null is not zero it is nothing at all data empty and that zero is a location in the coordinate system on your machine never confuse the two.
Erasing common variables 100-199 is a default parameter setting.
THanks for ur useful video! So what is your simulation software to show the toolpath?
hi Tom can this Program work on the lathe for deep holes
Hi... I made some program based on the video but some program is working and some give an alarm but it shows well on Cimco simulation. If I send the program can you help me to find my mistake?
You can email me the code
tstikkelman@gmail.com
I m big fan for u
Faizan Ansari
Thanks Faizan. Hope they are a help.
Thank you sir😍
Hello how are you? I've watched all his videos are very good. I see that you know very well of parametric programming. I will dare to ask for a video made in Mastercam Mill, using surfaces strategies. I am very grateful.
RENATO CAD/CAM/CNC Thanks for the feedback Renato. I will do a video on that soon. Tom
Thank you very much.
thnx man..
♥
Plz can you give me the formula for hemisphere I want to do in vmc machine
nic Tom
Sir I'm not getting why yoju are using G91 in line G91G28G0 ?
Please respond
Thanks
G91 is absolute positioning in which the machines takes the coordinate entered when taken zero point on the object and G28 is used to tell the machine to travel to the point of G91 and G0 is rapid force. so totally it mean to move the spindle to the absolute position at rapid speed.
because machine home position not program position.
here are examples: 1.) G0G91G28Z0. (safety codes at the beginning and at the end of the program) this means your tools is above your part 10+ inches (depends how big is your machine) away. 2.) G0G90G28 Z.1(never write like this. I just give u for an example to make it clear why using G91 in that line as u had mention) this means your tools are above your part Z.1
G91 Incremental Positioning
Plz make video in circular pocket25radius
Which software your using
can you use the variables to do the calculation for speed and feed rate too? Basing on this tutorial?
Long Pham Nguyen Yes you can! Thanks for watching.
sir how can make in cnc milling concave radius ball nose cutter in macro
Never ever use #100-#199 variables for such simple loop! Because machine builder maybe have one of #100 to #199 in use. It is much saver to use #1-#33 in such a case of simple loop.
Hi, i am using your method but i have a little problem. can you help me with the macro?
Send it to me. tstikkelman@gmail.com
goodnight a question as it is called the simulator
Hey I tried a macro facing program could you look over it for any mistakes. Or maybe run it in you simulator.
Can you please share
Plz micro square pocket rouch program plz sir
A gosub would have been easier with increments.
A Gosub, I haven't seen that statement in over 30 years!! It's a bit like the Goto Statement!
witch software are you using to simulate you macro command
Philippe Parizeau I’m using Mastercam to show the solid model and the Gwizard editor from CNCcookbook to test and simulate the code. Thanks for watching.
what is the software's name ??? thx a lot
improper code g. ??? help
hello everyone!
can anyone help me to learn macro programming for a turning operation?
Thanks!
Hi, very nice.
I wish you to a taper pocket
If can please help
Thank you Sir
Stay safe...