-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_stl_faster.py
52 lines (40 loc) · 1.56 KB
/
main_stl_faster.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
import pyvista as pv
from tkinter import Tk, messagebox
from tkinter.filedialog import askopenfilename
from values import Values
def STL_view():
try:
Tk().withdraw()
if Values.path == "":
filename = askopenfilename() # wybór pliku .stl do wczytania do wyświetlacza
# Load the STL file
your_mesh = pv.read(filename)
# Create a plotter object and add the mesh to it
plotter = pv.Plotter()
plotter.add_mesh(your_mesh)
plotter.add_axes()
plotter.add_floor()
plotter.enable_anti_aliasing()
plotter.add_title(Values.name, font_size=12, color='red')
# Set the background color and show the plot
plotter.set_background("white")
plotter.show()
plotter.close()
plotter.deep_clean()
if len(Values.path) > 1:
your_mesh = pv.read(Values.path)
# Create a plotter object and add the mesh to it
plotter = pv.Plotter()
plotter.add_mesh(your_mesh)
plotter.add_axes()
plotter.add_floor()
plotter.enable_anti_aliasing()
plotter.add_title(Values.name, font_size=12, color='red')
# Set the background color and show the plot
plotter.set_background("white")
plotter.show()
plotter.close()
plotter.deep_clean()
except Exception as e:
error_message = "Wystąpił błąd. " + str(e)
messagebox.showerror("Błąd", error_message)