Program frezujący kieszeń o podanych wymiarach

Autor podstrony: Krzysztof Zajączkowski

Stronę tą wyświetlono już: 2818 razy

Frezowanie kieszeni prostokątnej o określonej głębokości jest jedną z częściej stosowanych operacji. Istotne dane dotyczące wymiarów kieszeni to:

Równie istotne jest położenie kieszeni względem krawędzi obrabianego przedmiotu:

Kolejne parametry mające wpływ na czas pracy oraz wykonanie zadania dotyczą samej obrabiarki i narzędzia, którym ta się posługuje. Oto parametry dotyczące geometrii narzędzia i obrabiarki:

Parametry opisujące kształt frezowanej kieszeni
Rys. 1
Parametry opisujące kształt frezowanej kieszeni:
  • szerokość w;
  • długość l;
  • głębokość h;
  • położenie na osi x;
  • położenie na osi y;
  • położenie na osi z;

Kod programu:

#<z_base> = 0 #<max_height> = 1 #<current_height> = #<max_height> #<height> = 20 #<width> = 50 #<length> = 30 #<tool_diameter> = 3 #<begin_x> = [10 + #<tool_diameter> / 2] #<begin_y> = [10 + #<tool_diameter> / 2] g0 g90 f300 z#<z_base> M3 s1000 (włączenie obrotów) o001 if [[#<tool_diameter> le #<width>] and [#<tool_diameter> le #<length>]] #<direction> = -1 g90 x[#<begin_x> + [#<width> - #<tool_diameter>] / 2] y#<begin_y> o007 if [#<current_height> gt #<height>] #<current_height> = #<height> o007 endif o002 while [#<current_height> le #<height>] #<current_width> = #<tool_diameter> g1 g90 z-[#<current_height> - #<z_base>] g91 y-[[#<length> - #<tool_diameter>] * #<direction>] ;y-[#<length> - #<tool_diameter>] #<current_width> = #<tool_diameter> o003 if [#<current_width> gt [#<width> - #<tool_diameter>] / 2] #<current_width> = [#<width> - #<tool_diameter>] / 2 o003 endif o004 while [#<current_width> le [[#<width> - #<tool_diameter>] / 2]] x[#<current_width>] y[[#<length> - #<tool_diameter>] * #<direction>] x-[#<current_width> * 2] y-[[#<length> - #<tool_diameter>] * #<direction>] x[#<current_width>] o005 if [[#<current_width> + #<tool_diameter>] le [[#<width> - #<tool_diameter>] / 2] or #<current_width> eq [[#<width> - #<tool_diameter>] / 2]] #<current_width> = [#<current_width> + #<tool_diameter>] o005 else #<current_width> = [[#<width> - #<tool_diameter>] / 2] o005 endif o004 endwhile #<direction> = [#<direction> * -1] o006 if [[#<current_height> + #<max_height>] le #<height> or #<current_height> eq #<height>] #<current_height> = [#<current_height> + #<max_height>] o006 else #<current_height> = #<height> o006 endif o002 endwhile g90 z0 o001 endif M30

Na poniższym rysunku można zobaczyć proces symulacji frezowania kieszeni w programie LinuxCNC.

Widok trybu symulacji frezowania kieszeni w programie LinuxCNC
Rys. 2
Widok trybu symulacji frezowania kieszeni w programie LinuxCNC