-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExcludingPlaceCoordinatesTool.py
64 lines (46 loc) · 1.54 KB
/
ExcludingPlaceCoordinatesTool.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
import rlcompleter
def deleteContent(file):
file.seek(0)
file.truncate()
def getUsrInput():
print ("Insert X coordinate of the column you want to exclude:")
colX=int(input())
print ("Insert Y min:")
fromY=int(input())
print ("Insert Y max:")
toY=int(input())
print("Coordinates:\n X--> "+ str(colX) + "\nY--> From Y= "+str(fromY)+" to Y= "+str(toY))
print("Confirm? Y/N")
usrChoice=input()
if usrChoice.lower() == "y":
return [colX,fromY,toY]
else:
getUsrInput()
def columnToExclude(coord):
for y in range(coord[1],coord[2],1):
textFile.write("("+ str(coord[0]) + "," + str(y) + "),")
def excludeNewColumn():
coordToExclude = getUsrInput()
columnToExclude(coordToExclude)
textFile.write("("+ str(coordToExclude[0]) + "," + str(coordToExclude[2]) + ")")
print("Do you want to exclude a new column? Y/N")
usrChoice=input()
if usrChoice.lower()=="y":
textFile.write(",")
excludeNewColumn()
else:
textFile.write("]")
#EX--> drawingName = [(colX,fromY),(133,481),(133,482),...(133,509),(colX,toY)]
fileToWriteName= "coordToExclude.txt"
drawingToExcludeName = "drawingName"
fromY=0
toY=0
colX =0
print ("Open file: " + fileToWriteName)
textFile = open(fileToWriteName, "a")
print ("Deleting previous file content...")
deleteContent(textFile)
textFile.write(drawingToExcludeName + " = [")
excludeNewColumn()
textFile.close()
print ("Done.")