Main 5
Main 5
pyplot as plt
import math
import pandas as pd
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import tkinter as tk
from main3 import main3
from main7 import main7
from main8 import main8
def load_data(file_path):
"""Load the Excel data into a DataFrame."""
try:
return pd.read_excel(file_path)
except Exception as e:
print(f"Error loading data: {e}")
return pd.DataFrame()
return cubes_dict
for z in cubes_dict:
if z == selected_cube[2]: # Only draw the selected layer
for i, (vertices, faces) in enumerate(cubes_dict[z]):
# Get the cube's position from the DataFrame based on its ID
cube_data = data.iloc[selected_cube[2] * x_dim * y_dim + i]
dose_value = cube_data['dose'] # Assuming the fourth column in the
Excel file is called 'dose'
def create_gui(fig):
"""Create the Tkinter GUI with matplotlib embedded and a table showing cubes
with dose > 100 in the last stage."""
window = tk.Tk()
window.title("Gestion des Déchets Radioactifs")
window.attributes('-fullscreen', True)
window.configure(bg='#2d2d2d') # Industrial dark theme
return window
def dose_rates_distribution():
"""Function to open main3.py"""
main3()
def dose_rates_distribution_Y():
"""Function to open main7.py"""
main7()
def dose_rates_distribution_X():
"""Function to open main8.py"""
main8()
def main():
file_path = "position_monolithe.xlsx"
data = load_data(file_path)
x_dim, y_dim = 12, 13 # Define the dimensions of the grid
spacing = 0.2
type_monolith = "II"
total_cubes = len(data)
z_dim = math.ceil(total_cubes / (x_dim * y_dim)) # Calculate z dimension based
on total cubes
cubes_dict = create_cubes(x_dim, y_dim, z_dim, total_cubes, spacing,
type_monolith, file_path)
selected_cube = [0, 0, 0] # Ensure that we start with the first cube at the
first stage (z=0)
window = create_gui(fig)
# To display the first stage initially, you can directly call draw_stage with
the initial selection
draw_stage(ax1, 'cyan', selected_cube, spacing, x_dim, y_dim, z_dim,
cubes_dict, data)
fig.canvas.mpl_connect(
'key_press_event',
lambda event: on_key(event, selected_cube, x_dim, y_dim, z_dim, cubes_dict,
ax1, data)
)
window.mainloop()
if __name__ == "__main__":
main()