43 lines
1.1 KiB
Python
Executable File
43 lines
1.1 KiB
Python
Executable File
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.title('HPGLPLOTTER')
|
|
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
|
|
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/kreis.hpgl')
|
|
|
|
print(plt.winsize[0] * 0.025, plt.winsize[1] * 0.025)
|
|
p = plt.full(p)
|
|
print(p.center)
|
|
print(plt.center)
|
|
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))
|
|
plt.write(p)
|