Commit ad7cbb8c authored by electrolab's avatar electrolab

First chips

parent a0a41c05
......@@ -14,7 +14,7 @@
viewBox="0 0 888 686.00002"
height="686"
width="888"
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
inkscape:version="0.92.0 r15299"
sodipodi:docname="LatheMacro.svg">
<sodipodi:namedview
pagecolor="#ffffff"
......@@ -25,17 +25,17 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1317"
inkscape:window-height="1259"
inkscape:window-width="3440"
inkscape:window-height="1377"
id="namedview4713"
showgrid="false"
inkscape:zoom="2"
inkscape:cx="597.24024"
inkscape:cy="286.30433"
inkscape:window-x="3021"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="layer0" />
inkscape:cx="610.67797"
inkscape:cy="326.46346"
inkscape:window-x="1912"
inkscape:window-y="244"
inkscape:window-maximized="1"
inkscape:current-layer="g6995-7" />
<defs
id="defs3816">
<marker
......@@ -1574,22 +1574,6 @@
y="512.67291" /></text>
</g>
</g>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none"
x="583.92432"
y="333.68048"
id="text4856-7-4"><tspan
sodipodi:role="line"
id="tspan4854-8-2"
x="583.92432"
y="333.68048">Zero</tspan></text>
<path
style="display:inline;fill:none;stroke:#000000;stroke-width:1.60000002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker24532-8-2-7-3)"
d="m 638.66274,344.66207 c -14.85759,-9.27147 -28.71078,38.81002 -78.13131,10.02162"
id="path4595-9-3-4"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:26.66666603px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
......@@ -1822,22 +1806,6 @@
id="tspan4436"
x="74.450729"
y="296.71805">Angle</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none"
x="634.98871"
y="194.68535"
id="text4856-7-8"><tspan
sodipodi:role="line"
id="tspan4854-8-75"
x="634.98871"
y="194.68535">Zero</tspan></text>
<path
style="display:inline;fill:none;stroke:#000000;stroke-width:1.60000002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker24532-8-2-7-6)"
d="m 672.4003,208.26597 c -14.85759,-9.27147 -28.71078,38.81002 -78.13131,10.02162"
id="path4595-9-3-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
<g
inkscape:groupmode="layer"
......@@ -1979,22 +1947,6 @@
id="tspan4385"
x="553"
y="421">Diameter</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none"
x="570.13214"
y="165.89316"
id="text4856-7-9"><tspan
sodipodi:role="line"
id="tspan4854-8-7"
x="570.13214"
y="165.89316">Zero</tspan></text>
<path
style="display:inline;fill:none;stroke:#000000;stroke-width:1.60000002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker24532-8-2-7-2)"
d="m 612.74176,179.47378 c -14.85759,-9.27147 -28.71078,38.81002 -78.13131,10.02162"
id="path4595-9-3-9"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="display:inline;fill:none;stroke:#000000;stroke-width:1.60000002px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 328.34783,448.14921 453.73021,422.19767 348.97537,469.07484"
......@@ -2155,22 +2107,6 @@
x="619"
y="623">Depth</tspan></text>
</g>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none"
x="639.13214"
y="243.89316"
id="text4856-7"><tspan
sodipodi:role="line"
id="tspan4854-8"
x="639.13214"
y="243.89316">Zero</tspan></text>
<path
style="display:inline;fill:none;stroke:#000000;stroke-width:1.60000002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker24532-8-2-7)"
d="m 681.74175,257.47378 c -14.85759,-9.27147 -28.71078,38.81002 -78.13131,10.02162"
id="path4595-9-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
<g
inkscape:groupmode="layer"
......@@ -2278,22 +2214,6 @@
inkscape:connector-curvature="0" />
</g>
</g>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none"
x="650.13214"
y="237.89316"
id="text4856-5-7"><tspan
sodipodi:role="line"
id="tspan4854-2-8"
x="650.13214"
y="237.89316">Zero</tspan></text>
<path
style="display:inline;fill:none;stroke:#000000;stroke-width:1.60000002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker24532-8-2-0-6)"
d="m 676.74176,249.47378 c -14.85759,-9.27147 -28.71078,38.81002 -78.13131,10.02162"
id="path4595-9-8-5"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:26.66666603px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
......@@ -2761,7 +2681,7 @@
sodipodi:role="line"
id="tspan5347"
x="653.28717"
y="544.03821" /></text>
y="545.14081" /></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:26.66666603px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
......@@ -2784,22 +2704,6 @@
y="487.64758">Pitch</tspan></text>
</g>
</a>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none"
x="649.91943"
y="305.56146"
id="text4856-5"><tspan
sodipodi:role="line"
id="tspan4854-2"
x="649.91943"
y="305.56146">Zero</tspan></text>
<path
style="display:inline;fill:none;stroke:#000000;stroke-width:1.60000002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker24532-8-2-0)"
d="m 701.19248,317.40939 c -14.85759,-9.27147 -28.71078,38.81002 -78.13131,10.02162"
id="path4595-9-8"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
<g
inkscape:groupmode="layer"
......@@ -2947,7 +2851,7 @@
sodipodi:role="line"
id="tspan4883"
x="460.74036"
y="584.57452" /></text>
y="585.67712" /></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:26.66666603px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
......@@ -2979,6 +2883,20 @@
x="277.9584"
y="589.41583">Feed</tspan></text>
</g>
<rect
id="rect4768"
width="150.5"
height="46"
x="662.5"
y="156"
style="fill:#000000;fill-opacity:0" />
<rect
style="fill:#848488;fill-opacity:1"
id="rect4770"
width="114"
height="66.5"
x="668.5"
y="137.5" />
</g>
</g>
<text
......
# ---setup spindle control signals---
net spindle-vel-cmd-rps spindle.0.speed-out-rps
net spindle-vel-cmd-rps-abs spindle.0.speed-out-rps-abs
net spindle-vel-cmd-rpm spindle.0.speed-out
net spindle-vel-cmd-rpm-abs spindle.0.speed-out-abs
net spindle-enable spindle.0.on
net spindle-cw spindle.0.forward
net spindle-ccw spindle.0.reverse
net spindle-brake spindle.0.brake
net spindle-revs spindle.0.revs
net spindle-at-speed spindle.0.at-speed
net spindle-vel-fb-rps spindle.0.speed-in
net spindle-index-enable spindle.0.index-enable
net state-op atv_vfd.enable
net MachineIsOn atv_vfd.machine-on
net spindle-vel-cmd-rpm atv_vfd.speed-command
net spindle-enable atv_vfd.spindle-on
net Estop atv_vfd.is-estop
\ No newline at end of file
......@@ -50,8 +50,8 @@ net ModeSelect1 classicladder.0.in-35
net ModeSelect2 classicladder.0.in-36
net ModeSelect3 classicladder.0.in-37
net ModeSelect4 classicladder.0.in-38
#net FeedOv1 classicladder.0.in-39
#net FeedOv2 classicladder.0.in-40
net CoolantBtnOn classicladder.0.in-39
net CoolantBtnOff classicladder.0.in-40
#net FeedOv3 classicladder.0.in-41
#net FeedOv4 classicladder.0.in-42
net RapidOv1 classicladder.0.in-43
......@@ -133,6 +133,12 @@ net ToolChangeLed classicladder.0.out-28
net ModeAuto classicladder.0.out-41
net ModeMDI classicladder.0.out-42
net ModeMan classicladder.0.out-43
net ModeJ classicladder.0.out-44
net RapidJog classicladder.0.out-45
net ModeX10 classicladder.0.out-47
net ModeX1 classicladder.0.out-46
net CoolantOn classicladder.0.out-48
net CoolantOff classicladder.0.out-49
#Chuck Logic -> 50 -
......
loadrt not count=2
addf not.0 servo-thread
addf not.1 servo-thread
net X-homed => halui.joint.0.home
net Z-homed => halui.joint.2.home
net Y-Homed => halui.joint.1.home
......@@ -11,47 +6,42 @@ net Home-All <= gmoccapy.joint.all.home
net Home-X <= gmoccapy.joint.0.home
net Home-Z <= gmoccapy.joint.2.home
net ToolChangeFailed halui.program.stop
net ToolChangeFailed halui.program.stop
net SpindleNormal halui.spindle.0.forward
net SpindleOff halui.spindle.0.stop
net SpindleReverse halui.spindle.0.reverse
net SpindleNormal halui.spindle.0.forward
net SpindleOff halui.spindle.0.stop
net SpindleReverse halui.spindle.0.reverse
net CoolantBtnOn halui.flood.on
net CoolantBtnOff halui.flood.off
net CoolantPumpOnLamp halui.flood.is-on
net CoolantOn halui.flood.on
net CoolantOff halui.flood.off
net CoolantPump halui.flood.is-on
net CycleStart halui.program.run
net ProgramPause halui.program.pause
net ProgramResume halui.program.resume
net ProgramStep halui.program.step
net CycleStartBtn halui.program.run
net FeedHoldBtn halui.program.pause
net FeedHoldLamp halui.program.is-paused
net CycleStartLamp halui.program.is-running
net XSelect halui.axis.x.select
net ZSelect halui.axis.z.select
net XJogPlus gmoccapy.jog.axis.jog-x-plus
net XJogMinus gmoccapy.jog.axis.jog-x-minus
net ZJogPlus gmoccapy.jog.axis.jog-z-plus
net ZJogMinus gmoccapy.jog.axis.jog-z-minus
net XSelect halui.axis.x.select
net ZSelect halui.axis.z.select
net XJogPlus gmoccapy.jog.axis.jog-x-plus
net XJogMinus gmoccapy.jog.axis.jog-x-minus
net ZJogPlus gmoccapy.jog.axis.jog-z-plus
net ZJogMinus gmoccapy.jog.axis.jog-z-minus
net XZeroed halui.joint.0.is-homed
net ZZeroed halui.joint.2.is-homed
net MachineIsOn halui.machine.is-on
net MachineOn halui.machine.on
#net ModeManual halui.mode.is−manual
net XZeroed halui.joint.0.is-homed
net ZZeroed halui.joint.2.is-homed
net MachineIsOn halui.machine.is-on
net MachineOn halui.machine.on
#net ModeManual halui.mode.is−manual
#net ToolChangeRequest iocontrol.0.tool-change
#net ToolPrepPrepPocket iocontrol.0.tool-prep-pocket
#net ToolChangeOk iocontrol.0.tool-changed
net ModeAuto halui.mode.auto
net ModeMDI halui.mode.mdi
net ModeMan halui.mode.manual
net ModeAuto halui.mode.auto
net ModeMDI halui.mode.mdi
net ModeMan halui.mode.manual
net ManualTC halui.mdi-command-00
net ManualTC halui.mdi-command-00
#net ManualTC2 => halui.mdi−command−02
#net ManualTC3 => halui.mdi−command−03
#net ManualTC4 => halui.mdi−command−04
......@@ -60,28 +50,21 @@ net ManualTC halui.mdi-command-00
#net ManualTC7 => halui.mdi−command−07
#net ManualTC8 => halui.mdi−command−08
############################################################
#Mode modifiers
############################################################
setp gmoccapy.feed.feed-override.analog-enable true
net FeedOverride gmoccapy.feed.feed-override.direct-value
setp gmoccapy.jog.jog-velocity.analog-enable true
net FeedOverride gmoccapy.jog.jog-velocity.direct-value
setp gmoccapy.rapid.rapid-override.analog-enable true
net RapidOverride gmoccapy.rapid.rapid-override.direct-value
net BlockDeleteBtn halui.program.block-delete.on
net BlockDeleteBtn not.0.in
net BlockDeleteBtn_not not.0.out
net BlockDeleteBtn_not halui.program.block-delete.off
setp gmoccapy.spindle.spindle-override.analog-enable true
net SpindleOverride gmoccapy.spindle.spindle-override.direct-value
net OptstopBtn halui.program.optional-stop.on
net OptstopBtn not.1.in
net OptstopBtn_not not.1.out
net OptstopBtn_not halui.program.optional-stop.off
net spindle-vel-fb-rpm-abs gmoccapy.spindle_feedback_bar
############################################################
#Overrides
############################################################
net PanelKey gmoccapy.unlock-settings
setp gmoccapy.feed.feed-override.analog-enable true
net FeedOverride gmoccapy.feed.feed-override.direct-value
setp gmoccapy.jog.jog-velocity.analog-enable true
net FeedOverride gmoccapy.jog.jog-velocity.direct-value
net RapidJog gmoccapy.jog.turtle-jog
setp gmoccapy.rapid.rapid-override.analog-enable true
net RapidOverride gmoccapy.rapid.rapid-override.direct-value
#net CycleStartBtn gladevcp.cycle-start
;boring
O<boring> sub
#<ccomp> = #<_ccomp>
#<metric> = #<_metric>
#<absolute> = #<_absolute>
#<feed> = #<_feed>
#<coord_system> = #<_coord_system>
#<lathe_diameter_mode> = #<_lathe_diameter_mode>
#<ijk_absolute_mode> = #<_ijk_absolute_mode>
G8 ; Lathe radius Mode
G90 ; Absolute Distance
G91.1 ; but not for arcs
; #1 X coord
; #2 surface speed
; #3 cut size
; #4 feed/rpm
; #5 Z coord
; #6 radius
; #7 angle
; #8 tool number
; #9 coolant
O10 if [#9 EQ 1]
M8
O10 endif
;M6 T#8 G43
O100 if [#8 NE #<_current_tool>]
(MSG, ERROR : Set tool before use macro)
O<restore> call [#<metric>] [#<absolute>] [#<feed>] [#<ccomp>] [#<coord_system>] [#<lathe_diameter_mode>] [#<ijk_absolute_mode>]
O100 return [-2] ; indicate failure to epilog
O100 endif
#1 = [#1 / 2] ; because of radius mode
#14 = [#<_x>] (startinG X)
#13 = #<_z> (startinG Z)
#20 = [#6 * SIN[#7]]
#21 = [-#6 * COS[#7]]
#22 = [#6 / COS[#7]]
#23 = [#5 + #6 - #20]
#24 = [[#23 - #13] * TAN[#7]]
G96 D2500 S#2 ; Constant Surface Speed Mode
M3 ;Start Spindle
G95 F#4 ; Feed-Per-Rev Mode
G4P1 ; Wait to reach speed
(debuG, TurninG finish dia #1 start dia #14 start lenGth #13 finish lenGth #5)
O101 WHILE [#14 LT [#1 - #3]]
G0 X #14
#14=[#14 + #3]
G1 X #14
G1 Z #23 X[#14 + #24]
o102 IF [#6 GT 0]
G3 Z#5 X[#14 + #24 + #21] I#21 K#20
G1 X[#14 + #24 + #21 - #3]
o102 ELSE
G1 X[#14 + #24 - [#3 * 1.5]]
o102 ENDIF
G0 Z[#13]
O101 ENDWHILE
G0 X#1
G1 Z#23 X[#1 + #24]
O103 IF [#6 GT 0]
G3 Z#5 X[#1 + #24 + #21] I#21 K#20
G1 X[#1 + #24 + #21 - #3]
O103 ELSE
G1 X[#1 + #24 - #3]
O103 ENDIF
G0 Z#13
G0 X#1 ; For touch-off
M5
M9
; restore g20/21, g90/g91, feed
O<restore> call [#<metric>] [#<absolute>] [#<feed>] [#<ccomp>] [#<coord_system>] [#<lathe_diameter_mode>] [#<ijk_absolute_mode>]
O<boring> endsub
M2
%
;chamfer
O<chamfer> sub
#<ccomp> = #<_ccomp>
#<metric> = #<_metric>
#<absolute> = #<_absolute>
#<feed> = #<_feed>
#<coord_system> = #<_coord_system>
#<lathe_diameter_mode> = #<_lathe_diameter_mode>
#<ijk_absolute_mode> = #<_ijk_absolute_mode>
G8 ; Lathe radius Mode
G90 ; Absolute Distance
; #1 X coord
; #2 feed/rpm
; #3 0.5 ?
; #4 0 ?
; #5 Z coord
; #6 tool number
; #7 0 ?
; #8 chamfer size
; #9 exterior front
; #10 interior
; #11 exterior rear
; #12 coolant
O10 if [#12 EQ 1]
M8
O10 endif
;M6 T#6 G43
O100 if [#6 NE #<_current_tool>]
(MSG, ERROR : Set tool before use macro)
O<restore> call [#<metric>] [#<absolute>] [#<feed>] [#<ccomp>] [#<coord_system>] [#<lathe_diameter_mode>] [#<ijk_absolute_mode>]
O100 return [-2] ; indicate failure to epilog
O100 endif
#1 = [#1 / 2] ; because of radius mode
#14 = [#<_x>] (starting X)
#13 = [#<_z>] (starting Z)
G96 D2500 S#2 ; Constant Surface Speed Mode
M3
G95 F0.1 ; Feed-Per-Rev Mode
#20 = 0
O101 if [#9 GT 0.5] ; front outside
o102 while [[#20 + #3] lt #8]
#20 = [#20 + #3]
G0 x[#1 - #20] z#13
G1 z#5
G1 x#1 z[#5 - #20]
G1 x #14
G0 z#13
o102 endwhile
G0 x#14 z#13
G0 x[#1 - #8]
G1 z#5
G1 x#1 z[#5 - #8]
G1 x #14
G0 z#13
O101 elseif [#10 GT 0.5] ; front inside
o103 while [[#20 + #3] lt #8]
#20 = [#20 + #3]
G0 x[#1 + #20] z#13
G1 z#5
G1 x#1 z[#5 - #20]
G1 x #14
G0 z#13
o103 endwhile
G0 x#14 z#13
G0 x[#1 + #8]
G1 z#5
G1 x#1 z[#5 - #8]
G1 x #14
G0 z#13
O101 elseif [#11 GT 0.5] ; back outside
o104 while [[#20 + #3] lt #8]
#20 = [#20 + #3]
G0 x[#1 - #20] z#13
G1 z#5
G1 x#1 z[#5 + #20]
G1 x #14
G0 z#13
o104 endwhile
G0 x#14 z#13
G0 x[#1 - #8]
G1 z#5
G1 x#1 z[#5 + #8]
G1 x #14
G0 z#13
O101 endif
M5
M9
; restore g20/21, g90/g91, feed
O<restore> call [#<metric>] [#<absolute>] [#<feed>] [#<ccomp>] [#<coord_system>] [#<lathe_diameter_mode>] [#<ijk_absolute_mode>]
O<chamfer> endsub
M2
%
;drill
O<drill> sub
#<ccomp> = #<_ccomp>
#<metric> = #<_metric>
#<absolute> = #<_absolute>
#<feed> = #<_feed>
#<coord_system> = #<_coord_system>
#<lathe_diameter_mode> = #<_lathe_diameter_mode>
#<ijk_absolute_mode> = #<_ijk_absolute_mode>
G7 ; diameter mode
G90 ; Absolute Distance
; #1 drill diameter
; #2 ydepth
; #3 speed
; #4 feed/rpm
; #5 tool number
; #6 peck amount
; #7 retract amount
; #8 coolant
O10 if [#8 EQ 1]
M8
O10 endif
#9 = #<_y> (starting Y)
;M6 T#5 G43
O100 if [#5 NE #<_current_tool>]
(MSG, ERROR : Set tool before use macro)
O<restore> call [#<metric>] [#<absolute>] [#<feed>] [#<ccomp>] [#<coord_system>] [#<lathe_diameter_mode>] [#<ijk_absolute_mode>]
O100 return [-2] ; indicate failure to epilog
O100 endif
#7 = [[1000 * #3] / [3.1415 * #1]] ; metric mode RPM
G97 S#7 ; Constant RPM mode
M3 ;Start Spindle
G95 F#4 ; Feed-Per-Rev Mode
G4 P1 ; Wait to reach speed
(debug, Drilling dia #1 depth #2 asked-speed #3 feed/rpm #4 tool #5 peck dist #6 calculated-rpm #7 start-Y #9)
(MSG, ERROR : TODO must retract the X axis to home position)
; G0 X0 ; TODO must retract the X axis to home position
;G0 Y#9
G98
G83 Y#2 R#9 Q#6
G80
;G0 Y#9
M5
M9
; restore g20/21, g90/g91, feed
O<restore> call [#<metric>] [#<absolute>] [#<feed>] [#<ccomp>] [#<coord_system>] [#<lathe_diameter_mode>] [#<ijk_absolute_mode>]
O<drill> endsub
M2
%
;Facing
O<facing> sub
#<ccomp> = #<_ccomp>
#<metric> = #<_metric>
#<absolute> = #<_absolute>
#<feed> = #<_feed>
#<coord_system> = #<_coord_system>
#<lathe_diameter_mode> = #<_lathe_diameter_mode>
#<ijk_absolute_mode> = #<_ijk_absolute_mode>
G7 ; diameter mode
G90 ; Absolute Distance
; #1 X coord
; #2 surface speed
; #3 cut size
; #4 feed/rpm
; #5 Z coord
; #6 angles
; #7 tool number
; #8 coolant
O10 if [#8 EQ 1]
M8
O10 endif
O20 IF [#6 NE 0]
(MSG, Angled facing isn't supported yet)
O20 ENDIF
;M6 T#7 G43
O100 if [#7 NE #<_current_tool>]
(MSG, ERROR : Set tool before use macro)
O<restore> call [#<metric>] [#<absolute>] [#<feed>] [#<ccomp>] [#<coord_system>] [#<lathe_diameter_mode>] [#<ijk_absolute_mode>]
O100 return [-2] ; indicate failure to epilog
O100 endif
#14 = [#<_x> * 2] (starting X)
#13 = #<_z> (starting Z)
G96 D2500 S#2 ; Constant Surface Speed Mode
M3
G95 F#4 ; Feed-Per-Rev Mode
G4P1 ; Wait to reach speed
O200 WHILE [#13 GT #5 + #3]
#13=[#13-#3]
G1 Z#13
G1 X#1
G0 Z[#13+#3]
G0 X#14
G0 Z#13
O200 ENDWHILE
G1 Z#5
G1 X#1
G0 Z[#13+#3]
G0 X[#14+#3]
G0 Z#5 ; For touch-off
M5
M9
; restore g20/21, g90/g91, feed
O<restore> call [#<metric>] [#<absolute>] [#<feed>] [#<ccomp>] [#<coord_system>] [#<lathe_diameter_mode>] [#<ijk_absolute_mode>]
O<facing> endsub
M2
%
;radius
O<radius> sub
#<ccomp> = #<_ccomp>
#<metric> = #<_metric>
#<absolute> = #<_absolute>
#<feed> = #<_feed>
#<coord_system> = #<_coord_system>
#<lathe_diameter_mode> = #<_lathe_diameter_mode>
#<ijk_absolute_mode> = #<_ijk_absolute_mode>
G7 ; diameter mode
G90 ; Absolute Distance
; #1 X coord
; #2 feed/rpm
; #3 0.5 ?
; #4 0 ?
; #5 Z coord
; #6 tool number
; #7 0 ?
; #8 radius size
; #9 exterior front
; #10 interior
; #11 exterior rear
; #12 coolant
O10 if [#12 EQ 1]
M8
O10 endif
;M6 T#6 G43
O100 if [#6 NE #<_current_tool>]
(MSG, ERROR : Set tool before use macro)
O<restore> call [#<metric>] [#<absolute>] [#<feed>] [#<ccomp>] [#<coord_system>] [#<lathe_diameter_mode>] [#<ijk_absolute_mode>]
O100 return [-2] ; indicate failure to epilog
O100 endif
#1 = [#1 / 2] ; because of radius mode
#14 = [#<_x>] (starting X)