-
Notifications
You must be signed in to change notification settings - Fork 45
/
depth_params.py
31 lines (28 loc) · 1.37 KB
/
depth_params.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
import math
class depth_params:
def __init__(self, clearance_height, rapid_safety_space, start_depth, step_down, z_finish_depth, z_thru_depth, final_depth, user_depths):
self.clearance_height = clearance_height
self.rapid_safety_space = math.fabs(rapid_safety_space)
self.start_depth = start_depth
self.step_down = math.fabs(step_down)
self.z_finish_depth = math.fabs(z_finish_depth)
self.z_thru_depth = math.fabs(z_thru_depth)
self.final_depth = final_depth
self.user_depths = user_depths
def get_depths(self):
if self.user_depths != None:
depths = self.user_depths
else:
depth = self.final_depth - self.z_thru_depth
depths = [depth]
depth += self.z_finish_depth
if depth + 0.0000001 < self.start_depth:
if self.z_finish_depth > 0.0000001: depths.insert(0, depth)
depth += self.z_thru_depth
layer_count = int((self.start_depth - depth) / self.step_down - 0.0000001) + 1
if layer_count > 0:
layer_depth = (self.start_depth - depth)/layer_count
for i in range(1, layer_count):
depth += layer_depth
depths.insert(0, depth)
return depths