-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test.py
executable file
·79 lines (64 loc) · 1.85 KB
/
Test.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import sys
try:
import readline
except ImportError:
import pyreadline as readline
from os import listdir
import pydcel
try:
compat_input = raw_input
except NameError:
compat_input = input
file_list = listdir("sampledata")
class SimpleCompleter(object):
def __init__(self, options):
self.options = sorted(options)
return
def complete(self, text, state):
response = None
if state == 0:
# This is the first time for this text, so build a match list.
if text:
self.matches = [s
for s in self.options
if s and s.startswith(text)]
else:
self.matches = self.options[:]
# Return the state'th item from the match list,
# if we have that many.
try:
response = self.matches[state]
except IndexError:
response = None
return response
# Register our completer function
readline.set_completer(SimpleCompleter(file_list).complete)
# Use the tab key for completion
readline.parse_and_bind('tab: complete')
if len(sys.argv) >= 2:
chosen_file = sys.argv[1]
else:
for f in file_list:
print(f)
print("")
chosen_file = compat_input("which file do you want: ", )
d = pydcel.io.ply2dcel("sampledata/" + str(chosen_file))
d.separateHedges('h')
d.hedgesToSegments()
d.horizontalSweep()
d.renameFaces()
print("-------------HORIZONTAL DONE------------")
if pydcel.io.GRID_PARTITION_FLAG:
d.separateHedges('v')
d.verticalSweep()
d.renameFaces()
print("-------------VERTICAL DONE------------")
if pydcel.io.VISIBILITY_FLAG:
d.computeVertexVisibility()
d.computeFaceVisibility()
d.printMatrix()
if len(sys.argv) == 3 and sys.argv[2] == "GUI":
GUI = pydcel.dcelVis(d)
GUI.mainloop()
else:
print("Bye!")