0% found this document useful (0 votes)
27 views21 pages

Advanced Class Exercises

The document contains a series of exercises related to programming for CNC machines, focusing on various functionalities such as tool changes, sub-program support, and machining time calculations. Each exercise provides specific programming commands and structures to achieve desired outcomes in CNC operations. The exercises also include examples of how to implement features like coolant management and dual offset heads.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views21 pages

Advanced Class Exercises

The document contains a series of exercises related to programming for CNC machines, focusing on various functionalities such as tool changes, sub-program support, and machining time calculations. Each exercise provides specific programming commands and structures to achieve desired outcomes in CNC operations. The exercises also include examples of how to implement features like coolant management and dual offset heads.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 21

collaboration

Pro/NC-GPOST
innovation

Exercises
global solutions

© 2000 PTC
Exercise 1
Output M13 instead of M3 for SPINDL if the COOLNT is
programmed between the SPINDL and the first motion

LOADTL / 1 M6 T01
SPINDL / RPM, 2000, CLW S2000 M13
COOLNT / FLOOD G0 X Y
RAPID G43 H Z
GOTO / ….

LOADTL / 1 M6 T01
SPINDL / RPM, 2000, CLW S2000 M3
RAPID G0 X Y
GOTO / …. G43 H Z

© 2000 PTC
Exercise 2
Support for sub-program in incremental

DEFSUB / 1 M6 T1
FEDRAT / 12 ...
GOTO / 2, 2, 2 G0 X1 Y1 Z1
… M98 P001
ENDSUB G0 X6 Y6 Z6
… M98 P001
LOADTL / 1 ...
… M30
RAPID ...
GOTO / 1, 1, 1 O0001
CALSUB / 1 G91 G1 X1 Y1 Z1 F12
TRANS / 5, 5, 5 ...
GOTO / 1, 1, 1 G90
M99
© 2000 PTC
Exercise 3

Support for sub-program using fixture offset


DEFSUB / 1 M6 T1
FEDRAT / 12 ...
GOTO / 2, 2, 2 G54.1
… G0 X1 Y1 Z1
ENDSUB M98 P001
… G54.2
LOADTL / 1 M98 P001
… ...
SET/OFSELT,1 M30
RAPID ...
GOTO / 1, 1, 1
CALSUB / 1 O0001
TRANS / 5, 5, 5 G1 X2 Y2 Z2
GOTO / 1, 1, 1 ...
SET / OFSELT,2 M99
CALSUB / 1
© 2000 PTC
Exercise 4
Support for sub-program using “block” recall
DEFSUB / 1 M6 T1
FEDRAT / 12 ...
GOTO / 2, 2, 2G54.1
… N12 G0 X2 Y2 Z2
ENDSUB ….
… N24 G...
LOADTL / 1 ...
… G54.2
SET/OFSELT,1 G77 N12 N24
RAPID
GOTO / 1, 1, 1
CALSUB / 1
TRANS / 5, 5, 5
GOTO / 1, 1, 1
SET / OFSELT,2
CALSUB / 1
© 2000 PTC
Exercise 5
4 Axis Lathe with 2 tapes output

© 2000 PTC
Exercise 6
Machining time at tool change
The user wants to have the machining time until the next tool
change at each tool change :

M6 T1
(Machining Time : 120s)
SM
G0 X Y Z

M6 T2
(Machining Time : 80s)
SM
G0 X Y Z
...
© 2000 PTC
Exercise 7
Issue an OPSTOP and clear the part every 2 hours of
machining

© 2000 PTC
Exercise 8
Support for a dual offsets head :

Note : this head is directly supported


by the questionnaire in 2001.

© 2000 PTC
collaboration

Pro/NC-GPOST
innovation

Solutions
global solutions

© 2000 PTC
Exercise 1
REDEF/ON
REDEF/ON CIMFIL/ON,SPINDL
CIMFIL/ON,SPINDL
$$
$$ Macro
Macro to
to output
output the
the code
code for
for SPINDL
SPINDL ++ COOLNT
COOLNT
OKCOL=0
OKCOL=0 $$
$$ COOLNT
COOLNT not
not processed
processed $$
$$ If
If coolant
coolant is
is programmed
programmed before
before next
next motion
motion
XX=POSTF(20)
XX=POSTF(20) $$
$$ Save
Save CL
CL rec.
rec.
CALL/COLFD
CALL/COLFD $$
$$ Look
Look for
for COOLNT
COOLNT before
before motion
motion
COLFD
COLFD == MACRO
MACRO //
IF
IF (OKCOL.NE.0)
(OKCOL.NE.0) THEN
THEN
$$
$$ Macro
Macro to
to find
find COOLNT
COOLNT before
before
$$
$$ Replace
Replace M3
M3 by
by M13
M13 on
on next
next output
output
$$
$$ next
next motion
motion T1=TEXT/'M3';T2=TEXT/'M13';REPLAC/T1,T2,1,1
T1=TEXT/'M3';T2=TEXT/'M13';REPLAC/T1,T2,1,1
$$
$$ Current
Current CL
CL position
position ENDIF
ENDIF
CLPOS=POSTF(7,1)+1
CLPOS=POSTF(7,1)+1 XX=POSTF(21)
XX=POSTF(21) $$
$$ restore
restore CL
CL rec
rec
OKCOL=0
OKCOL=0 XX=POSTF(13)
XX=POSTF(13) $$
$$ Process
Process CL
CL record
record
DO/ENDO1,ILOOP=1,2
DO/ENDO1,ILOOP=1,2 CIMFIL/OFF
CIMFIL/OFF
DMY=POSTF(14)
DMY=POSTF(14) $$
$$ Get
Get next
next CL
CL (TAPERD)
(TAPERD)
CLC=POSTF(7,2)
CLC=POSTF(7,2) $$ Class of CL record
$$ Class of CL record CIMFIL/ON,COOLNT
CIMFIL/ON,COOLNT
SCL=POSTF(7,3)
SCL=POSTF(7,3) $$
$$ sub-class
sub-class of
of CL
CL record
record IF
IF (OKCOL.NE.0)
(OKCOL.NE.0) THEN
THEN
ILOOP=1 $$ $$
$$ COOLNT
COOLNT has
has been
been processed
processed
ILOOP=1 $$ Stay
Stay in
in loop
loop
XX=POSTF(2,1,1867,1)
XX=POSTF(2,1,1867,1) $$
$$ Disable
Disable output
output
IF(CLC.EQ.5000)THEN
IF(CLC.EQ.5000)THEN
XX=POSTF(13)
XX=POSTF(13) $$
$$ Process
Process
$$
$$ This
This is
is GOTO
GOTO
XX=POSTF(2,1,1867,1)
XX=POSTF(2,1,1867,1) $$
$$ Re-enable
Re-enable output
output
OKFIND=0
OKFIND=0 $$
$$ COOLNT
COOLNT not
not found
found
ELSE
ELSE
ILOOP=3
ILOOP=3 $$
$$ Exit
Exit the
the loop
loop XX=POSTF(13)
XX=POSTF(13) $$
$$ Process
Process
ENDIF
ENDIF ENDIF
ENDIF
IF(CLC.EQ.2000.AND.SCL.EQ.(ICODEF(COOLNT))
IF(CLC.EQ.2000.AND.SCL.EQ.(ICODEF(COOLNT)) THEN
THEN OKCOL=0
OKCOL=0 $$
$$ reset
reset OKCOL
OKCOL
$$
$$ This
This is
is aa COOLNT
COOLNT CIMFIL/OFF
CIMFIL/OFF
OKFIND=1
OKFIND=1 $$
$$ COOLNT
COOLNT found
found
ILOOP=3
ILOOP=3 $$
$$ Exit the loop
Exit the loop
ENDIF
ENDIF
ENDO1)
ENDO1) CONTIN
CONTIN $$
$$ End
End of
of DO
DO loop
loop
$$
$$ return
return initial
initial position
position in
in CL
CL
RSLT=POSTF(15,CLPOS)
RSLT=POSTF(15,CLPOS)
TERMAC
TERMAC

© 2000 PTC 1
Exercise 2
$$
$$ Custom
Custom Var.
Var. CIMFIL
CIMFIL // ON,
ON, DEFSUB
DEFSUB $$
$$ Starts
Starts on
on all
all DEFSUB
DEFSUB
PASNUM=1
PASNUM=1 SUBNUM=POSTF(7,4)
SUBNUM=POSTF(7,4) $$ $$ First
First param
param of
of the
the DEFSUB
DEFSUB command
command
RESERV/XSTART,100,YSTART,100,ZSTART,100
RESERV/XSTART,100,YSTART,100,ZSTART,100 $$
$$ Convert
Convert the
the real
real SUBNUM
SUBNUM to
to aa string
string
$$
$$ OO followed
followed by
by 44 digits
digits
CIMFIL
CIMFIL // ON,
ON, CALSUB
CALSUB $$
$$ Starts
Starts on
on all
all CALSUB
CALSUB TPNUM=TEXT/'O',CONVF,(1000+SUBNUM),4,0,0,1,1,'$'
TPNUM=TEXT/'O',CONVF,(1000+SUBNUM),4,0,0,1,1,'$'
CNUM=POSTF(7,4)
CNUM=POSTF(7,4) $$ $$ First
First param.
param. of
of the
the CALSUB
CALSUB command
command SEQNO/OFF
SEQNO/OFF
$$
$$ Store
Store the
the staring
staring value
value X,Y,Z
X,Y,Z position
position of
of the
the sub
sub INSERT/'
INSERT/' $'$'
$$ to use them in the sub-program
$$ to use them in the sub-program INSERT/TPNUM
INSERT/TPNUM $$
$$ Insert
Insert sub-program
sub-program number
number
$$
$$ as
as aa FROM
FROM for
for the
the incremental
incremental SEQNO/10,INCR,10
SEQNO/10,INCR,10
IF
IF ((XSTART(CNUM)).EQ.9999)
((XSTART(CNUM)).EQ.9999) THEN THEN $$
$$ No
No output
output start
start spindle
spindle
XSTART(CNUM)=POSTF(1,3,350)
XSTART(CNUM)=POSTF(1,3,350) XX=POSTF(2,1,1867,1)
XX=POSTF(2,1,1867,1)
YSTART(CNUM)=POSTF(1,3,351)
YSTART(CNUM)=POSTF(1,3,351) SPINDL/ON
SPINDL/ON
ZSTART(CNUM)=POSTF(1,3,352)
ZSTART(CNUM)=POSTF(1,3,352) XX=POSTF(2,1,1867,0)
XX=POSTF(2,1,1867,0)
ENDIF
ENDIF RAPID
RAPID
$$
$$ Converts
Converts the
the real
real CNUM
CNUM to
to aa string
string XP=XSTART(SUBNUM)
XP=XSTART(SUBNUM)
$$
$$ M98P
M98P followed
followed byby program
program number
number YP=YSTART(SUBNUM)
YP=YSTART(SUBNUM)
TPNUM=TEXT/'
TPNUM=TEXT/' M98M98 P',CONVF,(1000+CNUM),4,0,0,1,3,'$'
P',CONVF,(1000+CNUM),4,0,0,1,3,'$' ZP=ZSTART(SUBNUM)
ZP=ZSTART(SUBNUM)
INSERT / TPNUM
INSERT / TPNUM $$
$$ Sub-program
Sub-program call
call FROM/XP,YP,ZP
FROM/XP,YP,ZP
POSTN/ALL
POSTN/ALL $$ $$ To
To output
output all
all codes
codes on
on next
next GOTO
GOTO $$
$$ Switch
Switch in
in incremental
incremental
REPEAT/OFF
REPEAT/OFF MODE/INCR
MODE/INCR
CIMFIL
CIMFIL // OFF
OFF CIMFIL/OFF
CIMFIL/OFF

CIMFIL/ON,FINI
CIMFIL/ON,FINI
CIMFIL
CIMFIL // ON,
ON, ENDSUB
ENDSUB $$
$$ Starts
Starts on
on all
all ENDSUB
ENDSUB IF
IF (PASNUM.EQ.1)
(PASNUM.EQ.1) THEN
THEN
INSERT/
INSERT/ '' G90$'
G90$' PASNUM=2
PASNUM=2 $$
$$ second
second pass
pass
INSERT
INSERT // '' M99$'
M99$' $$
$$ Inserts
Inserts end
end of
of sub-program
sub-program $$ end of main program
$$ end of main program
$$
$$ Make
Make aa dummy
dummy move
move to
to reset
reset in
in absolute
absolute no
no output
output INSERT/'
INSERT/' M30$'
M30$'
XX=POSTF(2,1,1867,1)
XX=POSTF(2,1,1867,1) FPOS=POSTF(7,1)
FPOS=POSTF(7,1) $$
$$ CL
CL record
record address
address of
of FINI
FINI
MODE/INCR,OFF
MODE/INCR,OFF DMY=POSTF(15,(MPOS+1))
DMY=POSTF(15,(MPOS+1)) $$ $$ rewind
rewind to
to MACHIN
MACHIN
RAPID
RAPID ELSE
ELSE
GOTO/0,0,0
GOTO/0,0,0 DMY=POSTF(13)
DMY=POSTF(13)
XX=POSTF(2,1,1867,0)
XX=POSTF(2,1,1867,0) ENDIF
ENDIF
CIMFIL
CIMFIL // OFF
OFF $$
$$ End
End of
of macro
macro on
on ENDSUB
ENDSUB CIMFIL/OFF
CIMFIL/OFF

© 2000 PTC 1
Exercise 2
CIMFIL/ON,LOADTL
CIMFIL/ON,LOADTL CIMFIL/ON,MACHIN
CIMFIL/ON,MACHIN
IF
IF (PASNUM.EQ.1)
(PASNUM.EQ.1) THEN
THEN XX=POSTF(13)
XX=POSTF(13) $$
$$ Process
Process
DMY=POSTF(13)
DMY=POSTF(13) $$
$$ process
process tool
tool change
change MPOS=POSTF(7,1)
MPOS=POSTF(7,1) $$
$$ MACHIN
MACHIN CL
CL record
record position
position
ELSE
ELSE $$ Look for first LOADTL
$$ Look for first LOADTL
DMY=POSTF(15,FPOS)
DMY=POSTF(15,FPOS) $$
$$ Go
Go to
to FINI
FINI DO/DO1,ILOOP=1,10
DO/DO1,ILOOP=1,10
ENDIF
ENDIF DMY=POSTF(14)
DMY=POSTF(14) $$
$$ Read
Read next
next CL
CL record
record
CIMFIL/OFF
CIMFIL/OFF CLC=POSTF(7,2)
CLC=POSTF(7,2) $$
$$ CL
CL record
record class
class
SCL=POSTF(7,3)
SCL=POSTF(7,3) $$
$$ CL
CL record
record sub-class
sub-class
ILOOP=1
ILOOP=1
IF(CLC.EQ.2000.AND.SCL.EQ.(ICODEF(LOADTL)))
IF(CLC.EQ.2000.AND.SCL.EQ.(ICODEF(LOADTL))) THEN THEN
$$
$$ This
This is
is aa LOADTL
LOADTL
LOPOS=POSTF(7,1)
LOPOS=POSTF(7,1) $$
$$ Current
Current CL
CL position
position
ILOOP=12
ILOOP=12 $$
$$ to
to exit
exit of
of the
the LOOP
LOOP
ENDIF
ENDIF
DO1)
DO1) CONTIN
CONTIN
DMY=POSTF(15,LOPOS)
DMY=POSTF(15,LOPOS)
PASNUM=1
PASNUM=1
$$
$$ Init
Init the
the XSTART
XSTART value
value
DO/ENDOO,ILOOP=1,100
DO/ENDOO,ILOOP=1,100
XSTART(ILOOP)=9999
XSTART(ILOOP)=9999
ENDOO)
ENDOO) CONTIN
CONTIN
CIMFIL/OFF
CIMFIL/OFF

© 2000 PTC 1
Exercise 3
MOTION=0
MOTION=0 CIMFIL/ON,FINI
CIMFIL/ON,FINI
PASNUM=1
PASNUM=1 IF
IF (PASNUM.EQ.1)
(PASNUM.EQ.1) THEN
THEN
PASNUM=2
PASNUM=2 $$
$$ second
second pass
pass
CIMFIL
CIMFIL // ON,
ON, CALSUB
CALSUB $$ Starts
Starts on
on all
all CALSUB
CALSUB $$ Motion macro
$$ Motion macro
CNUM=POSTF(7,4)
CNUM=POSTF(7,4) $$
$$ First
First parameter
parameter ofof the
the GTOFF=POSTF(26,5,5,0)
GTOFF=POSTF(26,5,5,0) $$
$$ no
no macro
macro on
on motion
motion
CALSUB
CALSUB command
command $$
$$ end
end of
of main
main program
program
$$
$$ Converts
Converts the
the real
real CNUM
CNUM to
to INSERT/'M30$'
INSERT/'M30$'
$$
$$ aa string
string M98P
M98P followed
followed by
by program
program number
number
FPOS=POSTF(7,1)
FPOS=POSTF(7,1) $$
$$ CL
CL record
record address
address of
of FINI
FINI
TPNUM=TEXT/'M98P',CONVF,(1000+CNUM),4,0,0,1,3,'$'
TPNUM=TEXT/'M98P',CONVF,(1000+CNUM),4,0,0,1,3,'$'
DMY=POSTF(15,(MPOS+1))
DMY=POSTF(15,(MPOS+1)) $$$$ rewind
rewind to
to MACHIN
MACHIN
IF
IF (SETIME.GT.1)
(SETIME.GT.1) THEN
THEN
ELSE
ELSE
INSERT/'G68$'
INSERT/'G68$'
DMY=POSTF(13)
DMY=POSTF(13)
ELSE
ELSE
ENDIF
ENDIF
SETIME=2
SETIME=2
CIMFIL/OFF
CIMFIL/OFF
ENDIF
ENDIF
INSERT
INSERT // TPNUM
TPNUM $$
$$ Sub-program
Sub-program call
call
CIMFIL/ON,LOADTL
CIMFIL/ON,LOADTL
GTON=POSTF(26,5,5,1)
GTON=POSTF(26,5,5,1) $$ $$ activate
activate macro
macro on
on motion
motion
GTOFF=POSTF(26,5,5,0)
GTOFF=POSTF(26,5,5,0) $$
$$ de-activate
de-activate macro
macro on
on motion
motion
CIMFIL
CIMFIL // OFF
OFF
IF
IF (PASNUM.EQ.1)
(PASNUM.EQ.1) THEN
THEN
DMY=POSTF(13)
DMY=POSTF(13) $$
$$ process
process tool
tool change
change
CIMFIL
CIMFIL // ON,
ON, DEFSUB
DEFSUB $$
$$ Starts
Starts on
on all
all DEFSUB
DEFSUB
ELSE
ELSE
SUBNUM=POSTF(7,4)
SUBNUM=POSTF(7,4) $$
$$ First
First param
param of
of the
the DEFSUB
DEFSUB
command
command DMY=POSTF(15,FPOS)
DMY=POSTF(15,FPOS) $$
$$ Go
Go to
to FINI
FINI
$$
$$ Convert
Convert the
the real
real SUBNUM
SUBNUM toto aa ENDIF
ENDIF
$$
$$ string
string OO followed
followed by
by 44 digits
digits CIMFIL/OFF
CIMFIL/OFF
TPNUM=TEXT/'O',CONVF,(1000+SUBNUM),4,0,0,1,1,'$'
TPNUM=TEXT/'O',CONVF,(1000+SUBNUM),4,0,0,1,1,'$'
INSERT/TPNUM
INSERT/TPNUM $$
$$ Insert
Insert sub-program
sub-program number
number
POSTN/ALL
POSTN/ALL $$
$$ reset
reset all
all G/M
G/M registers
registers codes
codes
CIMFIL/OFF
CIMFIL/OFF $$
$$ End
End of
of macro
macro on
on DEFSUB
DEFSUB

CIMFIL
CIMFIL // ON,
ON, ENDSUB
ENDSUB $$
$$ Starts
Starts on
on all
all ENDSUB
ENDSUB
INSERT
INSERT // 'M99$'
'M99$' $$
$$ Inserts
Inserts end
end of
of sub-program
sub-program
CIMFIL
CIMFIL // OFF
OFF $$
$$ End
End of
of macro
macro on
on ENDSUB
ENDSUB

CIMFIL/ON,GOTO
CIMFIL/ON,GOTO
$$
$$ Ignore
Ignore positioning
positioning GOTO
GOTO before
before CALLSUB
CALLSUB
CIMFIL/OFF
CIMFIL/OFF
© 2000 PTC 1
Exercise 3
CIMFIL/ON,MACHIN
CIMFIL/ON,MACHIN CIMFIL/ON,SET
CIMFIL/ON,SET
XX=POSTF(13)
XX=POSTF(13) $$
$$ Process
Process $$
$$ Ignore
Ignore SET/OFSELT,OFF
SET/OFSELT,OFF
MPOS=POSTF(7,1)
MPOS=POSTF(7,1) $$
$$ MACHIN
MACHIN CL
CL record
record position
position IF
IF (POSTF(6,5).EQ.1)
(POSTF(6,5).EQ.1) THEN
THEN
$$ Look for first LOADTL
$$ Look for first LOADTL $$ Argument 2 is a real
$$ Argument 2 is a real
DO/DO1,ILOOP=1,10
DO/DO1,ILOOP=1,10 SETVAL=POSTF(7,5)
SETVAL=POSTF(7,5)
DMY=POSTF(14)
DMY=POSTF(14) $$
$$ Read
Read next
next CL
CL record
record INSERT/'G54.',SETVAL,'$'
INSERT/'G54.',SETVAL,'$'
CLC=POSTF(7,2)
CLC=POSTF(7,2) $$
$$ CL
CL record
record class
class ENDIF
ENDIF
SCL=POSTF(7,3)
SCL=POSTF(7,3) $$
$$ CL
CL record
record sub-class
sub-class CIMFIL/OFF
CIMFIL/OFF
ILOOP=1
ILOOP=1
IF(CLC.EQ.2000.AND.SCL.EQ.(ICODEF(LOADTL)))
IF(CLC.EQ.2000.AND.SCL.EQ.(ICODEF(LOADTL))) THEN THEN
$$
$$ This
This is
is aa LOADTL
LOADTL
LOPOS=POSTF(7,1)
LOPOS=POSTF(7,1) $$
$$ Current
Current CL
CL position
position
ILOOP=12
ILOOP=12 $$
$$ to
to exit
exit of
of the
the LOOP
LOOP
ENDIF
ENDIF
ENDIF
ENDIF
DO1)
DO1) CONTIN
CONTIN
DMY=POSTF(15,LOPOS)
DMY=POSTF(15,LOPOS)
PASNUM=1
PASNUM=1
GTOFF=POSTF(26,5,5,3)
GTOFF=POSTF(26,5,5,3) $$ $$ no
no macro
macro on
on motion
motion
CIMFIL/OFF
CIMFIL/OFF

© 2000 PTC 1
Exercise 4
REDEF/ON
REDEF/ON CIMFIL/ON,CALSUB
CIMFIL/ON,CALSUB
$$
$$ For
For the
the first
first call
call output
output the
the NC
NC codes
codes then
then call
call the
the
RESERV/SSUBCL,100,ESUBCL,100
RESERV/SSUBCL,100,ESUBCL,100 $$
$$ CL
CL rec
rec of
of DEFSUB
DEFSUB
$$
$$ lines
lines :: G77
G77 Nstart
Nstart Nend
Nend for
for the
the others
others
RESERV/FCAL,100
RESERV/FCAL,100 $$
$$ To
To detect
detect the
the first
first CALSUB
CALSUB
RESERV/NSTART,100,NEND,100
RESERV/NSTART,100,NEND,100 $$
$$ Start
Start and
and End
End seq
seq number
number SUBNUM=POSTF(7,4)
SUBNUM=POSTF(7,4) $$
$$ Sub
Sub program
program number
number
CURPOS=POSTF(7,1)
CURPOS=POSTF(7,1)
CIMFIL/ON,MACHIN
CIMFIL/ON,MACHIN IF
IF ((FCAL(SUBNUM)).EQ.0)
((FCAL(SUBNUM)).EQ.0) THEN
THEN
XX=POSTF(13)
XX=POSTF(13) $$
$$ Process
Process $$
$$ First
First call,
call, do
do the
the motions
motions
$$
$$ Load
Load the
the FCAL
FCAL variable
variable NST=SSUBCL(SUBNUM)
NST=SSUBCL(SUBNUM)
DO/FDO,ILOOP=1,100
DO/FDO,ILOOP=1,100 EST=ESUBCL(SUBNUM)
EST=ESUBCL(SUBNUM)
FCAL(ILOOP)=0
FCAL(ILOOP)=0 NSTART(SUBNUM)=POSTF(1,1,2012)
NSTART(SUBNUM)=POSTF(1,1,2012) $$ $$ Next
Next sequence
sequence number
number
FDO)
FDO) CONTIN
CONTIN XX=POSTF(15,(NST+1))
XX=POSTF(15,(NST+1))
$$
$$ Look
Look for
for first
first LOADTL
LOADTL and
and store
store CL
CL rec
rec for
for DEFSUB
DEFSUB XX=POSTF(13)
XX=POSTF(13)
DO/DO1,ILOOP=1,10
DO/DO1,ILOOP=1,10 DO/DOCL,ILOOP=1,2
DO/DOCL,ILOOP=1,2
DMY=POSTF(14)
DMY=POSTF(14) $$
$$ Read
Read next
next CL
CL record
record ILOOP=1
ILOOP=1
CLC=POSTF(7,2)
CLC=POSTF(7,2) $$
$$ CL
CL record
record class
class XX=POSTF(14)
XX=POSTF(14) $$
$$ read
read next
next CL
CL rec.
rec.
SCL=POSTF(7,3)
SCL=POSTF(7,3) $$
$$ CL
CL record
record sub-class
sub-class CLREC=POSTF(7,1)
CLREC=POSTF(7,1)
ILOOP=1
ILOOP=1 IF
IF (CLREC.EQ.EST)
(CLREC.EQ.EST) THEN
THEN
IF(CLC.EQ.2000.AND.SCL.EQ.(ICODEF(LOADTL)))
IF(CLC.EQ.2000.AND.SCL.EQ.(ICODEF(LOADTL))) THEN THEN ILOOP=3
ILOOP=3
LOPOS=POSTF(7,1)
LOPOS=POSTF(7,1) $$
$$ Current
Current CL
CL position
position ELSE
ELSE
ILOOP=12
ILOOP=12 $$
$$ to
to exit
exit of
of the
the LOOP
LOOP NEND(SUBNUM)=POSTF(1,1,2012)
NEND(SUBNUM)=POSTF(1,1,2012) $$ $$ Next
Next seq.
seq. number
number
ENDIF
ENDIF XX=POSTF(13)
XX=POSTF(13)
IF
IF (CLC.EQ.2000.AND.SCL.EQ.(ICODEF(DEFSUB)))
(CLC.EQ.2000.AND.SCL.EQ.(ICODEF(DEFSUB))) THEN THEN ENDIF
ENDIF
ADR=POSTF(7,1)
ADR=POSTF(7,1) $$
$$ CL
CL rec
rec number
number DOCL)
DOCL) CONTIN
CONTIN
SUBNUM=POSTF(7,4)
SUBNUM=POSTF(7,4) $$
$$ Sub-program
Sub-program number
number FCAL(SUBNUM)=1
FCAL(SUBNUM)=1
SSUBCL(SUBNUM)=ADR
SSUBCL(SUBNUM)=ADR ELSE
ELSE
ENDIF
ENDIF $$
$$ Nth
Nth call,
call, call
call the
the lines
lines
IF
IF (CLC.EQ.2000.AND.SCL.EQ.(ICODEF(ENDSUB)))
(CLC.EQ.2000.AND.SCL.EQ.(ICODEF(ENDSUB))) THEN THEN NST=NSTART(SUBNUM)
NST=NSTART(SUBNUM)
ADR=POSTF(7,1)
ADR=POSTF(7,1) $$ CL rec number
$$ CL rec number EST=NEND(SUBNUM)
EST=NEND(SUBNUM)
ESUBCL(SUBNUM)=ADR
ESUBCL(SUBNUM)=ADR INSERT/'G77N',NST,'N',EST,'$'
INSERT/'G77N',NST,'N',EST,'$'
ENDIF
ENDIF ENDIF
ENDIF
DO1)
DO1) CONTIN
CONTIN $$
$$ Return
Return after
after the
the CALSUB
CALSUB
DMY=POSTF(15,LOPOS)
DMY=POSTF(15,LOPOS) $$
$$ Position
Position onon first
first LOADTL
LOADTL XX=POSTF(15,(CURPOS+1))
XX=POSTF(15,(CURPOS+1))
GTOFF=POSTF(26,5,5,0)
GTOFF=POSTF(26,5,5,0) $$
$$ no
no macro
macro on
on motion
motion GTON=POSTF(26,5,5,1)
GTON=POSTF(26,5,5,1) $$
$$ activate
activate macro
macro on
on motion
motion
CIMFIL/OFF
CIMFIL/OFF
© 2000 PTC CIMFIL/OFF
CIMFIL/OFF 1
Exercise 4

CIMFIL/ON,GOTO
CIMFIL/ON,GOTO
$$
$$ Ignore
Ignore
CIMFIL/OFF
CIMFIL/OFF

CIMFIL/ON,SET
CIMFIL/ON,SET
$$
$$ Ignore
Ignore SET/OFSELT,OFF
SET/OFSELT,OFF
IF
IF (POSTF(6,5).EQ.1)
(POSTF(6,5).EQ.1) THEN
THEN
$$
$$ Argument
Argument 22 is
is aa real
real
SETVAL=POSTF(7,5)
SETVAL=POSTF(7,5)
INSERT/'G54.',SETVAL,'$'
INSERT/'G54.',SETVAL,'$'
ENDIF
ENDIF
CIMFIL/OFF
CIMFIL/OFF

© 2000 PTC 1
Exercise 5
REDEF/ON
REDEF/ON CIMFIL/ON,HEAD
CIMFIL/ON,HEAD
XX=POSTF(24,1)
XX=POSTF(24,1) HDNUM=POSTF(7,4)
HDNUM=POSTF(7,4)
IF
IF (HDNUM.LE.2)
(HDNUM.LE.2) THEN
THEN
PASNUM=1
PASNUM=1 IF
IF (PASNUM.EQ.HDNUM) THEN
(PASNUM.EQ.HDNUM) THEN
CALL/NORMAL
CALL/NORMAL
ELSE
ELSE
REDIR=MACRO/
REDIR=MACRO/ CALL/REDIR
CALL/REDIR
$$
$$ Re-direct
Re-direct output
output ENDIF
ENDIF
XX=POSTF(25,1)
XX=POSTF(25,1) ENDIF
ENDIF
SEQNO/OFF
SEQNO/OFF CIMFIL/OFF
CIMFIL/OFF
TERMAC
TERMAC
CIMFIL/ON,OP
CIMFIL/ON,OP
NORMAL=MACRO/
NORMAL=MACRO/ $$
$$ Synch
Synch code
code
$$
$$ Normal
Normal output
output PVAL=100+POSTF(7,4)
PVAL=100+POSTF(7,4)
XX=POSTF(25,0)
XX=POSTF(25,0) INSERT/'P',PVAL,'$'
INSERT/'P',PVAL,'$'
SEQNO/ON
SEQNO/ON CIMFIL/OFF
CIMFIL/OFF
TERMAC
TERMAC
CIMFIL/ON,FINI
CIMFIL/ON,FINI
XX=POSTF(20)
XX=POSTF(20)
CIMFIL/ON,MACHIN
CIMFIL/ON,MACHIN IF
IF (PASNUM.EQ.1)
(PASNUM.EQ.1) THEN
THEN
CLNUM=POSTF(7,1)
CLNUM=POSTF(7,1) $$
$$ Mark
Mark current
current CL
CL rec
rec CALL/NORMAL
CALL/NORMAL
XX=POSTF(13)
XX=POSTF(13) $$
$$ Process
Process PASNUM=2
PASNUM=2
PASNUM=1
PASNUM=1 INSERT/'M30$'
INSERT/'M30$'
CALL/REDIR
CALL/REDIR SEQNO/OFF
SEQNO/OFF
CIMFIL/OFF
CIMFIL/OFF INSERT/'
INSERT/' ''
CALL/REDIR
CALL/REDIR
XX=POSTF(15,(CLNUM+1))
XX=POSTF(15,(CLNUM+1))
ELSE
ELSE
INSERT/'M30$'
INSERT/'M30$'
XX=POSTF(21)
XX=POSTF(21)
XX=POSTF(13)
XX=POSTF(13)
ENDIF
ENDIF

© 2000 PTC 1
Exercise 6
REDEF/ON
REDEF/ON CIMFIL/ON,LOADTL
CIMFIL/ON,LOADTL
XX=POSTF(20)
XX=POSTF(20) $$
$$ Save
Save CL
CL rec.
rec.
FTOOL=0
FTOOL=0 IF
IF (FTOOL.NE.0)
(FTOOL.NE.0) THEN
THEN
MACTIM=0
MACTIM=0 TTIM=POSTF(1,3,495)
TTIM=POSTF(1,3,495) $$
$$ Current
Current total
total time
time
DLTIM=TTIM-MACTIM
DLTIM=TTIM-MACTIM
TEF=TEXT/’ERROR$EOF’
TEF=TEXT/’ERROR$EOF’ XX=POSTF(25,0)
XX=POSTF(25,0) $$
$$ Normal
Normal output
output
SEQNO/ON
SEQNO/ON
XCOPY=MACRO/
XCOPY=MACRO/ INSERT/'(MACHINING
INSERT/'(MACHINING TIME
TIME :',DLTIM,'
:',DLTIM,' sec.)$'
sec.)$'
$$
$$ COPY
COPY AUX
AUX PUNCH
PUNCH FILE
FILE CALL/XCOPY
CALL/XCOPY
L10)CONTIN
L10)CONTIN XX=POSTF(21)
XX=POSTF(21)
T0=TEXT/READ,PUNCH
T0=TEXT/READ,PUNCH XX=POSTF(13)
XX=POSTF(13) $$
$$ Process
Process LOADTL
LOADTL
I1=CMPRF(T0,TEF)
I1=CMPRF(T0,TEF) XX=POSTF(25,1)
XX=POSTF(25,1) $$
$$ Re-direct output
Re-direct output
IF(I1
IF(I1 .EQ.
.EQ. 1)JUMPTO/L90
1)JUMPTO/L90 MACTIM=POSTF(1,3,495)
MACTIM=POSTF(1,3,495) $$
$$ Current
Current total
total time
time
INSERT/T0,'$'
INSERT/T0,'$' SEQNO/OFF
SEQNO/OFF
JUMPTO/L10
JUMPTO/L10 ELSE
ELSE
L90)CONTIN
L90)CONTIN XX=POSTF(21)
XX=POSTF(21)
TERMAC
TERMAC XX=POSTF(13)
XX=POSTF(13) $$
$$ PRocess
PRocess
XX=POSTF(25,1)
XX=POSTF(25,1) $$
$$ Re-direct
Re-direct output
output
MACTIM=POSTF(1,3,495)
MACTIM=POSTF(1,3,495) $$
$$ Current total time
Current total time
FTOOL=FTOOL+1
FTOOL=FTOOL+1
SEQNO/OFF
SEQNO/OFF
ENDIF
ENDIF
CIMFIL/OFF
CIMFIL/OFF

© 2000 PTC 1
Exercise 7
TLST=0
TLST=0 $$
$$ LAST
LAST TIME
TIME COUNT
COUNT
TSEG=120
TSEG=120 $$
$$ BREAK
BREAK TIME
TIME COUNT
COUNT MINS
MINS
ZCLR=1
ZCLR=1 $$
$$ Z-CLEARNACE
Z-CLEARNACE

CIMFIL/ON,5
CIMFIL/ON,5 $$
$$ CAPTURE
CAPTURE GOTO
GOTO
DMY=POSTF(20)
DMY=POSTF(20) $$
$$ SAVE
SAVE CLREC
CLREC
TTIM=POSTF(1,3,495)
TTIM=POSTF(1,3,495) $$
$$ GET
GET TOTAL
TOTAL CYCLE
CYCLE TIME
TIME
TDIF=TTIM-TLST
TDIF=TTIM-TLST $$
$$ FIND
FIND DELTA
DELTA DIFF
DIFF
IF(TDIF
IF(TDIF .GT.
.GT. TSEG)
TSEG) THEN
THEN $$
$$ SEGMENT
SEGMENT EXCEEDED
EXCEEDED
DISPLY/NEXT
DISPLY/NEXT
PPRINT/'TOOL
PPRINT/'TOOL CHANGE
CHANGE DUE
DUE TO
TO TIME
TIME LIMIT...'
LIMIT...'
X1=POSTF(1,3,(291+24))
X1=POSTF(1,3,(291+24))
Y1=POSTF(1,3,(291+25))
Y1=POSTF(1,3,(291+25))
Z1=POSTF(1,3,(291+26))
Z1=POSTF(1,3,(291+26))
POSTN/OUT,7,1,26,(Z1+ZCLR)
POSTN/OUT,7,1,26,(Z1+ZCLR)
OPSTOP
OPSTOP
POSTN/OUT,7,1,24,X1,25,Y1,26,Z1
POSTN/OUT,7,1,24,X1,25,Y1,26,Z1
TLST=TTIM
TLST=TTIM
ENDIF
ENDIF
DMY=POSTF(21)
DMY=POSTF(21) $$
$$ LOAD
LOAD ORGINAL
ORGINAL GOTO
GOTO
DMY=POSTF(13)
DMY=POSTF(13) $$
$$ PROCESS
PROCESS IT
IT
CIMFIL/OFF
CIMFIL/OFF
FINI
FINI

© 2000 PTC 2
Exercise 8
REDEF/ON
REDEF/ON CIMFIL/ON,5
CIMFIL/ON,5
XOF=150.0
XOF=150.0 $$
$$ PIVOT
PIVOT DISTANCE
DISTANCE IN
IN XX $$
$$ This
This macro
macro will
will apply
apply aa transformation
transformation on
on the
the GOTO
GOTO
ZOF=200.0
ZOF=200.0 $$
$$ PIVOT
PIVOT DISTANCE
DISTANCE IN
IN ZZ $$
$$
$$
$$ Extract
Extract the
the parameters
parameters ofof the
the GOTO
GOTO
MLX=3
MLX=3 $$
$$ MULTAX
MULTAX FLAG
FLAG XP=POSTF(7,6)
XP=POSTF(7,6)
YP=POSTF(7,7)
YP=POSTF(7,7)
PX=0;PY=0;PZ=0;PI=0;PJ=0;PK=1
PX=0;PY=0;PZ=0;PI=0;PJ=0;PK=1 ZP=POSTF(7,8)
ZP=POSTF(7,8)
IP=POSTF(7,9)
IP=POSTF(7,9)
JP=POSTF(7,10)
JP=POSTF(7,10)
TRN=MACRO/
TRN=MACRO/ KP=POSTF(7,11)
KP=POSTF(7,11)
$$
$$ Transformation
Transformation to
to apply
apply the
the pivots
pivots $$
$$ Check
Check for
for MULTAX
MULTAX
$$ FIND B-ANGLE
$$ FIND B-ANGLE IF(MLX
IF(MLX .EQ. 3)
.EQ. 3) THEN
THEN
BANG=ATAN2F(IP,KP)
BANG=ATAN2F(IP,KP) XP=XP+XOF
XP=XP+XOF
$$
$$ ADJUST
ADJUST XZ
XZ YP=YP+YOF
YP=YP+YOF
DX=ZOF*SINF(BANG)+XOF*COSF(BANG)
DX=ZOF*SINF(BANG)+XOF*COSF(BANG) GOTO/XP,YP,ZP
GOTO/XP,YP,ZP
DZ=ZOF*COSF(BANG)-XOF*SINF(BANG)
DZ=ZOF*COSF(BANG)-XOF*SINF(BANG) ELSE
ELSE
XP=XP+DX
XP=XP+DX CALL/TRN
CALL/TRN $$ $$ Call
Call the
the transformation
transformation macro
macro
ZP=ZP+DZ
ZP=ZP+DZ $$
$$ Process
Process the
the transformed
transformed GOTO
GOTO
TERMAC
TERMAC GOTO/XP,YP,ZP,IP,JP,KP
GOTO/XP,YP,ZP,IP,JP,KP
$$
$$ Stored
Stored current
current values
values
PI=IP
PI=IP
PJ=JP
PJ=JP
PK=KP
PK=KP
ENDIF
ENDIF
PX=XP
PX=XP
PY=YP
PY=YP
PZ=ZP
PZ=ZP
CIMFIL/OFF
CIMFIL/OFF

CIMFIL/ON,9
CIMFIL/ON,9
$$
$$ Check
Check for
for MULTAX
MULTAX
DMY=POSTF(13)
DMY=POSTF(13)
MLX=POSTF(1,1,1987)
MLX=POSTF(1,1,1987)
© 2000 PTC CIMFIL/OFF
CIMFIL/OFF 2

You might also like