-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
47 lines (37 loc) · 1.1 KB
/
main.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
import argparse
import numpy as np
from model import Model
from helpers import calc
from plot import plot_2D, plot_3D
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--filename", help="dxf file")
parser.add_argument("--layer", default=0, help="dxf layer")
parser.add_argument("--alpha", default=0, type=float, help="angle in degrees")
parser.add_argument(
"--plot",
choices=["2D", "3D"],
default="3D",
help="Type of plot",
)
args = parser.parse_args()
# Prepare model
model = Model(args)
# Find solution
fdict, R = model.solve()
# Get the coordinates of the points
X = model.X
Y = model.Y
# Get results
for name, f in fdict.items():
match name:
case "F" | "P":
f = f(np.deg2rad(args.alpha))
Z = calc(f, R)(X, Y)
print(f"min({name}):", min(Z))
print(f"max({name}):", max(Z))
match args.plot:
case "2D":
plot_2D(name, X, Y, Z)
case "3D":
plot_3D(name, X, Y, Z)