Skip to content

Commit 2bcc9a0

Browse files
committed
qtvcp -probe routines: lower tool 2x Z clearance when probing tool diameter
before this, did not lower tool enough to probe diameter.
1 parent b054ebc commit 2bcc9a0

1 file changed

Lines changed: 54 additions & 38 deletions

File tree

lib/python/qtvcp/widgets/probe_routines.py

Lines changed: 54 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,22 @@ def z_clearance_down(self):
4242
G90""".format(self.data_rapid_vel, self.data_z_clearance + self.data_extra_depth)
4343
return self.CALL_MDI_WAIT(s, self.timeout)
4444

45+
# when probing tool diameter
46+
def raise_tool_depth(self):
47+
# move Z+
48+
s = """G91
49+
G1 F{} Z{}
50+
G90""".format(self.data_rapid_vel, self.data_z_clearance)
51+
return self.CALL_MDI_WAIT(s, self.timeout)
52+
53+
# when probing tool diameter
54+
def lower_tool_depth(self):
55+
# move Z-
56+
s = """G91
57+
G1 F{} Z-{}
58+
G90""".format(self.data_rapid_vel, self.data_z_clearance)
59+
return self.CALL_MDI_WAIT(s, self.timeout)
60+
4561
def length_x(self):
4662
if self.status_xp is None: self.status_xp = 0
4763
if self.status_xm is None: self.status_xm = 0
@@ -335,17 +351,22 @@ def probe_tool_z_diam(self):
335351
return 'cannot offset enough in - Y for tool radius offset + toolsetter radius'
336352

337353

338-
# move X - edge_length- xy_clearance
354+
# move X- (1/2 tool diameter + xy_clearance)
339355
s="""G91
340356
G1 F%s X-%f
341357
G90""" % (self.data_rapid_vel, 0.5 * self.data_ts_diam + self.data_xy_clearance)
342358
rtn = self.CALL_MDI_WAIT(s, self.timeout)
343359
if rtn != 1:
344360
return 'failed: {}'.format(rtn)
361+
345362
rtn = self.z_clearance_down()
346363
if rtn != 1:
347364
return 'failed: {}'.format(rtn)
348365

366+
rtn = self.lower_tool_depth()
367+
if rtn != 1:
368+
return 'lower tool depth failed: {}'.format(rtn)
369+
349370
# Start xplus
350371
rtn = self.probe('xplus')
351372
if rtn != 1:
@@ -355,6 +376,10 @@ def probe_tool_z_diam(self):
355376
a = STATUS.get_probed_position_with_offsets()
356377
xpres=float(a[0])+0.5*self.data_probe_diam
357378

379+
rtn = self.raise_tool_depth()
380+
if rtn != 1:
381+
return 'raise tool depth failed: {}'.format(rtn)
382+
358383
# move Z to start point up
359384
rtn = self.z_clearance_up()
360385
if rtn != 1:
@@ -366,7 +391,7 @@ def probe_tool_z_diam(self):
366391
if rtn != 1:
367392
return 'failed: {}'.format(rtn)
368393

369-
# move X + data_ts_diam + xy_clearance
394+
# move X+ (data_ts_diam + xy_clearance)
370395
aa=self.data_ts_diam+self.data_xy_clearance
371396
s="""G91
372397
G1 X%f
@@ -379,6 +404,10 @@ def probe_tool_z_diam(self):
379404
if rtn != 1:
380405
return 'failed: {}'.format(rtn)
381406

407+
rtn = self.lower_tool_depth()
408+
if rtn != 1:
409+
return 'lower tool depth failed: {}'.format(rtn)
410+
382411
# Start xminus
383412
rtn = self.probe('xminus')
384413
if rtn != 1:
@@ -391,6 +420,10 @@ def probe_tool_z_diam(self):
391420
xcres=0.5*(xpres+xmres)
392421
self.status_xc = xcres
393422

423+
rtn = self.raise_tool_depth()
424+
if rtn != 1:
425+
return 'raise tool depth failed: {}'.format(rtn)
426+
394427
# move Z to start point up
395428
rtn = self.z_clearance_up()
396429
if rtn != 1:
@@ -415,6 +448,10 @@ def probe_tool_z_diam(self):
415448
if rtn != 1:
416449
return 'failed: {}'.format(rtn)
417450

451+
rtn = self.lower_tool_depth()
452+
if rtn != 1:
453+
return 'lower tool depth failed: {}'.format(rtn)
454+
418455
# Start yplus
419456
rtn = self.probe('yplus')
420457
if rtn != 1:
@@ -423,6 +460,11 @@ def probe_tool_z_diam(self):
423460
# show Y result
424461
a = STATUS.get_probed_position_with_offsets()
425462
ypres=float(a[1])+0.5*self.data_probe_diam
463+
464+
rtn = self.raise_tool_depth()
465+
if rtn != 1:
466+
return 'raise tool depth failed: {}'.format(rtn)
467+
426468
# move Z to start point up
427469
if self.z_clearance_up() == -1:
428470
return
@@ -441,10 +483,15 @@ def probe_tool_z_diam(self):
441483
rtn = self.CALL_MDI_WAIT(s, self.timeout)
442484
if rtn != 1:
443485
return 'failed: {}'.format(rtn)
486+
444487
rtn = self.z_clearance_down()
445488
if rtn != 1:
446489
return 'failed: {}'.format(rtn)
447490

491+
rtn = self.lower_tool_depth()
492+
if rtn != 1:
493+
return 'lower tool depth failed: {}'.format(rtn)
494+
448495
# Start yminus
449496
rtn = self.probe('yminus')
450497
if rtn != 1:
@@ -460,10 +507,15 @@ def probe_tool_z_diam(self):
460507
diam=self.data_probe_diam + (ymres-ypres-self.data_ts_diam)
461508
self.status_d = diam
462509

510+
rtn = self.raise_tool_depth()
511+
if rtn != 1:
512+
return 'raise tool depth failed: {}'.format(rtn)
513+
463514
# move Z to start point up
464515
rtn = self.z_clearance_up()
465516
if rtn != 1:
466517
return 'failed: {}'.format(rtn)
518+
467519
tmpz=STATUS.stat.position[2] - self.data_z_clearance
468520
self.status_z=tmpz
469521
self.add_history('Tool diameter',"XcYcZD",0,xcres,0,0,0,ycres,0,0,tmpz,diam,0)
@@ -477,42 +529,6 @@ def probe_tool_z_diam(self):
477529
except Exception as e:
478530
return '{}'.format(e)
479531

480-
481-
########################
482-
# material
483-
########################
484-
def probe_material_z(self):
485-
486-
try:
487-
# basic sanity checks
488-
if self.data_ts_max is None:
489-
return'Missing toolsetter setting: data_ts_max'
490-
491-
cmdList = []
492-
cmdList.append('G49')
493-
cmdList.append('G92.1')
494-
cmdList.append('G10 L20 P0 Z[#<_abs_z>]')
495-
cmdList.append('G91')
496-
cmdList.append('F {}'.format(self.data_search_vel))
497-
cmdList.append('G38.2 Z-{}'.format(self.data_ts_max))
498-
cmdList.append('G1 Z{} F{}'.format(self.data_latch_return_dist, self.data_rapid_vel))
499-
cmdList.append('F{}'.format(self.data_probe_vel))
500-
cmdList.append('G38.2 Z-{}'.format(self.data_latch_return_dist*1.2))
501-
cmdList.append('G1 Z{} F{}'.format(self.data_z_clearance, self.data_rapid_vel))
502-
cmdList.append('G90')
503-
504-
# call each command - if fail report the error and gcode command
505-
rtn = self.CALL_MDI_LIST(cmdList)
506-
if rtn != 1:
507-
return rtn
508-
h=STATUS.get_probed_position()[2]
509-
self.status_bh = h
510-
self.add_history('Probe Material Top',"Z",0,0,0,0,0,0,0,0,h,0,0)
511-
# report success
512-
return 1
513-
except Exception as e:
514-
return '{}'.format(e)
515-
516532
####################
517533
# Z rotation probing
518534
####################

0 commit comments

Comments
 (0)