2 variable techniques understanding variables variables in custom macro b presentation links page...
TRANSCRIPT
2 Variable Techniques
Understanding variablesVariables in custom macro B
Presentation links page for lesson two
Arguments Local variables Common variablesPermanent common variables System variables
Introduction To Variables
25 31 56Jar A Jar CJar B
Jar C = Jar A + Jar B
Jar A = 25 Jar B = 31
Variables are like storage containers for numbers
Introduction To Variables
Provide storage for numbersHave no meaning until usedAre used in arithmetic expressionsCan represent just about anything
Of course, we’re not storing values in jars!
Variables:
Introduction To Variables
Tool 4
?
Offsets:1234567
00.000000.000000.000000.000000.000000.000000.0000
5.48765.4876
G43 H04 Z0.1
Offsets are a kind of variable…
Tool length is unknown while programmingDuring setup, length is measuredOffset value is entered after measurementCommand in program invokes offset value
Tool lengthCutter radiusWear offsetTool nose radius
Offsets can only represent:
Offsets usage is rather limitedBy comparison, variables can be used to represent just about anything!
Introduction To VariablesSay you must mill a slot in several workpieces
Introduction To VariablesBut the width of each workpiece varies
Introduction To VariablesBut the width of each workpiece varies
As does the position and depth
With parametric programming,
variables can be used to represent
these workpiece attributes
Variable Types
ArgumentsLocal variablesCommon variablesPermanent common variablesSystem variables
There are five kinds of variables in custom macro B
Let’s begin with arguments
Custom Macro B Arguments
What is an argument?Definition:
An argument is a piece of data needed by the custom macro
program (input data)
Arguments allow you to get data in to the custom macro
Custom Macro B Arguments
G65 P1000 A45. R2. H8. D.75
Call custom macro
Input data (arguments)
One form of argument in custom macro includes letters of the alphabet
For reasons we’ll describe later, avoid I, J, & K
Custom Macro B Arguments
A B C D E F H
I J K M Q R S
T U V W X Y Z
Argument assignment number one:
Not allowed: G, L, N, O, & P
Allowable letters of the alphabet
Custom Macro B Arguments
X
Y
ZD
H
An example: Choose logical representations:
H for holeD for depthX for X positionY for Y positionZ for Z position
Custom Macro B Arguments
X
Y
ZD
H
An example: Choose logical representations:
H for holeD for depthX for X positionY for Y positionZ for Z position
G65 P1000 X2.0 Y2.0 Z0 D0.25 H2.5Call custom macro
ArgumentsArgument assignment number
one is, by far, the more popular
form of argument assignment
Custom Macro B Arguments
Argument assignment number two:
A B C I J K I J K I J K
I J K I J K I J K I J K
I J K I J K I J K
This form of argument
assignment is seldom used
A, B, C, and ten sets of I, J, and K are allowed
Custom Macro B Arguments
O1000G00 XX ???
G65 P1000 X2.0 Y2.0 Z0 D0.25 H2.5
Arguments within a custom macro cannot be referenced by their letters
The control would confuse many letters
with their normal CNC functions
Within the custom macro, arguments
must be referenced with pre-
determined local variables…
Variable Types
ArgumentsLocal variablesCommon variablesPermanent common variablesSystem variables
Custom Macro B Local Variables
##1 : Variable number 1#100 : Variable number 100#500 : Variable number 500
In custom macros, all variables are specified with a pound sign
Custom Macro B Local Variables
Represent arguments
Reference temporary valuesThe primary application for local variables
is to reference the values of arguments
coming from a G65 command
Local variables are used to:
Primary use
Custom Macro B Local Variables
#1:#2:#3:#4:#5:#6:#7:#8:#9:
#10:#11:#12:#13:#14:#15:#16:#17:#18:
#19:#20:#21:#22:#23:#24:#25:#26:
Local variables range through #33
The default state of local variables
is vacant (having no value)
Local variables are set back to
vacant as the custom macro
ends (with M99)
Custom Macro B Local Variables
A:#1 B:#2 C:#3 D:#7 E:#8 F:#9 H:#11
I:#4 J:#5 K:#6 M:#13 Q:#17 R:#18 S:#19
T:#20 U:#21 V:#22 W:#23 X:#24 Y:#25 Z:#26
Argument assignment number one:
Each argument letter has a
pre-assigned local variable!
A chart for arguments and local variables is in the lesson text
Custom Macro B Local Variables
G65 P1000 X2. Y2.5 Z0 D.25 H3.
1) Set values of local variables
A G65 command does two things:
Example of argument assignment…
X:#24, Y:#25, Z:#26, D:#7, H:#11
Custom Macro B Local Variables
#1:#2:#3:#4:#5:#6:#7:#8:#9:
#10:#11:#12:#13:#14:#15:#16:#17:#18:
#19:#20:#21:#22:#23:#24:#25:#26:
02.000002.500000.0000
03.0000
00.2500
Custom Macro B Local Variables
G65 P1000 X2. Y2.5 Z0 D.25 H3.
1) Set values of local variables2) Execute program 01000
Example of argument assignment…
Custom Macro B Local Variables
Nesting:Main:
O0001..G65P1001 X2. Y2.5..M30
Level 1:O1001..G65P1002 X5. Y7...M99
Level 2:O1002...M99.
You can call one custom macro from another
#1:#2:#3:#4:#5:#6:#7:#8:#9:
#10:#11:#12:#13:#14:#15:#16:#17:#18:
#19:#20:#21:#22:#23:#24:#25:#26:
02.000002.5000
Custom Macro B Local VariablesLocal variables #24 & #25 set from program O0001
Nesting:Main:
O0001..G65P1001 X2. Y2.5..M30
Level 1:O1001..G65P1002 X5. Y7...M99
Level 2:O1002...M99.
Custom Macro B Local Variables
#1:#2:#3:#4:#5:#6:#7:#8:#9:
#10:#11:#12:#13:#14:#15:#16:#17:#18:
#19:#20:#21:#22:#23:#24:#25:#26:
05.000007.0000
Custom Macro B Local VariablesLocal variables #24 & #25 set from program O1001
Nesting:Main:
O0001..G65P1001 X2. Y2.5..M30
Level 1:O1001..G65P1002 X5. Y7...M99
Level 2:O1002...M99.
Custom Macro B Local Variables
#1:#2:#3:#4:#5:#6:#7:#8:#9:
#10:#11:#12:#13:#14:#15:#16:#17:#18:
#19:#20:#21:#22:#23:#24:#25:#26:
02.000002.5000
Custom Macro B Local VariablesLocal variables #24 & #25 set from program O0001
Nesting:Main:
O0001..G65P1001 X2. Y2.5..M30
Level 1:O1001..G65P1002 X5. Y7...M99
Level 2:O1002...M99.
Custom Macro B Local Variables
#1:#2:#3:#4:#5:#6:#7:#8:#9:
#10:#11:#12:#13:#14:#15:#16:#17:#18:
#19:#20:#21:#22:#23:#24:#25:#26:
Custom Macro B Local VariablesLocal variables #24 & #25 set back to vacant
Nesting:Main:
O0001..G65P1001 X2. Y2.5..M30
Level 1:O1001..G65P1002 X5. Y7...M99
Level 2:O1002...M99.
Custom Macro B Local Variables
Argument Assignment ExampleMill left side of any workpiece
Full example
Argument Assignment ExampleMill left side of any workpiece
Full example
Argument Assignment ExampleMill left side of any workpiece
Full example
Argument Assignment Example
Z
H
Y
T
D
O0001N005 G54 G90 S300 M03N010 G00 X0 Y0N015 G43 H01 Z0.1N020 G65 P1000 X0 Y0 Z0 H2. T1. D1.0 F4.N025 G91 G28 Z0 M19N030 M01..
X
F - Feedrate
Mill left side of any workpiece
Full example
Argument Assignment Example
Z
H
T
O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99
Y
D
#11
#26
#9
#25
#7
#20
F - FeedrateX#24
Mill left side of any workpiece
Full example
Z
H
T
O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99
Y
D
#11
#26
#9
#25
#7
#20
#24
F - FeedrateX
Argument Assignment ExampleMill left side of any workpiece
Full example
Argument Assignment Example
Z
H
T
O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99
Y
D
#11
#26
#9
#25
#7
#20
#24
F - FeedrateX
Mill left side of any workpiece
Full example
Argument Assignment Example
Z
H
T
O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99
X
Y
D
#11
#26
#9
#25
#7
#20
#24
F - Feedrate
Mill left side of any workpiece
Full example
Argument Assignment Example
Z
H
T
O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99
X
Y
D
#11
#26
#9
#25
#7
#20
#24
F - Feedrate
Mill left side of any workpiece
Full example
Argument Assignment Example
Z
H
T
O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99
Y
D
#11
#26
#9
#25
#7
#20
#24
F - FeedrateX
Mill left side of any workpiece
Full example
Argument Assignment Example
Z
H
T
O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99
Y
D
#11
#26
#9
#25
#7
#20
#24
F - FeedrateX
Mill left side of any workpiece
Full example
Argument Assignment Example
Z
H
T
Y
D
O0001N005 G54 G90 S300 M03N010 G00 X0 Y0N015 G43 H01 Z0.1N020 G65 P1000 X0 Y0 Z0 H2. T1. D1.0 F4.N025 G91 G28 Z0 M19N030 M01..
#11
#26
#9
#25
#7
#20
#24
F - FeedrateX
Mill left side of any workpiece
Full example
Argument Assignment Example
Z
H
T
O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99Y
D
#11
#26
#9
#25
#7
#20
#24
F - FeedrateX
Minimizing redundant calculations
Full example
Argument Assignment Example
Z
H
T
O1000#27 = #7/2G00 X[#24- #27] Y[#25- #27 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #27] F#9G00 Z[#26 + 0.1]M99
Y
D
#11
#26
#9
#25
#7
#20
#24
F - FeedrateX
Minimizing redundant calculations
If you wish to use local variables for
temporary calculations, use those
from #26-#33 to keep from
overwriting a needed variable!
Full example
Argument Assignment ExampleTapping on a turning center
Another example
Argument Assignment ExampleTapping on a turning center
Another example
Argument Assignment ExampleTapping on a turning center
Another example
Argument Assignment Example
F
Z R
O0001N005 G00 T0101N010 G97 S500 M03N015 G65 P1001 R.2 Z-1. F.0625N020 G00 X6.0 X5.0N025 M01..
Tapping on a turning center
Another example
Argument Assignment Example
F
Z R
#9
#26 #18
O1001G00 X0 Z#18G32 Z#26 F#9M04G32 Z#18 F#9M03M99
Tapping on a turning center
Another example
Argument Assignment Example
F
Z R
#9
#26 #18
O1001G00 X0 Z#18G32 Z#26 F#9M04G32 Z#18 F#9M03M99
Tapping on a turning center
Another example
Argument Assignment Example
F
Z R
#9
#26 #18
O1001G00 X0 Z#18G32 Z#26 F#9M04G32 Z#18 F#9M03M99
Tapping on a turning center
Another example
Argument Assignment Example
F
Z R
#9
#26 #18
O1001G00 X0 Z#18G32 Z#26 F#9M04G32 Z#18 F#9M03M99
Tapping on a turning center
Another example
Argument Assignment Example
F
Z R
#9
#26 #18
O1001G00 X0 Z#18G32 Z#26 F#9M04G32 Z#18 F#9M03M99
Tapping on a turning center
Another example
Argument Assignment Example
F
Z R
#9
#26 #18
O1001G00 X0 Z#18G32 Z#26 F#9M04G32 Z#18 F#9M03M99
Tapping on a turning center
Another example
Argument Assignment Example
F
Z R
#9
#26 #18
O1001G00 X0 Z#18G32 Z#26 F#9M04G32 Z#18 F#9M03M99
Tapping on a turning center
Another example
Argument Assignment Example
F
Z R
O0001N005 G00 T0101N010 G97 S500 M03N015 G65 P1001 R.2 Z-1. F.0625N020 G00 X6.0 X5.0N025 M01..
Tapping on a turning center
Another example
Argument Assignment Example
F
Z R
O0001N005 G00 T0101N010 G97 S500 M03N015 G65 P1001 R.2 Z-1. F.0625N020 G00 X6.0 X5.0N025 M01..
Tapping on a turning center
Another example
Argument Assignment Example
Z R
O0001N005 G00 T0101N010 G97 S500 M03N015 G65 P1001 R.2 Z-1. F16.N020 G00 X6.0 X5.0N025 M01..
F: TPI
Tapping on a turning center
Could be number of threads per
inch
Another example
Argument Assignment Example
Z R
O0001N005 G00 T0101N010 G97 S500 M03N015 G65 P1001 R.2 Z-1. F16.N020 G00 X6.0 X5.0N025 M01..
O1001G00 X0 Z#18G32 Z#26 F[1/ #9]M04G32 Z#18 F[1/ #9]M03M99
F: TPI
Tapping on a turning center
Another example
Local Variables
#1 #2 #3 #4 #5 #6 #7 #8 #9 #10
#11 #12 #13 #14 #15 #16 #17 #18 #19 #20
#21 #22 #23 #24 #25 #26 #27 #28 #29 #30
#31 #32 #33
With argument assignment number one:
Available for use for calculations:
Again, if you wish to use local
variables for temporary calculations,
use these to keep from overwriting a
needed variable!
Use these local variables for general purpose calculations
Variable Types
ArgumentsLocal variablesCommon variablesPermanent common variablesSystem variables
Common Variables
##100 - #149
Until power off
Retained until M30 orCommon variables are less volatile
than local variables!
Common variables range from #100 through #149
A parameter setting controls when common variables are set back to vacant
Common Variables
You can actually see variable values
Press SET or SETTING several times
Press OFFSET and then MACRO
or
…depending upon control model
Common Variables
G00 X[#24 + 2 * #7]
#100 = #24 + 2 * #7..G00 X#100
An application: Calculating values up front:
Calculation done in motion command
Calculation done up-front
Common VariablesCommon Variables
G00 X[#24 + 2 * #7]
#100 = #24 + 2 * #7..G00 X#100
A note about brackets ([ ])…
Brackets required when a calculation is done within a CNC word
Brackets not required
If you’re using custom macro to
create a canned cycle application,
use G65 to pass arguments
Z
U
Y
XD F: Feedrate
O0003N005 G54 G90 S500 M03N010 G00 X0 Y0N015 G43 H01 Z0.1N020 G65 P1003 X1. Y1. U4. Z0 D.25 F5.N025 G65 P1003 X1. Y3. U4. Z0 D.25 F5.N030 G91 G28 Z0 M19N035 M01..
Common VariablesProgram startup formatCall user-created canned cycle
.5
Common Variables
0.5
0.75
But in part family applications:
But in part family applications:Common Variables
#101
#102
#103#104
O0006 (Cap blocks)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)...N25 G81 R.1 Z-[#104+.18] F5....
Use common variablesPlace them at beginningNote messagesReference them as needed
Use common variables to specify
input data (arguments) at the very
beginning of the part family program!
Be sure to label each with a
documenting message!
Common Variables
O1001..#104 = 400...M99
O0001..G65 P1001 . . ...G65 P1002 . . ...M30
O1002..S#104 M03...M99
Common variables are retained until the power is turned off
You can use common variables
from one program to another!
Invoke custom macroCommon variable set in one program……can be referenced in another
Common Variable Example
Z
H
T
O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99
Y
D
#11
#26
#9
#25
#7
#20
F - FeedrateX#24
Calculating values up front:
Example shown earlier
Common Variable Example
O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99
Calculating values up front:
O1000G00 X[#24-#7/2] Y[#25-#7/2 -.1]Z[#26 - #20 -.05]G01 Y[#25 + #11 + #7/2] F#9G00 Z[#26 + 0.1]M99
O1000#100 = #24 - #7/2#101 = #25 - #7/2 -.1#102 = #26 - #20 - .05#103 = #25 + #11 + #7/2#104 = #26 + 0.1G00 X#100 Y#101Z#102G01 Y#103 F#9G00 Z#104M99
Calculating values up front:
Common Variable Example
You can use common variables to
calculate values that will be needed
later in the program!
Common Variable Example
O1000/ #100 = #24 - #7/2/ #101 = #25 - #7/2 -.1/ #102 = #26 - #20 - .05 / #103 = #25 + #11 + #7/2/ #104 = #26 + 0.1G00 X#100 Y#101Z#102G01 Y#103 F#9G00 Z#104M99
Calculating values up front:
With block delete, you can save
calculation time once variables
have been calculated once!
Common Variable Example
0.5
0.75
Part family example:
Common Variable Example
#101
#102
#103#104
O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 (1/2 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01
Part family example:
Common Variable Example
#101
#102
#103#104
O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01
Part family example:
Common Variable Example
#101
#102
#103#104
O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01
Part family example:
Common Variable Example
#101
#102
#103#104
O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01
Part family example:
Common Variable Example
#101
#102
#103#104
O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01
Part family example:
Common Variable Example
#101
#102
#103#104
O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01
Part family example:
Common Variable Example
#101
#102
#103#104
O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01
Part family example:
Common Variable Example
#101
#102
#103#104
O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01
Part family example:
Common Variable Example
#101
#102
#103#104
O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01
Part family example:
Common Variable Example
#101
#102
#103#104
O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01
Part family example:
Common Variable Example
#101
#102
#103#104
O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01
Part family example:
Common Variable Example
#101
#102
#103#104
O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01
Part family example:
Common Variable Example
#101
#102
#103#104
O0006 (Cap plate)#101 = 5. (X LENGTH)#102 = 3. (Y LENGTH)#103 = .25 (SLOT DEPTH)#104 = 1. (THICKNESS)N05 T01 M06 Drill)N10 G54 G90 S500 M03N15 G00 X.5 Y.5N20 G43 H01 Z.1N25 G81 R.1 Z-[#104+.18] F5.N30 Y[#102-.5]N35 X[#101-.5]N40 Y.5N45 G80N50 G91 G28 Z0 M19N55 M01
Part family example:
Common Variable Example
#101
#102
#103#104
N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30
Part family example:
Common Variable Example
#101
#102
#103#104
N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30
Part family example:
Common Variable Example
#101
#102
#103#104
N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30
Part family example:
#101
#102
#103#104
N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30
Part family example:
Common Variable Example
#101
#102
#103#104
N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30
Part family example:
Common Variable Example
#101
#102
#103#104
N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30
Part family example:
Common Variable Example
#101
#102
#103#104
N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30
Part family example:
Common Variable Example
#101
#102
#103#104
N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30
Part family example:
Common Variable Example
#101
#102
#103#104
N55 M01N60 T02 M06 (3/4 Mill)N65 G54 G90 S300 M03N70 G00 X[#101/2] Y-.475N75 G43 H02 Z-#103N80 G01 Y[#102+.475]N85 G00 Z0.1N90 G91 G28 Z0 M19N95 M30
Common Variable ExamplePart family example:
Variable Types
ArgumentsLocal variablesCommon variablesPermanent common variablesSystem variables
Permanent Common Variables
#500 - #509
Retained even after power off
#Some controls have more than ten
Use permanent common variables for
applications that require that you retain
data even after the power is turned off!
Permanent Common Variables
Part counters
Tool life management
Cycle time meter
Permanent Common Variables
O0001N005 T0101 M41N010 G97 S500 M03N015G00 X0.5 Z0.1N020 G01 Z-1.0 F0.005N025 G00 Z0.1N030 G00 X6.0 Z5.0N035 M01..
Make your approach value a system constant
Examples…
Permanent Common Variables
O0001N005 T0101 M41N010 G97 S500 M03N015G00 X0.5 Z#500N020 G01 Z-1.0 F0.005N025 G00 Z#500N030 G00 X6.0 Z5.0N035 M01..
Make your approach value a system constant
Examples…
O0001N005 T0101 M41N010 G97 S500 M03N015G00 X0.5 Z#500N020 G01 Z-1.0 F0.005N025 G00 Z#500N030 G00 X6.0 Z5.0N035 M01..
Permanent Common Variables
Eliminate M code inconsistencies from machine to machine
Examples…
Permanent Common Variables
O0001N005 T0101 M#501N010 G97 S500 M03N015G00 X0.5 Z#500N020 G01 Z-1.0 F0.005N025 G00 Z#500N030 G00 X6.0 Z5.0N035 M01..
Eliminate M code inconsistencies from machine to machine
Examples…
Permanent Common Variables
#500 00.0000 __________#501 00.0000 __________#502 00.0000 __________#503 00.0010 __________#504 00.0000 __________#505 00.0000 __________#506 00.0000 __________#507 00.0000 __________#508 00.0000 __________
O0001SETVN 500 [APPROACH]SETVN 501 [LOW RANG]#500= 0.1#501 = 41M30
You can even label permanent common variables
SETVN stands for Set Variable Name
Permanent Common Variables
#500 00.1000 APPROACH#501 41.0000 LOW RANG#502 00.0000 __________#503 00.0000 __________#504 00.0000 __________#505 00.0000 __________#506 00.0000 __________#507 00.0000 __________#508 00.0000 __________
O0001SETVN 500 [APPROACH]SETVN 501 [LOW RANG]#500= 0.1#501 = 41M30
You can even label permanent common variables
Permanent Common Variables
#500 00.0000 APPROACH#501 00.0000 LOW RANG#502 00.0000 __________#503 00.0000 __________#504 00.0000 __________#505 00.0000 __________#506 00.0000 __________#507 00.0000 __________#508 00.0000 __________
0.1
You can also enter values manually
Permanent Common Variables
#500 00.1000 APPROACH#501 00.0000 LOW RANG#502 00.0000 __________#503 00.0000 __________#504 00.0000 __________#505 00.0000 __________#506 00.0000 __________#507 00.0000 __________#508 00.0000 __________
You can also enter values manually
Permanent Common Variables
#500 00.0500 RADIUS#501 00.0012 X+ O&D#502 00.0021 X- O&D#503 00.0014 Y+ O&D#504 00.0018 Y- O&D#505 06.6674 LENGTH#506 00.0000 __________#507 00.0000 __________#508 00.0000 __________
Be careful! Some may be used by other devices!
These are probe
calibration values!
Permanent Common Variables
O0008 (Main program)...N445 G65 P1008 C250.N450 M30
O1008#500 = #500 +1IF[#500 LT #3] GOTO 99#500 = 0#3000 = 100 (PART COUNT ACHIEVED)N99 M99
A part counter
We’ll explain the IF
statement in detail later
Variable Types
ArgumentsLocal variablesCommon variablesPermanent common variablesSystem variables
System Variables
#>#1000
Access to many CNC features
System Variables
#1000 series: Input/output signalsInterface with accessories
#2000 series: Tool offsetsRead and write
#3000 series: Misc. CNC featuresAlarm, control panel functions, stop w/message
#4000 series: Modal statesG code groups, current word address status
#5000 series: Axis positionRelative to program zero or zero return
More on system
variables later