Sunteți pe pagina 1din 10

Today lecture

Macro in APT Programming


Macro in APT Programming
Macro is certain kind of subroutine in
programming, which used with repeated
machining sequences to reduce total program
length
Program
Writing Macro sequence
with
parameters
Terminate Macro A,B,C,…
Perform
sequence
according
Call Macro to
A=…
B=…
C=…
Macro in APT Programming
APT provides the macro capability that is using the
MACRO and TERMAC statements, which define the
bounds of the macro definition, and the CALL
statement, which defines the location in the part
program where the macro is to be executed

Writing Macro format


XXXXXX = MACRO / Px

Symbol
Parametric
Macro code
value
Macro in APT Programming
APT provides the macro capability that is using the
MACRO and TERMAC statements, which define the
bounds of the macro definition, and the CALL
statement, which defines the location in the part
program where the macro is to be executed

Calling Macro format


CALL/XXXXXX , Px = P1

Call macro
Assign value to
Macro name
the parameter
Macro in APT Programming
MACRO edit
P1 P2
DRILL=MACRO/PN
GOTO/PX
P3 P4
GODLTA/0,0,-10
GODLTA/0,0,10
TERMAC
MACRO call
FROM/P0
CALL/DRILL, PX=P1
CALL/DRILL, PX=P2
CALL/DRILL, PX=P3
CALL/DRILL, PX=P4
Macro Example

Point X Y

P0 0 0
P1 100 50
P2 150 100
P3 135.5 135.5
P4 100 150
P5 50 100
P6 64.5 64.5
Macro Example

PARTNO = PROB#1
MACHINE/MILL,1
CUTTER/20
P1 = POINT/100,50,0
P2 = POINT/150,100,0
P3 = POINT/135.5, 135.5,0
P4 = POINT/100,150,0
P5 = POINT/50,100,0
P6 = POINT/64.5, 64.5,0
Macro Example
DRILL = MACRO/PX
GOTO/PX
GODELTA/0,0,-20
GODELTA/0,0,20
TERMAC

FEDRAT/ 0.5
SPINDL/5000

FROM / P0

CALL/DRILL,PX=P1
CALL/DRILL,PX=P2
CALL/DRILL,PX=P3
CALL/DRILL,PX=P4
CALL/DRILL,PX=P5
CALL/DRILL,PX=P6

SPINDL/OFF
FINI
10

S-ar putea să vă placă și