44 lines
839 B
Python
Executable File
44 lines
839 B
Python
Executable File
import sys
|
|
import os
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
from Plotter import *
|
|
from Command import *
|
|
from Program import *
|
|
import Tkinter as tk
|
|
|
|
|
|
def show(p):
|
|
win=tk.Tk()
|
|
win.title('HPGLPLOTTER')
|
|
plt=Plotter((10,10,590,590))
|
|
canvas=tk.Canvas(win,width=600,height=600)
|
|
canvas.grid(row=0,column=0)
|
|
x = y = 0
|
|
p=p.flip()
|
|
p=plt.full(p)
|
|
p=plt.centralize(p)
|
|
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
|
|
elif command.name == 'CI':
|
|
r=command.args[0]
|
|
canvas.create_oval(x-r,y-r,x+r,y+r)
|
|
win.mainloop()
|
|
|
|
plt = Plotter()
|
|
p = Program.parsefile('output/hpgl/Lars.plt')
|
|
p=p.flip()
|
|
p=plt.full(p)
|
|
p=plt.centralize(p)
|
|
plt.write(p)
|
|
|
|
#show(p)
|
|
p=p+10
|
|
|
|
|
|
|
|
|