-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript_xlsx.py
60 lines (42 loc) · 1.11 KB
/
script_xlsx.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
#!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
import pandas
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."""
def conv(x):
if isinstance(x, str):
x = x.replace(',', '.')
return float(x)
df = pandas.read_excel('trous.xlsx', sheet_name=0, header=0,
usecols=(1, 2), converters={0: conv, 1: conv})
print(df)
with open(fichier, 'a') as f:
for _, (x, y) in df.iterrows():
print(modèle.format(x, y), file=f)
df.plot(x=0, y=1, kind='scatter')
pyplot.show()