devl_v3
4
.gitignore
vendored
@ -2,4 +2,6 @@
|
||||
/__pycache__/
|
||||
*ARCHIV*
|
||||
*BAK*
|
||||
*BACKUP*
|
||||
*BACKUP*
|
||||
out
|
||||
cfg_inlay_PUTx.xlsx
|
||||
|
||||
@ -7,7 +7,7 @@ $scriptPath = "./MAIN.py"
|
||||
$username = [System.Environment]::UserName
|
||||
|
||||
# Construct the path to the Python executable
|
||||
$pythonExe = "C:\Users\$username\AppData\Local\miniconda3\envs\$venvName\python.exe"
|
||||
$pythonExe = "C:\Users\user58\.conda\envs\$venvName\python.exe"
|
||||
|
||||
# Execute the Python script
|
||||
& $pythonExe $scriptPath
|
||||
|
||||
8
MAIN.py
@ -284,12 +284,20 @@ def setup_evaluation(root, folder_pictures, data, folder_output, input_vars, sel
|
||||
# Function to generate configuration file based on current parameters
|
||||
def btn_gen():
|
||||
generate_config_spf(folder_output, input_vars, selected_params)
|
||||
def btn_gen_custom1():
|
||||
generate_config_spf_custom1(folder_output, input_vars, selected_params)
|
||||
def btn_gen_custom2():
|
||||
generate_config_spf_custom1(folder_output, input_vars, selected_params, filetransfer=True)
|
||||
|
||||
# Place buttons in the vertical frame for operations
|
||||
button_frame = ttk.Frame(frame)
|
||||
button_frame.grid(row=0, column=1, padx=10, pady=10, sticky="n")
|
||||
button1 = ttk.Button(button_frame, text="GENERATE DMUAUT_CFG.SPF FILE", width=45, command=btn_gen)
|
||||
button1.grid(row=0, column=0, padx=10, pady=5)
|
||||
button2 = ttk.Button(button_frame, text="GEN CFG_INLAY.SPF FILE", width=45, command=btn_gen_custom1)
|
||||
button2.grid(row=1, column=0, padx=5, pady=5)
|
||||
button3 = ttk.Button(button_frame, text="GEN+TRANSFER CFG_INLAY.SPF FILE", width=45, command=btn_gen_custom2)
|
||||
button3.grid(row=1, column=1, padx=5, pady=5)
|
||||
|
||||
root.grid_columnconfigure(0, weight=1)
|
||||
|
||||
|
||||
@ -7,4 +7,8 @@ dependencies:
|
||||
- pyyaml
|
||||
- jsonschema
|
||||
- tk
|
||||
- pillow
|
||||
- pillow
|
||||
- pandas
|
||||
- openpyxl
|
||||
- paramiko
|
||||
- matplotlib
|
||||
@ -1,12 +1,12 @@
|
||||
inlay7:
|
||||
'2':
|
||||
kos: '4'
|
||||
x_num: '4'
|
||||
x_offset: '30'
|
||||
y_num: '3'
|
||||
y_offset: '30'
|
||||
inlay_kleinteil:
|
||||
kos: '4'
|
||||
x_num: '7'
|
||||
x_num: '5'
|
||||
x_offset: '5'
|
||||
y_num: '4'
|
||||
y_offset: '4'
|
||||
y_num: '5'
|
||||
y_offset: '5'
|
||||
inlay1:
|
||||
kos: '4'
|
||||
x_num: '6'
|
||||
x_offset: '120'
|
||||
y_num: '5'
|
||||
y_offset: '250'
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
job1:
|
||||
clp: clp1
|
||||
grp: grp1
|
||||
inlay: inlay7
|
||||
inlay: inlay1
|
||||
wp_fin: wpfin1
|
||||
wp_raw: wpraw1
|
||||
job3:
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
wpfin1:
|
||||
l_wpfin: '8'
|
||||
x_wpfin: '20'
|
||||
h_grp_wpfin: ''
|
||||
l_wpfin: '10'
|
||||
x_wpfin: '30'
|
||||
y_wpfin: '10'
|
||||
z_wpfin: '13'
|
||||
|
||||
@ -3,6 +3,7 @@ test:
|
||||
y_wpraw: '10'
|
||||
z_wpraw: '20'
|
||||
wpraw1:
|
||||
x_wpraw: '10'
|
||||
h_grp_wpraw: ''
|
||||
x_wpraw: '20'
|
||||
y_wpraw: '10'
|
||||
z_wpraw: '20'
|
||||
z_wpraw: '30'
|
||||
|
||||
|
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 137 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 89 KiB |
|
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 84 KiB |
14
def.yml
@ -17,6 +17,7 @@ groups:
|
||||
x_wpraw: double
|
||||
y_wpraw: double
|
||||
z_wpraw: double
|
||||
h_grp_wpraw: double
|
||||
cfg:
|
||||
picture_name: img_wpraw.png
|
||||
wp_fin:
|
||||
@ -25,20 +26,13 @@ groups:
|
||||
y_wpfin: double
|
||||
z_wpfin: double
|
||||
l_wpfin: double
|
||||
h_grp_wpfin: double
|
||||
cfg:
|
||||
picture_name: img_wpfin.png
|
||||
grp:
|
||||
parameter:
|
||||
hub: double
|
||||
h_offset: double
|
||||
h_step: double
|
||||
w_offset: double
|
||||
w_step: double
|
||||
steps_num: int
|
||||
cfg:
|
||||
picture_name: img_grp.png
|
||||
clp:
|
||||
parameter:
|
||||
clp_offset: double
|
||||
|
||||
|
||||
cfg:
|
||||
picture_name: img_clp.png
|
||||
|
||||
@ -81,8 +81,8 @@ def generate_picture_clp(all_group_vars, picture_path, DEBUG=False):
|
||||
|
||||
# Add the origin sparrow (a small 3D marker at the origin)
|
||||
max_size3 = max(x_cube, y_cube, z_cube) * 0.3 # Scale the arrows relative to the smallest dimension
|
||||
ax.quiver(x_wpraw, y_wpraw, 0, max_size3, 0, 0, color='red', linewidth=3, label='X-axis') # Red arrow for X-axis
|
||||
ax.quiver(x_wpraw, y_wpraw, 0, 0, max_size3, 0, color='green', linewidth=3, label='Y-axis') # Green arrow for Y-axis
|
||||
ax.quiver(x_wpraw, y_wpraw, 0, 0, max_size3, 0, color='red', linewidth=3, label='X-axis') # Red arrow for X-axis
|
||||
ax.quiver(x_wpraw, y_wpraw, 0, -max_size3, 0, 0, color='green', linewidth=3, label='Y-axis') # Green arrow for Y-axis
|
||||
ax.quiver(x_wpraw, y_wpraw, 0, 0, 0, max_size3, color='blue', linewidth=3, label='Z-axis') # Blue arrow for Z-axis
|
||||
|
||||
# Set viewing angle
|
||||
|
||||
93
funct_gen.py
@ -2,7 +2,10 @@
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
import pandas as pd
|
||||
import paramiko
|
||||
import yaml
|
||||
import shutil
|
||||
|
||||
# Function to generate the DMUAUT_CFG.SPF configuration file and save selected parameter sets
|
||||
def generate_config_spf(folder_output, input_vars, selected_params):
|
||||
@ -42,5 +45,89 @@ def generate_config_spf(folder_output, input_vars, selected_params):
|
||||
|
||||
print(f"Configuration files saved in {folder_path}")
|
||||
|
||||
# def generate_config_spf():
|
||||
# tbd
|
||||
|
||||
|
||||
|
||||
def generate_config_spf_custom1(folder_output, input_vars, selected_params, filetransfer=False):
|
||||
filename = "CFG_INL.SPF"
|
||||
filename2 = "_N_CFG_INL_SPF"
|
||||
|
||||
|
||||
# Get the current timestamp for folder name (format: YYMMDD_HHmmSS)
|
||||
timestamp = time.strftime("%y%m%d_%H%M%S")
|
||||
folder_path = os.path.join(folder_output, f"{timestamp}")
|
||||
|
||||
# Create the folder with the timestamp
|
||||
if not os.path.exists(folder_path):
|
||||
os.makedirs(folder_path)
|
||||
|
||||
# Define the file path for the SPF configuration file
|
||||
spf_file_path = os.path.join(folder_path, filename)
|
||||
xlsx_path = "cfg_inlay_PUTx.xlsx"
|
||||
|
||||
# Extract grid parameters
|
||||
x_num = int(input_vars['inlay']['x_num'].get()) # Number of columns
|
||||
y_num = int(input_vars['inlay']['y_num'].get()) # Number of rows
|
||||
x_offset = float(input_vars['inlay']['x_offset'].get()) # X offset
|
||||
y_offset = float(input_vars['inlay']['y_offset'].get()) # Y offset
|
||||
|
||||
# Check if Excel file exists, if not create it with 'x' values
|
||||
if not os.path.exists(xlsx_path):
|
||||
df = pd.DataFrame("x", index=range(x_num), columns=range(y_num))
|
||||
df.to_excel(xlsx_path, index=False, header=False)
|
||||
|
||||
# Load Excel file
|
||||
df = pd.read_excel(xlsx_path, header=None, dtype=str).fillna("")
|
||||
df = df.reindex(range(x_num), fill_value=0).reindex(columns=range(y_num), fill_value=0)
|
||||
df = df.map(lambda x: 1 if str(x).strip().lower() == "x" else 0)
|
||||
|
||||
# Generate the SPF file content
|
||||
with open(spf_file_path, "w") as spf_file:
|
||||
spf_file.write(f"; CFG FILE FOR DMU50 AUTOMATION\n")
|
||||
spf_file.write(f"; GENERATED: {timestamp}\n")
|
||||
spf_file.write("; ---------------------------------------------------\n")
|
||||
|
||||
# Write WP_X[i] and WP_Y[i] values
|
||||
cnt = 0
|
||||
for j in range(y_num): # Rows
|
||||
for i in range(x_num): # Columns
|
||||
if df.iloc[i, j] == 1: # Consider only marked positions
|
||||
spf_file.write(f"WP_X[{cnt}]={x_offset * i}\n")
|
||||
spf_file.write(f"WP_Y[{cnt}]={y_offset * j}\n")
|
||||
cnt += 1
|
||||
spf_file.write(f"WP_NUM={cnt}\n")
|
||||
spf_file.write(f"M17\n")
|
||||
spf_file.write("\n; ---------------------------------------------------\n")
|
||||
|
||||
print(f"Configuration file saved at: {spf_file_path}")
|
||||
|
||||
if filetransfer:
|
||||
spf_file_path2 = os.path.join(folder_path, filename2)
|
||||
shutil.copyfile(spf_file_path, spf_file_path2)
|
||||
|
||||
#try:
|
||||
# Transfer to Sinumerik
|
||||
url2 = "192.168.214.1"
|
||||
ssh_username = "manufact"
|
||||
ssh_password = "SUNRISE"
|
||||
upload_folder_nc = "/nckfs/_N_MPF_DIR/_N_AUTO_ROB_DIR"
|
||||
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect(url2,username=ssh_username,password=ssh_password)
|
||||
sftp = ssh.open_sftp()
|
||||
sftp.chdir(upload_folder_nc)
|
||||
if filename2 in sftp.listdir():
|
||||
sftp.remove(filename2)
|
||||
sftp.put(spf_file_path2, filename2)
|
||||
sftp.close()
|
||||
ssh.close()
|
||||
|
||||
os.remove(spf_file_path2)
|
||||
|
||||
print(f"------->>>> FILE TRANSFERED TO SINUMERIK ------->>>> ")
|
||||
#except Exception as e:
|
||||
# print(f"ERROR IN FILETRANSFER {e}")
|
||||
else:
|
||||
os.startfile(folder_path)
|
||||
|
||||
|
||||
@ -45,6 +45,8 @@ def generate_picture_inlay(all_group_vars, picture_path, DEBUG=False):
|
||||
ax.set_ylim(0, 1)
|
||||
ax.set_xticks([]), ax.set_yticks([])
|
||||
plt.subplots_adjust(left=0.1, right=0.9, top=0.9, bottom=0.1) # Adjusting the margins
|
||||
ax.set_xlim(1, 0) # Flipping the x-axis
|
||||
ax.set_ylim(1, 0) # Flipping the y-axis
|
||||
|
||||
if DEBUG:
|
||||
plt.show()
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
; CFG FILE FOR DMU50 AUTOMATION
|
||||
; GENERATED: 241016_164629
|
||||
; ---------------------------------------------------
|
||||
X_NUM = 8
|
||||
X_OFFSET = 5
|
||||
Y_NUM = 7
|
||||
Y_OFFSET = 4
|
||||
KOS = 4
|
||||
|
||||
; ---------------------------------------------------
|
||||
X_WPRAW = 10
|
||||
Y_WPRAW = 1
|
||||
Z_WPRAW = 1
|
||||
|
||||
; ---------------------------------------------------
|
||||
X_WPFIN =
|
||||
Y_WPFIN =
|
||||
Z_WPFIN =
|
||||
L_WPFIN =
|
||||
|
||||
; ---------------------------------------------------
|
||||
HUB = 10
|
||||
H_OFFSET = 20
|
||||
H_STEP = 5
|
||||
W_OFFSET = 20
|
||||
W_STEP = 10
|
||||
STEPS_NUM = 6
|
||||
|
||||
; ---------------------------------------------------
|
||||
@ -1,5 +0,0 @@
|
||||
Selected Parameter Sets:
|
||||
inlay: inlay7
|
||||
wp_raw: wpraw1
|
||||
wp_fin: <<new par set>>
|
||||
grp: grp1
|
||||
@ -1,29 +0,0 @@
|
||||
; CFG FILE FOR DMU50 AUTOMATION
|
||||
; GENERATED: 241017_101415
|
||||
; ---------------------------------------------------
|
||||
X_NUM = 11
|
||||
X_OFFSET = 5
|
||||
Y_NUM = 4
|
||||
Y_OFFSET = 4
|
||||
KOS = 4
|
||||
|
||||
; ---------------------------------------------------
|
||||
X_WPRAW = 10
|
||||
Y_WPRAW = 10
|
||||
Z_WPRAW = 20
|
||||
|
||||
; ---------------------------------------------------
|
||||
X_WPFIN = 10
|
||||
Y_WPFIN = 10
|
||||
Z_WPFIN = 20
|
||||
L_WPFIN = 10
|
||||
|
||||
; ---------------------------------------------------
|
||||
HUB = 10
|
||||
H_OFFSET = 20
|
||||
H_STEP = 5
|
||||
W_OFFSET = 20
|
||||
W_STEP = 10
|
||||
STEPS_NUM = 6
|
||||
|
||||
; ---------------------------------------------------
|
||||
@ -1,5 +0,0 @@
|
||||
Selected Parameter Sets:
|
||||
inlay: inlay4
|
||||
wp_raw: wpraw1
|
||||
wp_fin: wpfin1
|
||||
grp: grp1
|
||||
@ -1,29 +0,0 @@
|
||||
; CFG FILE FOR DMU50 AUTOMATION
|
||||
; GENERATED: 241017_103326
|
||||
; ---------------------------------------------------
|
||||
X_NUM = 7
|
||||
X_OFFSET = 5
|
||||
Y_NUM = 4
|
||||
Y_OFFSET = 4
|
||||
KOS = g54
|
||||
|
||||
; ---------------------------------------------------
|
||||
X_WPRAW = 5
|
||||
Y_WPRAW = 5
|
||||
Z_WPRAW = 15
|
||||
|
||||
; ---------------------------------------------------
|
||||
X_WPFIN = 10
|
||||
Y_WPFIN = 10
|
||||
Z_WPFIN = 13
|
||||
L_WPFIN = 8
|
||||
|
||||
; ---------------------------------------------------
|
||||
HUB = 10
|
||||
H_OFFSET = 10
|
||||
H_STEP = 5
|
||||
W_OFFSET = 25
|
||||
W_STEP = 4
|
||||
STEPS_NUM = 6
|
||||
|
||||
; ---------------------------------------------------
|
||||
@ -1,5 +0,0 @@
|
||||
Selected Parameter Sets:
|
||||
inlay: inlay_kleinteil
|
||||
wp_raw: wpraw2
|
||||
wp_fin: wpfin1
|
||||
grp: grp1
|
||||
@ -1,32 +0,0 @@
|
||||
; CFG FILE FOR DMU50 AUTOMATION
|
||||
; GENERATED: 241017_180108
|
||||
; ---------------------------------------------------
|
||||
X_NUM = 8
|
||||
X_OFFSET = 5
|
||||
Y_NUM = 7
|
||||
Y_OFFSET = 4
|
||||
KOS = 4
|
||||
|
||||
; ---------------------------------------------------
|
||||
X_WPRAW = 10
|
||||
Y_WPRAW = 10
|
||||
Z_WPRAW = 20
|
||||
|
||||
; ---------------------------------------------------
|
||||
X_WPFIN = 10
|
||||
Y_WPFIN = 10
|
||||
Z_WPFIN = 13
|
||||
L_WPFIN = 8
|
||||
|
||||
; ---------------------------------------------------
|
||||
HUB = 50
|
||||
H_OFFSET = 30
|
||||
H_STEP = 10
|
||||
W_OFFSET = 40
|
||||
W_STEP = 45
|
||||
STEPS_NUM = 5
|
||||
|
||||
; ---------------------------------------------------
|
||||
CLP_OFFSET =
|
||||
|
||||
; ---------------------------------------------------
|
||||
@ -1,6 +0,0 @@
|
||||
Selected Parameter Sets:
|
||||
inlay: inlay7
|
||||
wp_raw: wpraw1
|
||||
wp_fin: wpfin1
|
||||
grp: grp1
|
||||
clp: <<new par set>>
|
||||
@ -1,32 +0,0 @@
|
||||
; CFG FILE FOR DMU50 AUTOMATION
|
||||
; GENERATED: 241017_181437
|
||||
; ---------------------------------------------------
|
||||
X_NUM = 8
|
||||
X_OFFSET = 5
|
||||
Y_NUM = 7
|
||||
Y_OFFSET = 4
|
||||
KOS = 4
|
||||
|
||||
; ---------------------------------------------------
|
||||
X_WPRAW = 5
|
||||
Y_WPRAW = 5
|
||||
Z_WPRAW = 15
|
||||
|
||||
; ---------------------------------------------------
|
||||
X_WPFIN = 10
|
||||
Y_WPFIN = 10
|
||||
Z_WPFIN = 13
|
||||
L_WPFIN = 8
|
||||
|
||||
; ---------------------------------------------------
|
||||
HUB = 50
|
||||
H_OFFSET = 30
|
||||
H_STEP = 10
|
||||
W_OFFSET = 40
|
||||
W_STEP = 45
|
||||
STEPS_NUM = 5
|
||||
|
||||
; ---------------------------------------------------
|
||||
CLP_OFFSET = 0
|
||||
|
||||
; ---------------------------------------------------
|
||||
@ -1,6 +0,0 @@
|
||||
Selected Parameter Sets:
|
||||
inlay: inlay7
|
||||
wp_raw: wpraw2
|
||||
wp_fin: wpfin1
|
||||
grp: grp1
|
||||
clp: clp2
|
||||
@ -1,32 +0,0 @@
|
||||
; CFG FILE FOR DMU50 AUTOMATION
|
||||
; GENERATED: 241017_184239
|
||||
; ---------------------------------------------------
|
||||
X_NUM =
|
||||
X_OFFSET =
|
||||
Y_NUM =
|
||||
Y_OFFSET =
|
||||
KOS =
|
||||
|
||||
; ---------------------------------------------------
|
||||
X_WPRAW = 10
|
||||
Y_WPRAW = 10
|
||||
Z_WPRAW = 20
|
||||
|
||||
; ---------------------------------------------------
|
||||
X_WPFIN = 10
|
||||
Y_WPFIN = 10
|
||||
Z_WPFIN = 13
|
||||
L_WPFIN = 8
|
||||
|
||||
; ---------------------------------------------------
|
||||
HUB = 10
|
||||
H_OFFSET = 10
|
||||
H_STEP = 5
|
||||
W_OFFSET = 25
|
||||
W_STEP = 45
|
||||
STEPS_NUM = 2
|
||||
|
||||
; ---------------------------------------------------
|
||||
CLP_OFFSET = 4
|
||||
|
||||
; ---------------------------------------------------
|
||||
@ -1,6 +0,0 @@
|
||||
Selected Parameter Sets:
|
||||
inlay: <<new par set>>
|
||||
wp_raw: wpraw1
|
||||
wp_fin: wpfin1
|
||||
grp: grp3
|
||||
clp: clp1
|
||||