-
Notifications
You must be signed in to change notification settings - Fork 0
/
bim_auto_catia.py
79 lines (56 loc) · 1.81 KB
/
bim_auto_catia.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
import bim_auto_base as bim
# 被按住的鼠标键(左键LEFT、右键RIGHT、中键滚轮MIDDLE)
left = bim.MouseKey.LEFT
middle = bim.MouseKey.MIDDLE
right = bim.MouseKey.RIGHT
ctrl = bim.KeyboardKey.CTRL
shift = bim.KeyboardKey.SHIFT
def rotate_hot_key_down():
bim.bottom_right_pos_click()
bim.mouse_press(middle)
bim.mouse_press(left)
def rotate_hot_key_release():
bim.mouse_release(middle)
bim.mouse_release(left)
def scroll_hot_key_down():
bim.bottom_right_pos_click()
bim.mouse_press(middle)
bim.key_press(ctrl)
def scroll_hot_key_release():
bim.mouse_release(middle)
bim.key_release(ctrl)
def zoom_hot_key_down():
bim.bottom_right_pos_click()
bim.key_press(ctrl)
bim.mouse_press(middle)
def zoom_hot_key_release():
bim.key_release(ctrl)
bim.mouse_release(middle)
def mouse_rotate():
"""鼠标按住后花圈"""
rotate_hot_key_down()
bim.mouse_scroll_and_drag(scroll_type=bim.ScrollType.CIRCLE)
rotate_hot_key_release()
def mouse_scroll_right_left():
"""鼠标按住向右拖动"""
scroll_hot_key_down()
# 向右滑动
bim.mouse_scroll_and_drag(scroll_type=bim.ScrollType.HOR_SCROLL_RIGHT)
# 向左滑动
bim.mouse_scroll_and_drag(scroll_type=bim.ScrollType.HOR_SCROLL_LEFT)
scroll_hot_key_release()
def zoom_in_out():
"""模型先放大再缩小"""
zoom_hot_key_down()
# 放大
bim.mouse_scroll_and_drag(scroll_type=bim.ScrollType.VER_SCROLL_UP)
# 缩小
bim.mouse_scroll_and_drag(scroll_type=bim.ScrollType.VER_SCROLL_DOWN)
zoom_hot_key_release()
def test_run():
mouse_scroll_right_left()
zoom_in_out()
mouse_rotate()
if __name__ == '__main__':
for i in range(2):
test_run()