Topic 13 - Machine Programming
Topic 13 - Machine Programming
Topic13isanintroductorytopiconnumericalcontrolmanufacturing.
The addressed contents are:
. Communicationoforderstothemachine
. Structure of a numerical control program
. Identification of functions
. Axissystemsincomputernumericalcontrolmachinetools(CNC)
. Originsandlandmarks.
Itisrecommendedtofollowthefollowingmethodologyforthestudyofthistopic:
2.1 Introduction
Through a numerical control program, information of the type is transmitted to the machine-tool.
geometric (geometry of the piece, origins of the axis system, dimensions of the tool) and
technologicalinformation(chronologicalorderofphasesandmachiningoperationsandconditionsof
cut).
This program has a specific structure, composed of successive blocks that contain
a series of functions in a certain code. The ISO programming code used
mostly consists of preparatory functions of movements (G), control functions of
advances and speeds of the head (F, S), tool control functions - tool number - (T)
Auxiliary functions (M) such as coolant activation or spindle direction control.
Ingeneral,eachblockorlineofcodewillhaveastructureofthetype:
N G XYZ F S T M
whereNindicatestheblocknumberandeXYZthelimitsaccordingtothepreviouslydefinedcoordinateaxes.
Thefollowingaresomebasicpreparatorymovementfunctions:
All the previous functions except the one marked with an asterisk are modal, meaning they remain active.
until they are replaced by another instruction from the same group or incompatible with it that
Deactivate or until a reset stops the program. Functions F and S are also modal.
The functions from G79 to G89 correspond to fixed cycles for drilling, tapping, reaming, and boring.
machining of cashiers.
The longitudinal tool correction functions serve to activate and deactivate the correctors.
tools that have been previously supplied to the CNC in order to take into account the different
longitudes.
Example:
N0050G01X20.00Y10.00Z30.00F200S1000
N0060X100.00
N0070G00Z50.00
Block 50 instructs the machine to move from the current position to the absolute coordinates.
(20,10,30), at a feed rate of 200 mm/min following a straight trajectory (linear interpolation)
G01),withthespindlerotatingat(S)1000rev/min.
Block60commandsamovementinG01(modal)toX100.YandZdimensionsarenotspecified,sothe
destination coordinates are X100Y10 Z30.
Block70commandsarapidmovementG00fromthepreviouselevationtoZ50,withFasthemaximumspeedofthe
machine and S according to the last block.
It can be programmed in absolute coordinates (with respect to the origin of the program that is active) or
relative (incremental with respect to the previous point in the trajectory). By default, the CNC assume
absolute programming (G90). If working in incremental, a G91 must be programmed in the
initialline.Italsoassumes(G94)Finmm/minsothewritingofblock50hasbeensimplified.
bypassingG90G94.
The auxiliary functions M produce different actions in the machine such as starting or stopping the spindle.
activationorstoppingofthecoolant,resettingvalues,endofprogram,etc.
Thefollowingisalistofsomeauxiliaryfunctions:
To schedule the movements of the MHCN it is necessary to define a system of axes and an origin of
Coordinates. In the following figure, the axis systems that are taken when it is the
tool that moves (X,Y,Z), or when it is the piece that moves, remaining fixed the
tool (X',Y',Z'). The Z axis is located in the direction of the machine's main spindle. If there is no a
mainspindle(spindlethatprovidesmovementtothetool)wil taketheZaxisaccordingtothenormal
projecting to the plane of attachment of the part.
+Y
+X'
+Z´
+Z +X
+Y'
Thereferencepointthatdefinesthezeroofthemovementinthenumericalcontrolprogramcanbedefined
asapointofthemachineitselforasapieceorigin.Ingeneral,themachinezero(pointM)
itisadefinedorigininnumericalcontrolbutisnotusuallyusedasthezeroofthepartprogram.In
In the case of the lathe, a workpiece origin (point W) is used, which is defined as shown in the following.
figure
+X
M W
+Z
Numericalcontrolallowsdefiningtheworkpieceoriginbyintroducingtherelativecoordinatesofthatpoint.
This is how to avoid working with the zero machine that is usually an inaccessible point of the machine.
Ingeneral,thezeropointofthepieceisdeterminedatapointonthepiecethatinterestsus,asindicatedinthe
next figure:
Z
Y
X
W
Z
Y
X
Bibliography:
Sebastián, M.A.; Luis, C.J.: Programming of machine tools with numerical control. Collection
Studies of UNED, UNED, Madrid, 2004
2.5 Examples
Example 13.1
Itisdesiredtocarryoutherefacingofacylindricalpiecemeasuring80mminlengthand30mmindiameter,inorderto
eliminate some irregular edges of up to 2 mm that it presents on its front face. The bar is mounted on
cantileverintheheadstockofanumericalcontrollatheandthearrangementofthelatheusedrequiresthatthe
theprocessconsiderediscarriedoutwithaleftheadturning.Throughouttheprocess,awillbeused.
constant cutting speed of 200 m/min and a feed of 0.15 mm/rev. The program is to be carried out
numericalcontrolfortheindicatedmachining.
Solution
Thesketchofthepieceisthatofthefollowingfigure,inwhichthecrestsonthefrontfacearevisible.
TheprogrammingoftheprogramblocksofCNisexplainedbelow:
Block1.-Activationofmodalfunctions,theadvancefunction,thecuttingspeedfunction,thetoolfunction,
the auxiliary functions and positioning at the starting point of the program (sufficiently distant from the
machining positions); in this case, point Xr = 35 mm and Z = 20 mm, separated 20
mm-ineachdirection-frompointXr=15mmandZ≈2mmwherethetool-workpiececontactwillbegin.
N10 G00 G90 G95 G96 X70 Z20 F0.15 S200 T1.2 M04 M08
Block 2.- Quick approach to the point where the advancement of the referencing will be activated.
N20 X34 Z0
Block3.-Refacedwithanadvanceof0.15mm/rev.
It would be enough to reach X0, but it is usually programmed to "go over" a certain length to ensure the
complete face referencing. Note that since the function is not programmed in the block
Zpositioningwil notchangeitsvalueduringtheexecutionofsaidblock;thatis,
the tool moves parallel to the X axis.
Block4.-Rapidmovementtotheprogramstartposition.
Block5.-Endoftheprogram.
N50 M30
Thisresultsinthefollowingnumericalcontrolprogram:
N10 G00 G90 G95 G96 X70 Z20 F0.15 S200 T1.2 M04 M08
N20 X34 Z0
N50 M30
Example 13.2
Aroughcylindricalturningistobeperformedonacylindricalbarof80mminlengthand30mmindiameter.
diameter up to a final diameter of 18 mm.The bar is mounted overhanging on the headstock of a lathe.
numericalcontrolandthelengthoftheareatobecycledis30mm.A..
cutting speed of 200 m/min and a feed of 0.2 mm/rev. The arrangement of the lathe used requires that the
theconsideredprocessiscarriedoutwiththerotationoftheleftheadandthedepthofthepassesof
Theroughingis2mm.Itisdesiredtocreatethenumericalcontrolprogramfortheindicatedmachining.
Solution
Thesketchofthefinalpieceisasfollows
For the implementation of the indicated machining, a numerical control program such as the
next
Block1.-Activationofthemodalfunctions,theadvancefunction,thecuttingspeedfunction,thetoolfunction,
the auxiliary functions and positioning at the start point of the program (sufficiently far from the
machining positions); in this case, point Xr = 35 mm and Z = 20 mm, separated by 20
mm-ineachdirection-ofthepointXr=15mmandZ=0mmwherethetool-piececontactwillbegin.
N10 G00 G90 G95 G96 X70 Z20 F0.2 S200 T1.3 M04 M07
the plane); that is, to position itself on the diameter of 70 mm, the tool must be
attheradialpositioncorrespondingto70/2=35mm
F0.2 (associated with G95) Feed of 0.2 mm/rev
S200 (associated with G96) Cutting speed of 200 m/min
T1.3 Tool 1 with the corrections from file 3
M04 Activation of the head rotation in the counterclockwise direction (to the left)
M07 Activation of the primary cooling device
Block2.-Quickapproachtothepointwheretheworkadvancewillbeactivated(0.2mm/rev)
N20 X34 Z2
X34; Z2 Positioning of the tool tip at the point (17 mm; 2 mm) that is located
separated2mm-accordingtoeachofthetwocoordinateaxes-withrespecttothepointofcontactwiththe
piece.
Block 3.-Approach to work advancement (0.2 mm/rev) up to the radial position of the first pass of
roughing(depthofcutof2mm)
Note that since the Z positioning function is not programmed in the block, it will not vary.
value of it during the execution of said block; that is, the tool moves
paralleltotheXaxis.
Block4.-Firstroughingpass
N40 Z-30
Please note that since the positioningX function is not scheduled in the block, it will not change the
value of it during the execution of said block; that is, the tool moves
paralleltotheZ-axis.
Block5-Outputofthetoolreferencing
N50 X34
Block6.-Quickreturntothepointwheretheworkadvanceforthesecondpasswillbeactivated
N60 G00 Z2
Block 7.-Approach to work advance (0.2 mm/rev) up to the radial position of the second pass of
roughing
N80 Z-30
Block9.-Exitofthetoolreferencing
N90 X34
Block 10.- Quick return to the point where the work progress for the third and final one will be activated,
last
N100 G00 Z2
Block 11.-Approach to work progress (0.2 mm/rev) until the radial position of the third pass
roughing
N120 Z-30
Block13.-Exitofthetoolreferencing
N130 X34
Block14.-Quickreturntotheprogram'sstartingpoint
Block15-Endoftheprogram
N150 M30
Therefore,anumericalcontrolprogramforroughturningtobecarriedoutisasfollows:
N10 G00 G90 G95 G96 X70 Z20 F0.2 S200 T1.3 M04 M07
N20 X34 Z2
N40 Z-30
N50 X34
N60 G00 Z2
N90 X34
N100 G00 Z2
N120 Z-30
N130 X34
N150 M30
Example 13.3
Solution
Therequestednumericalcontrolprogramconsistsofthefollowingblocks:
Block 1.- Once the punching tool is mounted at the tool change point (point lo
sufficiently far from the work area; e.g.: point X = 200; Y = 200; Z = 300), block 1 produces
the activation of preparatory functions (G90: Absolute coordinates; G95: Feed in mm/rev; G43:
Longitudinalcompensationofthetoolsinceitisaboutdrills;G17:Mainplane(XY),thatofthe
tool(T),thetools' rotationspeed(S),inrpmbydefault,andtheauxiliaryfunction(M03:
Right-handedspindlerotation:
Block 2.- Quick move to the point where the drilling advance will be activated and activation of
primary cooling device (M07):
Block 3.- Displacement with the progress of work to a depth of the drill bit of 8
mm:
Please note that since the X and Y positioning functions are not programmed in the block, no
the value of the coordinates in X and Y will vary during the execution of that block; that is,
thetoolmovesonlyalongtheZaxis,keepingitspositioninXandY.
Block4.-Fastexitdisplacementofthetoolfromthehole:
Block5.-Rapidmovementtothetoolchangepoint(200;200;300):
Not having modified the modal function G00, the movement is made at rapid speed of
positioning.
Block6.-Sincethetoolisgoingtobechanged,thelongitudinalcompensationofthefirstoneiscanceled.
tool(G44);thespindlerotationstops(M05)andthecoolingdeviceisdeactivated(M09):
Block7.-OncethemarkingtoolhasbeenchangedfortheØ10mmdrilingbit,block7
producetheactivationofpreparatoryfunctions(G90:Absolutecoordinates;G95:Feedinmm/rev;
G43: Longitudinal tool compensation; G17: Selection of the XY main plane.
tool(T),thetoolrotationregime(S)andtheauxiliaryfunction(M03:Spindlerotationto
rights
Block8.-Rapidmovement(G00)tothepointwherethedrillingfeedwillbeactivatedandactivation
oftheprimarycoolingdevice(M07):
Block9.-Displacementwiththeworkprogress(G01)toadepthofthedrilltipof
13mm:
Block10.-Rapidmovement(G00)fortoolexitfromthehole:
Block11.-Rapidmovementtothetoolchangepoint(200;200;300):
Block12.-Cancellationofthelongitudinalcompensationofthetool(G44);thespindlerotationstops
(M05) and the cooling device (M09) is deactivated:
Block13.-Endofprogram(M30):
N130 M30
Therefore,anumericalcontrolprogramforthedrillingtobeperformedisasfollows:
N130 M30
Exercise 13.4
Ablockofstainlesssteelmeasuring100mminlengthand35mminwidthundergoesafacemilling.
withafeedspeedof6mm/sandacuttingdepthof3mm.Thecharacteristicsoftheendmil
tobeusedare:diameterd=50mmandz=20teeth;andthemillingisdonewitharotationfrequency
from the 60 rpm milling cutter. It is desired to obtain the numerical control program if such a face milling process
ItiscarriedoutonaverticalspindlemillingmachineequippedwithaFagor8050MUtypecontrolandconsidering
theoriginofthepieceshownintheattachedsketch.
Solution
Therequestednumericalcontrolprogramconsistsofthefollowingblocks:
Block1.-Oncethemil ismountedatthetoolchangepoint(apointfarenoughaway
from the work area; e.g.: point X = 200; Y = 200; Z = 300), block 1 activates the
preparatory functions (G90: Absolute coordinates; G94: Feed in mm/min; G43: Compensation
longitudinalofthetoolsinceitisafrontmillingcutterwithahandle;
G17:Mainplane(XY),thatofthetool(T),thatofthetools' rotationregime(S)andthefunction
auxiliary(M03:Right-handspindlerotation)
Block 2.- Quick movement to the point where work advance will be activated and activation of
primary cooling device (M07):
IthasbeenconsideredthattheXYplane(andthereforetheoriginoftheZaxis)isontheinitialsurfaceof
the piece; therefore, to achieve a depth of 3 mm, one must go to Z = -3mm. Note that for
establishing the 'input' and 'output' lengths of the end mill, the considerations are valid.
made in section c) of Exercise 10.3; although here the addition has been evaluated at 2 mm.
makes these lengths with respect to the value ded/2. With the value Y = 17.5 mm it is guaranteed that the milling cutter
be centered with respect to the piece.
Block3-Displacementattheworkfeedspeed(6mm/s=0.1mm/min)untiltheaxisof
the strawberry surpasses the position of the 'output length' (l=d/2 + 2): s
Block4.-Rapidmovementtothetoolchangepoint(200;200;300):
Block 5.-Cancellation of longitudinal compensation, spindle rotation, and deactivation of the device
cooling
Block6.-Endofprogram:
N60 M30
Therefore,anumericalcontrolprogramforthefacemillingofplaningtobecarriedoutisasfollows:
N60 M30