外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
mshtaで2重線を引く(2sen)
:mshtaで2重線を引く(2sen)
@echo off
set w=%1
if exist jwc_temp.txt (
copy jwc_temp.txt myfiles > nul
mshta %~f0 < myfiles > jwc_temp.txt
)
goto:eof
REM #jww
REM #1-%d 始点を指示してください
REM #2%d 終点を指示してください
REM #k 線の幅| 200(L) | 400(R) | 120 | 150 | 180 | 220 | 250 | 300 | 350 |
REM #e
<script>
ENV = new ActiveXObject("WScript.Shell").Environment("Process")
w = "200 200 400 100 125 150 175 250 300 350".split(/\s+/)[ENV('w')] * 1.0
tome = 0 //留線の出
mode = 2 //1=留線 直線、0=なし、2=半円
with (new ActiveXObject("Scripting.FileSystemObject")) {
f = GetStandardStream(0) //stdin
g = GetStandardStream(1) //stdout
while (! f.AtEndOfStream) {
F = ($_ = f.ReadLine()).split(/\s+/)
if (/^hp1-/i .test($_)) { p1 = F.slice(1, 3) }
if (/^hp2 /i .test($_)) { p2 = F.slice(1, 3) }
}
f.Close()
with (Math) {
x1 = p1[0] * 1.0; y1 = p1[1] * 1.0
x2 = p2[0] * 1.0; y2 = p2[1] * 1.0
d = atan2(y2 - y1, x2 - x1)
yw = w / 2 * cos(d)
xw =-w / 2 * sin(d)
xt = tome * cos(d)
yt = tome * sin(d)
x1 = x1 + xt; y1 = y1 + yt
x2 = x2 - xt; y2 = y2 - yt
g.WriteLine( [x1 + xw, y1 + yw, x2 + xw, y2 + yw].join(" ") )
if (w > 0) {
g.WriteLine( [x1 - xw, y1 - yw, x2 - xw, y2 - yw].join(" ") )
if (mode == 1) { //留線 直線
g.WriteLine( [x1 + xw, y1 + yw, x1 - xw, y1 - yw].join(" ") )
g.WriteLine( [x2 + xw, y2 + yw, x2 - xw, y2 - yw].join(" ") )
} else if (mode == 2) { //留線 半円
p = d * 180 / PI + 90
r = w / 2
g.WriteLine( ["ci", x1, y1, r, p, p + 180, 1, 0].join(" ") )
g.WriteLine( ["ci", x2, y2, r, p - 180, p, 1, 0].join(" ") )
}
}
}
}
close()
</script>