Showing techical rectangle
Source code name: "tech_rectangle.py"
Programming language: Python
Topic: Graphics/Technical
DMelt Version 1.7. Last modified: 02/08/1971. License: Free
http://datamelt.org/code/cache/tech_rectangle_351.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.


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)