-
Notifications
You must be signed in to change notification settings - Fork 0
/
calculate_drawers.py
90 lines (73 loc) · 3.19 KB
/
calculate_drawers.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
import itertools
tandem_kinds = [
'TANDEM plus BLUMOTION',
'TANDEM plus TIP-ON',
'TANDEM plus',
'TANDEM BLUMOTION',
'TANDEM TIP-ON',
'TANDEM',
]
tandem_lower_paddings = {
'TANDEM plus BLUMOTION': 27.5,
'TANDEM plus TIP-ON': 27.5,
'TANDEM plus': 27.5,
'TANDEM BLUMOTION': 24.5,
'TANDEM TIP-ON': 22.5,
'TANDEM': 22.5,
}
tandem_nominal_lengths = {
'TANDEM plus BLUMOTION': [250, 270, 300, 350, 400, 450, 500, 550],
'TANDEM plus TIP-ON': [250, 270, 300, 350, 400, 450, 500, 550],
'TANDEM plus': [250, 270, 300, 350, 400, 450, 500, 550],
'TANDEM BLUMOTION': [270, 300, 350, 400, 450, 500, 550],
'TANDEM TIP-ON': [270, 300, 350, 400, 450, 500, 550],
'TANDEM': [270, 300, 350, 400, 450, 500, 550],
}
tandem_upper_padding = 7
tip_on_wiggle_room = 4
drawer_side_extension_length = 10 # отступ от края до паза под полик в боковинах ящиков. взято от балды, нужно выяснить
drawer_thickness = 16
print('Виды TANDEM:')
for i, tandem_kind in enumerate(tandem_kinds):
print(i, tandem_kind)
tandem_kind = tandem_kinds[int(input('Используемый вид (0-{}):'.format(len(tandem_kinds) - 1)))]
widths = [int(x) for x in input('ширины ящиков:').split()]
heights = [int(x) for x in input('высоты ящиков:').split()]
depth = int(input('глубина изделия:'))
facade_thickness = int(input('толщина фасада ящиков:'))
back_thickness = int(input('толщина задней стенки:'))
drawer_bottom_thickness = int(input('толщина полика ящиков:'))
carcass_thickness = int(input('толщина внутренних перегородок'))
inner = bool(input('вкладной ли фасад? (1/0):'))
stabiliser = posistop = False
if 'BLUMOTION' in tandem_kind:
if inner:
posistop = bool(input('есть ли упор по глубине? (1/0):'))
else:
stabiliser = bool(input('есть ли стабилизатор? (1/0):'))
parts = []
for width, height in itertools.product(widths, heights):
lower_padding = tandem_lower_paddings[tandem_kind]
nominal_lengths = tandem_nominal_lengths[tandem_kind]
back_padding = 3
if inner and 'TIP-ON' in tandem_kind:
back_padding += 4
if stabiliser:
back_padding += 12
if posistop:
back_padding += 2
if inner:
max_nominal_length = depth - back_thickness - back_padding - facade_thickness
else:
max_nominal_length = depth - back_thickness - back_padding + tip_on_wiggle_room
nominal_length = max(filter(lambda x: x < max_nominal_length, nominal_lengths))
drawer_depth = nominal_length - 10
drawer_width = width - 10
drawer_height = height - lower_padding - tandem_upper_padding # это высота по полику, боковины больше
drawer_parts = []
drawer_parts.append((drawer_depth, drawer_width - drawer_thickness * 2 + 6 * 2)) # полик
drawer_parts.extend([(drawer_width - drawer_thickness * 2, drawer_height - drawer_bottom_thickness)] * 2) # поперечины
drawer_parts.extend([(drawer_depth, drawer_height + drawer_side_extension_length)] * 2) # боковины
# TODO: фасад
parts.extend(drawer_parts)
print(parts)