-
Notifications
You must be signed in to change notification settings - Fork 5
/
contourMillHolesGrid.py
752 lines (680 loc) · 26.3 KB
/
contourMillHolesGrid.py
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
from tkSimpleDialog import *
from Tkinter import *
from tkFont import Font
from math import *
import PIL.Image
import PIL.ImageTk
from GeometricalFrame import *
import tkMessageBox
import os
CR = "\n"
#----------------------------------------------------------------------------
#
# This class mill holes in a grid.
#
# All holes are milled in a circle and not drilled. Use a cutter equal
# to or smaller than the diameter of the hole.
#
#----------------------------------------------------------------------------
class ContourMillHolesGrid(GeometricalFrame):
#
# define your own images to describe your GCode-Generator
def init(self):
path = "/Users/bernhardklein/Public/local-workspace/python/geometricals/GCodeGenerator_Geometricals/"
path = "./"
self.__imageNames = [
# center
path + "img/contour/mill-rect-grid-points.jpg",
]
#-------------------------------------------------------------
# change image, if an other center point was used
#-------------------------------------------------------------
def _changeImage(self, value):
print len(self.__imageNames)
i = int(value) - 1
if (len(self.__imageNames) < i):
i = len(self.__imageNames) - 1
p = self.__imageNames[i]
self.img = PIL.Image.open(p)
self.photo = PIL.ImageTk.PhotoImage(self.img)
Label(
self.frmImage, image=self.photo).grid(
row=0, column=0, sticky=W + E + N + S, columnspan=2)
#-------------------------------------------------------------
# her you should insert your own widgets which are important
# for generating your own GCode
#-------------------------------------------------------------
def _frmIndividualContent(self):
self.init()
row = 0
choices = [1]
self.__CC = StringVar()
self.__CC.set(choices[0])
self._changeImage(self.__CC.get())
# new in V012.5 --
self.setMaterialDict(self.selectedMaterial.get())
#-----------------
row = 0
self.__unit = StringVar()
self.__unit.set("G21")
Label(
self.frmButtonsIndividualContent, text='Unit').grid(
row=row, column=0, sticky=W)
ttk.Radiobutton(
self.frmButtonsIndividualContent,
text="mm",
variable=self.__unit,
value="G21").grid(
row=row, column=1, sticky=W)
ttk.Radiobutton(
self.frmButtonsIndividualContent,
text="inch",
variable=self.__unit,
value="G20").grid(
row=row, column=2, sticky=W)
row += 1
self.__dir = StringVar()
self.__dir.set("G02")
Label(
self.frmButtonsIndividualContent, text='Contour direction').grid(
row=row, column=0, sticky=W)
ttk.Radiobutton(
self.frmButtonsIndividualContent,
text="CW (G02)",
variable=self.__dir,
value="G02").grid(
row=row, column=1, sticky=W)
ttk.Radiobutton(
self.frmButtonsIndividualContent,
text="CCW (G03)",
variable=self.__dir,
value="G03").grid(
row=row, column=2, sticky=W)
row += 1
self.__cuttercompensation = StringVar()
self.__cuttercompensation.set("G42")
Label(
self.frmButtonsIndividualContent, text='Tool movement').grid(
row=row, column=0, sticky=W)
ttk.Radiobutton(
self.frmButtonsIndividualContent,
text="on contour",
variable=self.__cuttercompensation,
value="G40").grid(
row=row, column=1, sticky=W)
ttk.Radiobutton(
self.frmButtonsIndividualContent,
text="left from contour",
variable=self.__cuttercompensation,
value="G41").grid(
row=row, column=2, sticky=W)
ttk.Radiobutton(
self.frmButtonsIndividualContent,
text="right from contour",
variable=self.__cuttercompensation,
value="G42").grid(
row=row, column=3, sticky=W)
td = self.dicSelectedMaterial["Tool dia"]
print("ToolDia: " + str(td))
self.tooldia = StringVar(value=str(td))
Label(
self.frmButtonsIndividualContent, text="Tool diameter").grid(
row=row, column=0, sticky=W)
FloatEntry(
self.frmButtonsIndividualContent,
width=10,
mandatory=False,
textvariable=self.tooldia).grid(
row=row, column=1, sticky=W)
row += 1
self.__numberOfHolesX = StringVar(value="4")
self.__numberOfHolesY = StringVar(value="3")
Label(
self.frmButtonsIndividualContent, text="Number of Holes X").grid(
row=row, column=0, sticky=W)
IntegerEntry(
self.frmButtonsIndividualContent,
width=10,
mandatory=True,
validate="focusout",
background="Red",
textvariable=self.__numberOfHolesX).grid(
row=row, column=1, sticky=W)
Label(
self.frmButtonsIndividualContent, text="Number of Holes Y").grid(
row=row, column=2, sticky=W)
IntegerEntry(
self.frmButtonsIndividualContent,
width=10,
mandatory=True,
validate="focusout",
background="Red",
textvariable=self.__numberOfHolesY).grid(
row=row, column=3, sticky=W)
row += 1
self.__holeRadius = StringVar(value="5.0")
self.__gridAngle = StringVar(value="0.0")
Label(
self.frmButtonsIndividualContent, text="Hole radius (R)").grid(
row=row, column=0, sticky=W)
FloatEntry(
self.frmButtonsIndividualContent,
width=10,
mandatory=True,
textvariable=self.__holeRadius).grid(
row=row, column=1, sticky=W)
Label(
self.frmButtonsIndividualContent, text="Grid angle (A)").grid(
row=row, column=2, sticky=W)
FloatEntry(
self.frmButtonsIndividualContent,
width=10,
mandatory=True,
textvariable=self.__gridAngle).grid(
row=row, column=3, sticky=W)
row += 1
self.__centerX = StringVar(value="0.0")
self.__centerY = StringVar(value="0.0")
Label(
self.frmButtonsIndividualContent, text='Center X').grid(
row=row, column=0, sticky=W)
Label(
self.frmButtonsIndividualContent, text="Center Y").grid(
row=row, column=2, sticky=W)
FloatEntry(
self.frmButtonsIndividualContent,
width=10,
mandatory=True,
textvariable=self.__centerX).grid(
row=row, column=1, sticky=W)
FloatEntry(
self.frmButtonsIndividualContent,
width=10,
mandatory=True,
textvariable=self.__centerY).grid(
row=row, column=3, sticky=W)
row += 1
self.__angle = 0
self.__distanceA = StringVar(value="15.0")
self.__distanceB = StringVar(value="15.0")
Label(
self.frmButtonsIndividualContent, text="Distance rows (a)").grid(
row=row, column=0, sticky=W)
FloatEntry(
self.frmButtonsIndividualContent,
width=5,
textvariable=self.__distanceA).grid(
row=row, column=1, sticky=W)
Label(
self.frmButtonsIndividualContent,
text="Distance columns (b)").grid(
row=row, column=2, sticky=W)
FloatEntry(
self.frmButtonsIndividualContent,
width=5,
textvariable=self.__distanceB).grid(
row=row, column=3, sticky=W)
row += 1
self.__depthtotal = StringVar(value="-0.5")
self.__depthstep = StringVar(value="-0.5")
Label(
self.frmButtonsIndividualContent, text="Total depth").grid(
row=row, column=0, sticky=W)
Label(
self.frmButtonsIndividualContent,
text="depth cutting per step").grid(
row=row, column=2, sticky=W)
FloatEntry(
self.frmButtonsIndividualContent,
width=5,
textvariable=self.__depthtotal,
mandatory=True).grid(
row=row, column=1, sticky=W)
FloatEntry(
self.frmButtonsIndividualContent,
width=5,
textvariable=self.__depthstep,
mandatory=True).grid(
row=row, column=3, sticky=W)
row += 1
self.__speed_XY_G00 = StringVar(value=self._standardGCodeSeq[
"TRAVEL_SPEEDXYZ"][0])
self.__speed_Z_G00 = StringVar(value=self._standardGCodeSeq[
"TRAVEL_SPEEDXYZ"][2])
Label(
self.frmButtonsIndividualContent, text="Feed (G00 X/Y)").grid(
row=row, column=0, sticky=W)
Label(
self.frmButtonsIndividualContent, text="Feed (G00 Z)").grid(
row=row, column=2, sticky=W)
FloatEntry(
self.frmButtonsIndividualContent,
width=5,
textvariable=self.__speed_XY_G00,
mandatory=False).grid(
row=row, column=1, sticky=W)
FloatEntry(
self.frmButtonsIndividualContent,
width=5,
textvariable=self.__speed_Z_G00,
mandatory=False).grid(
row=row, column=3, sticky=W)
row += 1
self.speed_XY_G02G03 = StringVar(value="100.0")
self.speed_Z_G01 = StringVar(value="80.0")
Label(
self.frmButtonsIndividualContent, text="Feed (G02/G03 X/Y)").grid(
row=row, column=0, sticky=W)
Label(
self.frmButtonsIndividualContent, text="Feed (G01 Z)").grid(
row=row, column=2, sticky=W)
FloatEntry(
self.frmButtonsIndividualContent,
width=5,
textvariable=self.speed_XY_G02G03,
mandatory=False).grid(
row=row, column=1, sticky=W)
FloatEntry(
self.frmButtonsIndividualContent,
width=5,
textvariable=self.speed_Z_G01,
mandatory=False).grid(
row=row, column=3, sticky=W)
row += 1
self.__start_Z = StringVar(value=self._standardGCodeSeq["ZAXIS"][0])
Label(
self.frmButtonsIndividualContent, text="Start Z").grid(
row=row, column=0, sticky=W)
FloatEntry(
self.frmButtonsIndividualContent,
width=10,
textvariable=self.__start_Z,
mandatory=False).grid(
row=row, column=1, sticky=W)
#row += 1
self.__safety_Z = StringVar(value=self._standardGCodeSeq["ZAXIS"][1])
Label(
self.frmButtonsIndividualContent, text="Safety Z:").grid(
row=row, column=2, sticky=W)
FloatEntry(
self.frmButtonsIndividualContent,
width=10,
textvariable=self.__safety_Z,
mandatory=False).grid(
row=row, column=3, sticky=W)
#-----------------------------------------------------
self.upateMaterialFields(self.material.current())
self.frmButtonsIndividualContent.pack(expand=True, fill=BOTH)
pass
#-------------------------------------------------------------
# here you generate your GCode.
# some of this code should be used every time.
# insert your code bettween marked rows
#-------------------------------------------------------------
def generateGCode(self):
# x/y position for circle
cPoint = (0.0, 0.0) # general Centerpoint of hole #1
hCPoints = (0.0, 0.0) # center of current milled hole
gSize = (0.0, 0.0) # hole distances a & b
zPos = {
"safetyZ": float(self.__safety_Z.get()),
"startZ": float(self.__start_Z.get())
}
feeds = {
"XYG0": float(self.__speed_XY_G00.get()),
"XYGn": float(self.speed_XY_G02G03.get()),
"ZG0": float(self.__speed_Z_G00.get()),
"ZGn": float(self.speed_Z_G01.get())
}
# radius r = entire Circle, r1= radius per hole
r = float(self.__holeRadius.get())
# tool diameter
tD = float(self.tooldia.get())
row = float(self.__distanceA.get())
col = float(self.__distanceB.get())
X = float(self.__centerX.get())
Y = float(self.__centerY.get())
gSize = (row, col)
# grid angle (A)
gridAngle = round(float(self.__gridAngle.get()), 1)
gc = ""
loop = ""
gc += self.getGCode_Preamble()
# set Unit
gc += self.__unit.get() + CR
# set Z axis
gc += CR + "(set Z saftey position)" + CR
gc += "G00 Z{0:08.3f} F{1:05.1f} {2}".format(
float(self.__safety_Z.get()), float(self.__speed_Z_G00.get()), CR)
#
# to make it easier, we calculate everything on center of
# milling of every hole starts on a 45degr angle
#
# lets assume we start for the first hole on X/Y position
# X/Y entire circle
cPoint = (X, Y)
hCPoints = self.createHoleCenterPointVectorList(
cPoint, gSize, gridAngle)
print "hCPoints {}".format(hCPoints)
hCPoints = self.addCutterCompensation(hCPoints, tD, r)
print "with cutter compensation hCPoints {}".format(hCPoints)
# hole X/Y center point
gc += CR + "(--- START HOLES ---)" + CR
nr = 0
intend = "".ljust(2)
for vc in hCPoints:
nr += 1
gc += self.generateSubHole(nr, gridAngle, vc, self.__dir.get(),
intend)
pass
gc += "(--- END HOLES ---)" + CR
gc += self.getGCode_Homeing(cPoint[0], cPoint[1], zPos["safetyZ"],
feeds["XYG0"])
gc += self.getGCode_Postamble()
gc += CR
return gc
def createHoleCenterPointVectorList(self,
cPoint,
gSize,
gAngle,
colOffsetX=0.0):
'''
based on CPoint this method create for all holes the center point
This vector list is later on used to calculate starting milling position
due to cutter compensation
return hCPoint center point for every hole
'''
numberOfHolesX = int(self.__numberOfHolesX.get())
numberOfHolesY = int(self.__numberOfHolesY.get())
hCPoints = []
#
# to avoid over shoots
if gAngle < 0.0 or gAngle > 90.0:
gAngle = 0.0
#
# initialize point vector list
cPointTemp = cPoint
distRow = distCol = 0.0
intend = "".ljust(2)
cPX = cPY = distRow = distCol = 0.0
cColOffset = (0.0, 0.0)
for y in range(numberOfHolesY):
cPX = cPY = 0.0
print(CR +
"Row #{0} grid Angle {1:5.1f}, colOffsetX {2:5.1f}".format(
(y + 1), gAngle, colOffsetX))
gamma = 90
alpha = gAngle
beta = gamma - alpha
dRow = (gSize[0] * y)
#
# this triangle is needed to calculate the new center point
# for next drill hole
sideA = round(dRow * math.cos(math.radians(beta)), 3)
sideB = round((math.sqrt(math.pow(dRow, 2) - math.pow(sideA, 2))),
3)
sideC = round(gSize[0], 3) #a
#
# below calculation is neede for all rows above themes
# first row and only if gridAngle is > 0.0
# because if we turn the grid for x degrees, than a
# little triangle can be calculated. The hypernuse of this
# triangle is distance ROW (a), in this case side "a" of This
# triangle is the distance between current X and new X. New X
# is every time left from current X
#
# side b of triangle is the distance vorm current Y and next Y
# and every time above current Y
#
if y > 0 and gAngle > 0.0:
print("1) cPoint ({})".format(cPoint))
# next xPoint is left from last xPoint
# next yPoint is up from last yPoint
cPoint = ((cPointTemp[0] - sideA), (cPointTemp[1] + sideB))
print("2) cPoint ({})".format(cPoint))
print "Triangle a({}) b({}) c({}) alpa({}) beta({}) gamma({})".format(
sideA, sideB, sideC, alpha, beta, gamma)
cColOffset = self.__setOffsetX(colOffsetX, gAngle)
cPoint = (cPoint[0] + cColOffset[0], cPoint[1] + cColOffset[1])
pass
distCol = 0.0
for x in range(numberOfHolesX):
print("Hole #{0} cPX{1}. cPY{2} sA {3} sB {4} sC {5}".format(
((x + 1) + (y * numberOfHolesX)), cPX, cPY, sideA, sideB,
sideC))
#
# for every "first" hole in a row, some special
# calculations are needed
if (x == 0):
# add/sub calculated triangle sides a + b from
# current Centerpoint
if (gAngle > 0.0):
cPY += (sideB + cColOffset[1])
cPX -= sideA
cPX += cColOffset[0]
else:
cPY += dRow
else:
distCol += gSize[1] #b
rad = math.radians(gAngle)
#
# sin/cos is calculated every time with gSize(b) (distCol)
cPX = round(math.cos(rad) * (gSize[1] * x) + cPoint[0], 3)
cPY = round(math.sin(rad) * (gSize[1] * x) + cPoint[1], 3)
# if gridAngle = 0.=, than y is every time distance b
if (gAngle == 0.0):
cPY += dRow
#
# add this vector
#
# offset is only relevant for above rows !
if (y > 0):
cColOffset = self.__setOffsetX(colOffsetX, gAngle)
print(
"--> (a) Offset cPX {}, cPY {}, colOffset {} ".format(
cPX, cPY, cColOffset))
cPY += cColOffset[1]
if (gAngle == 0.0):
cPX += (cColOffset[0] * y)
else:
cPX += cColOffset[0]
print(
"--> (b) Offset cPX {}, cPY {}, colOffset {} ".format(
cPX, cPY, cColOffset))
pass
hCPoints.append((round(cPX, 3), round(cPY, 3)))
#
print(
" new cPX {0} cPY {1}, distRow {2}, distCol {3}".format(
cPX, cPY, distRow, distCol))
pass
distRow += gSize[0] #a
pass
return hCPoints
def __setOffsetX(self, offset, gAngle):
x = y = 0.0
gamma = 90
alpha = gAngle
beta = gamma - alpha
#
# this triangle is needed to calculate the new center point
# for next drill hole
sideA = round(offset * math.cos(math.radians(beta)), 3)
sideB = round((math.sqrt(math.pow(offset, 2) - math.pow(sideA, 2))), 3)
sideC = round(offset, 3) #a
x += sideB
y += sideA
print("CalcOffset x {}, y {}".format(x, y))
return (x, y)
def addCutterCompensation(self, hCPoints, toolDia, holeRadius):
'''
if cutter compenstation is needed, this method set the real starting
point for milling including compensation (inside, outside, cneter)
based on current tool diameter
'''
gc = ""
r = toolDia / 2.0
hcp = []
for v in hCPoints:
if (self.__cuttercompensation.get() == "G40"):
hcp.append(v)
pass
if (self.__cuttercompensation.get() == "G41"):
hcp.append((v[0] - r, v[1]))
if (self.__cuttercompensation.get() == "G42"):
hcp.append((v[0] + r, v[1]))
return hcp
def generateSubHole(self,
nr,
angle,
hCPoint,
cDir,
intend="",
retraction=0.0):
'''
create gCode for hole "nr" at point "hCPoint"
direction of cut is set in "cDir"
'''
# gc is local !
gc = " (--Hole #{0:02d} at angle {1:05.1f}deg --){2}".format(
int(nr), angle, CR)
dT = float(self.__depthtotal.get())
dS = float(self.__depthstep.get())
dZ = 0.0
startZ = float(self.__start_Z.get())
FZ0 = float(self.__speed_Z_G00.get())
FZ1 = float(self.speed_Z_G01.get())
FXY1 = float(self.speed_XY_G02G03.get())
X = hCPoint[0]
Y = hCPoint[1]
I = float(self.__holeRadius.get()) * -1.0 # X-Offset (radius)
J = 0.0 # Y-offset
gc += intend
#
# set start X/Y position
gc += intend + "G01 Z{0:08.3f} F{1:05.1f} {2}".format(startZ, FZ1, CR)
gc += intend + "G01 X{0:08.3f} Y{1:08.3f} F{2:05.1f} {3}".format(
X, Y, FXY1, CR)
gc += intend + "(-- start loop --)" + CR
lgc = ""
intend2 = intend.ljust(2)
while (abs(dZ) < abs(dT)):
#
# calculate next Z
if ((abs(dT) - abs(dZ)) < abs(dS)):
# this happens, if a small amount is the rest
dZ -= (abs(dT) - abs(dZ))
print "rest Z: {}".format(dZ)
else:
# substract next depthStep
dZ -= abs(dS)
print "new Z: {}".format(dZ)
#
# before we start next depthstep, we move 0.5 upwards for
# retraction
if retraction > 0.0:
lgc += intend2 + "(-- new Z {0:08.3f} --) {1}".format(dZ, CR)
lgc += intend2 + "(retraction)" + CR
lgc += intend2 + "G01 Z{0:08.3f} F{1:04.0f} {2}".format(
dZ + retraction, FZ0, CR)
#
# set new Z
lgc += intend2 + "G01 Z{0:08.3f} F{1:04.0f} {2}".format(
dZ, FZ1, CR)
# set XZ
lgc += intend2 + cDir
lgc += " X{0:08.3f} Y{1:08.3f} I{2:08.3f} J{3:08.3f} F{4:05.1f} {5}".format(
X, Y, I, J, FXY1, CR)
#
# for saftey issues.
if (abs(dZ) == 0.0):
break
lgc += CR
pass
gc += lgc
# start Z
gc += intend + "G00 Z{0:08.3f} F{1:04.0f} {2}".format(startZ, FZ0, CR)
gc += intend + "(-- end loop --)" + CR + CR
return gc
def userInputValidation(self):
'''
this class is used to validate necessary user input fields
'''
print("userInputValidation")
hR = float(self.__holeRadius.get())
gA = float(self.__gridAngle.get())
a = float(self.__distanceA.get())
b = float(self.__distanceB.get())
nHX = float(self.__numberOfHolesX.get())
nHY = float(self.__numberOfHolesY.get())
toolDia = float(self.tooldia.get())
if (nHX <= 0.0 or nHY <= 0.0):
self.MessageBox(
state="ERROR",
title="ERROR",
text="number of holes in X and Y should be 1 or more")
return False
if (gA < 0.0 or gA > 90.0):
self.MessageBox(
state="ERROR",
title="ERROR",
text="grid angle should be between 0.0 and 90.0")
return False
if (toolDia <= 0.0):
self.MessageBox(
state="ERROR",
title="ERROR",
text="Tool diamater should be greater than 0.0")
return False
if (hR <= (toolDia / 2) and hR >= 0.0):
self.MessageBox(
state="ERROR",
title="ERROR",
text="hole radius greater than tool diameter and 0.0")
return False
if ((hR * 2) >= a or (hR * 2) >= b):
self.MessageBox(
state="ERROR",
title="WARN",
text="hole diameter is greater than distance a or b")
return False
if (a <= 0.0 or b <= 0.0):
self.MessageBox(
state="ERROR",
title="WARN",
text="distances A and B should be greater than 0.0")
return False
if (a <= (hR * 2) or b <= (hR * 2)):
self.MessageBox(
state="ERROR",
title="WARN",
text="distance A or B is less than hole diameter")
return False
if (float(self.__centerX.get()) < 0.0
or float(self.__centerY.get()) < 0.0):
self.MessageBox(
state="ERROR",
title="ERROR",
text="Values for CenterX/Y should be positive")
return False
if (abs(float(self.__depthtotal.get())) < abs(
float(self.__depthstep.get()))):
self.MessageBox(
state="ERROR",
title="ERROR",
text="Tooldiamter should be less than arc diameter")
return False
if (float(self.__start_Z.get()) <= 0.0
or float(self.__safety_Z.get()) <= 0.0):
self.MessageBox(
state="ERROR",
title="ERROR",
text="Z parameter values should be greater than 0.0")
return False
if (float(self.tooldia.get()) <= 0.0):
self.MessageBox(
state="ERROR",
title="ERROR",
text="Tooldiamter should greater than 0.0")
return False
return True