aboutsummaryrefslogtreecommitdiffstats
path: root/nc_files/probe/basic_probe/macros/probe_corner_x_plus_edge_angle.ngc
blob: b2edeb0983400a9542c06e34501e3eeb173d113f (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
(author: Chris P)
(version: 0.1)
(date: 05/7/19)

(Probe Corner X plus Edge Angle for x,y,z 0,0,0 position)
(Start probe position is over back left corner of stock)
(inside the step off width square and within max z distance)
(ensure all settings have been set properly according to help diagrams)

o<probe_corner_x_plus_edge_angle> sub

  (uses NGCGUI style arg spec)
  (number after "=" in comment is default value)
  #<probe_tool_number> = #1    (=99)
  #<max_z_distance> = #2       (=0.5000)
  #<max_xy_distance> = #3      (=0.5000)
  #<xy_clearance> = #4         (=0.1000)
  #<z_clearance> = #5          (=0.1000)
  #<step_off_width> = #6       (=0.5000)
  #<extra_probe_depth> = #7    (=0.0000)
  #<probe_slow_fr> = #8        (=0.0)
  #<probe_fast_fr> = #9        (=10.0)
  #<calibration_offset> = #10  (=0.0000)
  #<x_hint> = #11              (=1.0000)
  #<y_hint> = #12              (=1.0000)
  #<diameter_hint> = #13       (=1.0000)
  #<edge_width> = #14          (=0.5000)
  #<probe_mode> = #15          (=0)
  #<wco_rotation> = #16        (=0)

  (Cancel G92 offsets)
  G92.1

  #<workspace_x> = #[5201 + [20 * #5220]]
  #<workspace_y> = #[5202 + [20 * #5220]]

  (Probe Tool Safety Check)
  o<110> if [#5400 NE #<probe_tool_number>]
  (MSG, Specified probe tool #<probe_tool_number> not in spindle, aborting)
   o<probe_corner_x_plus_edge_angle> return
  o<110> endif

  (Probe Diameter)
  #<probe_diameter> = #5410

  (Probing depth from the z probed clearance height, used for z moves)
  #<z_probe_stack> = [#<z_clearance> + #<probe_diameter> + #<extra_probe_depth>]

  #<z1x> = #5420

  #<z1y> = #5421

  (Probe X Positioning Move, Step Off Width)
  G91
  G0 y[#<step_off_width>]

  (Probe X Positioning Move, to Probing Depth)
  F[#<probe_fast_fr>]
  G1 Z-[#<z_probe_stack>]

  #<p1x> = #5420

  (Call sub "probe_y_minus" to Probe y- side of Workpiece)
  o<probe_y_minus> call [#1][#3][#4][#8][#9][#10]

  #<p1y> = #<_value>

  (value returned safety check, aborts if no value returned)
  o<120> if [#<probe_mode> EQ 1 AND #<_value_returned> NE 1]
    (MSG, Missing Y Sub returned edge parameter, aborting)
    o<probe_corner_x_plus_edge_angle> return
  o<120> endif

  (Probe Y Positioning Move, up to Z clearance plane)
  G91
  G0 Z[#<z_probe_stack>]

  (Probe Y Positioning Move, Traverse Workpiece at Z Clearance plane)
  G0 X-[#<step_off_width>] Y-[#<step_off_width>]

  (Probe Y Positioning Move,to Probing Depth)
  F[#<probe_fast_fr>]
  G1 Z-[#<z_probe_stack>]

  #<p2y> = #5421

  (Call sub "probe_x_plus" to Probe X+ side of Workpiece)
  o<probe_x_plus> call [#1][#3][#4][#8][#9][#10]

  #<p2x> = #<_value>

  (value returned safety check, aborts if no value returned)
  o<130> if [#<probe_mode> EQ 1 AND #<_value_returned> NE 1]
    (MSG, Missing X Sub returned edge parameter, aborting)
    o<probe_corner_x_plus_edge_angle> return
  o<130> endif

  (edge width move to edge second probing point)
  G91
  F[#<probe_fast_fr>]
  G1 Y-[#<edge_width>]

  #<p3y> = #5421

  (Call sub "probe_x_plus" to Probe X+ side of Workpiece)
  o<probe_x_plus> call [#1][#3][#4][#8][#9][#10]

  #<p3x> = #<_value>

  (value returned safety check, aborts if no value returned)
  o<140> if [#<probe_mode> EQ 1 AND #<_value_returned> NE 1]
    (MSG, Missing X Sub returned edge parameter, aborting)
    o<probe_corner_x_plus_edge_angle> return
  o<140> endif

  #<edge_delta> = [#<p3x> - #<p2x>]

  #<edge_angle> = [ATAN [#<edge_delta>] / [#<edge_width>]]

  M68 E4 Q[#<edge_delta>]

  M68 E3 Q[#<edge_angle>]

  #<c1xr> = [#<z1x> + [#<p2x> - #<z1x>] * COS[-#<edge_angle>] - [#<p2y> - #<z1y>] * SIN[-#<edge_angle>]]

  #<c1yr> = [#<z1y> + [#<p1x> - #<z1x>] * SIN[-#<edge_angle>] + [#<p1y> - #<z1y>] * COS[-#<edge_angle>]]

  #<c1x> = [#<z1x> + [#<c1xr> - #<z1x>] * COS[#<edge_angle>] - [#<c1yr> - #<z1y>] * SIN[#<edge_angle>]]

  #<c1y> = [#<z1y> + [#<c1xr> - #<z1x>] * SIN[#<edge_angle>] + [#<c1yr> - #<z1y>] * COS[#<edge_angle>]]

  (Probe Completion Move to Z Clearance Plane, and XY Zero)
  G91
  G0 Z[#<z_probe_stack>]
  G90
  G0 X[#<c1x>] Y[#<c1y>]

  (probe mode rules for WCO,Rotation and probe position measuring only)
  o<150> if [#<probe_mode> EQ 0 AND #<wco_rotation> EQ 0]
    (Record Zero in selected axes and WCO)
    G10 L2 P#5220 X[#<c1x> + #<workspace_x>] Y[#<c1y> + #<workspace_y>]
    o<probe_corner_x_plus_edge_angle> return
  o<150> endif

  (probe mode rules for WCO,Rotation and probe position measuring only)
  o<160> if [#<probe_mode> EQ 0 AND #<wco_rotation> EQ 1]
    (Record Zero in selected axes and WCO)
    G10 L2 P#5220 X[#<c1x> + #<workspace_x>] Y[#<c1y> + #<workspace_y>] R[#<edge_angle>]
    o<probe_corner_x_plus_edge_angle> return
  o<160> endif

o<probe_corner_x_plus_edge_angle> endsub

M2 (end program)

bues.ch cgit interface