from jhplot import *
from net.sf.drawj2d import Drawj2d
f="drawing.hcl"
out="/home/sergei/work/dmelt/Drawj2d/drawing.svg"
s="""
# variables
set dx 50
set dy 20
# draw
moveto 20 10
label P NW
rectangle $dx $dy
pen 0.35 red
arrowrel $dx $dy
label Q SE
# dimension lines
pen black
moveto 20 42
dimlinerel $dx 0
moveto 82 10
dimlinerel 0 $dy
"""
with open(f, "w") as xfile:
xfile.write(s)
args=["-T" "svg", "-W", "100", "-H", "60", "-o", out, f]
c=Drawj2d.Run(args)
IViewSVG(out)