untested cleanup
This commit is contained in:
69
main.py
69
main.py
@@ -1,73 +1,42 @@
|
||||
from Plotter import *
|
||||
from Command import *
|
||||
from Program import *
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'generators'))
|
||||
import tkinter as tk
|
||||
from koche import koche
|
||||
|
||||
|
||||
def show(p):
|
||||
win=tk.Tk()
|
||||
win = tk.Tk()
|
||||
win.title('HPGLPLOTTER')
|
||||
plt=Plotter()
|
||||
p=plt.full(p)
|
||||
canvas=tk.Canvas(win,width=600,height=600)
|
||||
canvas.grid(row=0,column=0)
|
||||
plt = Plotter()
|
||||
p = plt.full(p)
|
||||
canvas = tk.Canvas(win, width=600, height=600)
|
||||
canvas.grid(row=0, column=0)
|
||||
x = y = 0
|
||||
for command in p.commands:
|
||||
if command.name == 'PU':
|
||||
x,y = command.x,command.y
|
||||
elif command.name=='PD':
|
||||
canvas.create_line(x,y,command.x,command.y)
|
||||
x,y = command.x,command.y
|
||||
x, y = command.x, command.y
|
||||
elif command.name == 'PD':
|
||||
canvas.create_line(x, y, command.x, command.y)
|
||||
x, y = command.x, command.y
|
||||
elif command.name == 'CI':
|
||||
r=command.args[0]
|
||||
canvas.create_oval(x-r,y-r,x+r,y+r)
|
||||
|
||||
r = command.args[0]
|
||||
canvas.create_oval(x - r, y - r, x + r, y + r)
|
||||
win.mainloop()
|
||||
|
||||
plt=Plotter()
|
||||
p=Program()
|
||||
#p.parsefile('hpgl/luz.hpgl')
|
||||
|
||||
p.parsefile('hpgl/kreis.hpgl')
|
||||
#p=p*10000
|
||||
plt = Plotter()
|
||||
p = Program.parsefile('output/hpgl/kreis.hpgl')
|
||||
|
||||
|
||||
print(plt.winsize[0]*0.025, plt.winsize[1]*0.025)
|
||||
p=plt.full(p)
|
||||
#p=p.flip()
|
||||
#q=q.flip()
|
||||
print(plt.winsize[0] * 0.025, plt.winsize[1] * 0.025)
|
||||
p = plt.full(p)
|
||||
print(p.center)
|
||||
print(plt.center)
|
||||
#q=q+(p.xmax,0)
|
||||
#p=p.rotate(90)
|
||||
p=plt.centralize(p)
|
||||
#p=p-p.center
|
||||
#p=p+(120,120)
|
||||
#q=plt.centralize(q)
|
||||
#q=q+(0,p.ymax*1.05)
|
||||
#p=p+120
|
||||
#p=p.flip()
|
||||
#p=p*0.7
|
||||
#p=p+(959,9128.35)
|
||||
|
||||
#out=out.flip()
|
||||
#out=plt.full(out)
|
||||
#p=p+100
|
||||
#out=plt.centralize(out)
|
||||
#=out+(40,40)
|
||||
#out=p
|
||||
p = plt.centralize(p)
|
||||
print(str(p))
|
||||
print('p.xmin,q.xmin,p.ymin,q.ymin,p.xmax,q.xmax,pymax,q,ymax')
|
||||
|
||||
|
||||
print(len(p))
|
||||
#print str(out)
|
||||
#show(p+q)
|
||||
#show(p)
|
||||
plt.write(p)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user