-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript_trous.py
50 lines (38 loc) · 979 Bytes
/
script_trous.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
#!python3.9
# -*- coding: utf-8 -*-
"""
Script pour faire des trous à des endroits particuliers sur une plaque.
Premier jet, ligne de commande.
Created on Wed Oct 13 09:46:37 2021
@author: ejetzer
"""
from datetime import date
from matplotlib import pyplot
# Régler l'origine
# On assume que l'origine est au coin supérieur gauche
# î
# .->---------------.
# | |
# | |
# .-----------------.
fichier = f'programme {date.today()}.iso'
with open(fichier, 'w') as f:
print('G71', file=f) # mm
print('T1', file=f) # Outil 1
print('S10000', file=f) # tr/min
print('F800', file=f) # mm/min
# Entrer les points
modèle = """
G0 X{} Y{} Z1.
G1 Z-1.
G4 F1
G1 Z1."""
xs, ys = [], []
with open(fichier, 'a') as f:
while (xy := input('x,y = ')):
x, y = [float(z) for z in xy.split(',')]
xs.append(x)
ys.append(y)
print(modèle.format(x, y), file=f)
pyplot.plot(xs, ys, '+')
pyplot.show()