I just wanted to show what you can do with Mpost, or Postform.
This Post is for a simple 3 axis Fanuc 0MD system, but can easilly be modified for most 3 axis system.
It is asking for Vise 1-4 and zero setting for left hand Vise in X, solid yaw in Y and bottom of the Yaw in Z.
Also at the end of the program it is repositioning the selected Vise at the center of the machine door at the end.
And all values can be changed, (Number of Vises, Values for Zero) , etc etc etc etc.
All in Metric, that of course can be translated to the "Imperial system"
(It is an 1000 X 500mm machine) The tools are in Swedish by the way, sorry.
The Mpost can also be used with 4 and 5 axis, but it has its limits.
Code:
name Fanuc 0MD
% 00
/ 00
O >4
N >4
$ 00
^ 00
& 00
* 00
g >2 G Modal
G >2
L >2
a >2
X ->4.>3
Y ->4.>3
y ->4.>3 Y
z ->4.>3 Z
Z ->4.>3
S >4 Clamp 60 8000
A ->4.>3
I ->4.>3
J ->4.>3
K ->4.>3
R ->4.>3
Q ->4.>3
b >1.>2 Limit 0.25 5
P >4 Mult 1000 Clamp 0 5000
H >2 Limit 1 20
D >2 ADD 20 Limit 11 40
F >3 Clamp 1 4000
f >3 Clamp 1 1000
j >2
: 4
i >2
M >2
h >2
T >2 Limit 1 20
m >2 M
t >2
s 3
d >3.>2
c >3.>2
) 00
( 00
Sbackdoor Supressheader
UppercaseComments? Y
ModalLetters X Y Z F R M S
ModalGs 0 1 2 3 17 21 30 40 41 42 43 49 54 73 74 76 80 81 82 83 84 85 90
Sequence#s N 0 10 10
First#? N
Last#? N
HCode X
VCode Y
Dcode Z
FeedCode F
Spindle 3 4 5
Coolant 8 9 53 53 53 53 53
DComp 41 42 40
LComp 43 49
Feed G<1>
Rapid G<0>
Cw G<2>
Ccw G<3>
Inc/Abs G 91 90
Comment ( )
ArcPlane g 17 18 19
CtrCode I J K
Helical? Y
Spaces? Y
Incremental? N
CtrIncremental? Y
ByQuadrants? N
Custom1
G<81> Z<D> R<Vclear> f<FRate> M<Cool>
end cancel
Drill
if <Dwell> = 0
G<81> Z<D> R<Vclear> f<FRate> M<Cool>
else
G<82> Z<D> R<Vclear> P<Dwell> f<FRate> M<Cool>
endif
end cancel
Peck
G<83> Z<D> R<Vclear> Q<VBite> f<FRate> M<Cool>
end cancel
Tap
S<Speed> M29
if <Frate> < 10
G<84> G95 Z<D> R<Vclear> b<FRate> M<Cool>
else
G<84> Z<D> R<Vclear> f<FRate> M<Cool>
endif
end cancel
LTap
S<Speed> M29
if <Frate> < 10
G<74> G95 Z<D> R<Vclear> b<FRate> M<Cool>
else
G<74> Z<D> R<Vclear> f<FRate> M<Cool>
endif
end cancel
Csink
if <Dwell> = 0
G<81> Z<D> R<Vclear> f<FRate> M<Cool>
else
G<82> Z<D> R<Vclear> P<Dwell> f<FRate> M<Cool>
endif
end cancel
Ream
G<85> Z<D> R<Vclear> f<FRate> M<Cool>
end cancel
Bore
G<85> Z<D> R<Vclear> f<FRate> M<Cool>
end cancel
Back
if <Dwell> = 0
G<87> Z<D> R<Vclear> Q0.5 f<FRate> M<Cool>
else
G<87> Z<D> R<Vclear> Q0.5 P<Dwell> f<FRate> M<Cool>
endif
end cancel
Cancel
G<80>
end
StartCode
%<0>
:<Program#> i1
end
1stToolChange
M27
G40 G21 M68
Ask <Val1> "Select Yaw. Left Edge, Solid Yaw, Bottom 0-4" "0"
if <Val1> = 0
Ask <Val3> "Zero Point X" "40.46"
Ask <Val7> "Zero Point Y" "-141.92"
Ask <Val8> "Zero Point Z" "-497.3"
G90 G10 L2 a1 X0 Y0 Z0
G10 L2 a2 X<Val3> Y<Val7> Z<Val8>
endif
if <Val1> = 1
Ask <Val3> "Zero Point X" "0"
Ask <Val7> "Zero Point Y" "0"
Ask <Val8> "Zero Point Z" "0"
G90 G10 L2 a1 X0 Y0 Z0
G10 L2 a2 X<Val3>+40.46 Y<Val7>-141.92 Z<Val8>-497.3
endif
if <Val1> = 2
Ask <Val3> "Zero Point X" "0"
Ask <Val7> "Zero Point Y" "0"
Ask <Val8> "Zero Point Z" "0"
G90 G10 L2 a1 X0 Y0 Z0
G10 L2 a2 X<Val3>+300.82 Y<Val7>-141.92 Z<Val8>-497.3
endif
if <Val1> = 3
Ask <Val3> "Zero Point X" "0"
Ask <Val7> "Zero Point Y" "0"
Ask <Val8> "Zero Point Z" "0"
G90 G10 L2 a1 X0 Y0 Z0
G10 L2 a2 X<Val3>+560.53 Y<Val7>-141.92 Z<Val8>-497.3
endif
if <Val1> = 4
Ask <Val3> "Zero Point X" "0"
Ask <Val7> "Zero Point Y" "0"
Ask <Val8> "Zero Point Z" "0"
G90 G10 L2 a1 X0 Y0 Z0
G10 L2 a2 X<Val3>+820.65 Y<Val7>-141.92 Z<Val8>-497.3
endif
M6 T<Tool>
if <Style> = 002 or <Style> = 802
N<block> M1 t<Tool> s<Style> d<ToolDiam> c<Corner> )0 (TOOL # _ )
else
N<block> M1 t<Tool> s<Style> d<ToolDiam> )0 (TOOL # _ )
endif
G94 G90 G54 G17 S<Speed> M<Direct>
G<0> X<H> Y<V> M69
G<43> Z<D> H<Tool>
end
RapidCode
Set <Val9> to <LastD>
Set <Val10> to <D>
if <Val10> < <Val9>
G0 X<H> Y<V> S<Speed>
Z<D>
endif
if <Val10> = <Val9>
G0 X<H> Y<V> Z<D> S<Speed>
endif
if <Val10> > <Val9>
G0 Z<D>
X<H> Y<V> S<Speed>
endif
end
LineCode
G1 X<H> Y<V> Z<D> F<Frate> M<Cool>
end
Infeed
G1 G<Side> X<H> Y<V> D<Tool> F<FRate>
end
Outfeed
G1 G<40> X<H> Y<V>
end
ToolChange
G40 G21 i2
M5
M6 T<Tool>
if <Style> = 002 or <Style> = 802
N<block> M1 t<Tool> s<Style> d<ToolDiam> c<Corner> )0 (TOOL # _ )
else
N<block> M1 t<Tool> s<Style> d<ToolDiam> )0 (TOOL # _ )
endif
G94 G90 G54 G17 S<Speed> M<Direct>
G<0> X<H> Y<V>
G<43> Z<D> H<Tool>
end
EndCode
G91 G28 i3 i2
if <Val1> = 0
G90 G53 X510 i4 M5
endif
if <Val1> = 1
G90 G53 X120 i4 M5
endif
if <Val1> = 2
G90 G53 X380 i4 M5
endif
if <Val1> = 3
G90 G53 X640 i4 M5
endif
if <Val1> = 4
G90 G53 X900 i4 M5
endif
M26
M30
%<0>
end
Replace "b0. " with "F0 "
Replace "b1. " with "F1 "
Replace "b2. " with "F2 "
Replace "b3. " with "F3 "
Replace "b4. " with "F4 "
Replace "b5. " with "F5 "
Replace "b6. " with "F6 "
Replace "b7. " with "F7 "
Replace "b8. " with "F8 "
Replace "b9. " with "F9 "
Replace "f" with "F"
Replace "i3" with "Z0"
Replace "i4" with "Y0"
Replace "a1" with "P0"
Replace "a2" with "P1"
Replace "b" with "F"
Replace "M9" with ""
Replace "i2" with "M9"
Replace "t" with "(T"
Replace " )" with ")"
Replace "( " with "("
Replace "d" with "DIAM "
Replace "i1" with "(COMMENT)"
Replace "c" with "NOSE-R "
Replace ".)" with ")"
Replace "s000" with "RADIEPINNFR"
Replace "s803" with "RADIEPINNFR"
Replace "s001" with "PINNFR"
Replace "s801" with "HOERNFR"
Replace "s002" with "HOERNRADIEFR"
Replace "s802" with "HOERNRADIEFR"
Replace "s003" with "KULFR"
Replace "s004" with "SKIVFR"
Replace "s005" with "PLANFR"
Replace "s006" with "KONISK HOERNRADIEFR"
Replace "s007" with "KONISK AENDFR"
Replace "s008" with "LAXFR"
Replace "s009" with "FASFR"
Replace "s010" with "HOERNRADIEFR"
Replace "s100" with "C-BORR"
Replace "s101" with "SPIRALB"
Replace "s102" with "GAENGTAPP"
Replace "s103" with "BROTCH"
Replace "s104" with "ARBORR"
Replace "s105" with "U-BORR"
Replace "s106" with "CUSTOM2"
Replace "s107" with "CUSTOM3"
Replace "s108" with "C-BORR"
Replace "s109" with "FOERS"
Replace "s110" with "TAPPFORS"
Replace "s600" with "GAENGFR"
Replace "s601" with "KONISK GAENGFR"
Replace "s602" with "GAENGFR"