外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
jscriptで線長を計算する(lnlength)
/* jscriptで線長を計算する(lnlength)
@cls & echo off
copy jwc_temp.txt myfiles > nul
cscript //nologo //e:jscript %0 < myfiles > jwc_temp.txt
goto:eof
REM #jww
REM #1ln 基準線を指示してください
REM #e
*/
function hex(x){
// return x < 10 ? x : x.toString(16)
if (x == 10) return "a";
if (x == 11) return "b";
if (x == 12) return "c";
if (x == 13) return "d";
if (x == 14) return "e";
if (x == 15) return "f";
return x
}
hs = []
lg = ""
l = 0
f = WScript.StdIn
while (! f.AtEndOfStream) {
F = ($_ = f.ReadLine()).split(/\s+/)
if (/^hs/i .test($_)) { //hs スケール
str = F.slice(1)
for (i in str) hs[hex(i)] = str[i] * 1.0;
}
if (/^lg[A-F0-9]/i .test($_)) { //lg レイヤグループ
plg = $_.substr(2, 1).toLowerCase(); if (lg == "") lg = plg;
}
if (/^\s+/i .test($_)) { //ln 指示線
p = hs[lg] / hs[plg]
lx = F[2] - F[0]
ly = F[3] - F[1]
l += Math.sqrt(lx * lx + ly * ly) * p
}
}
g = WScript.StdOut
g.WriteLine("h#線長 L = " + l.toFixed(3))
// WScript.Echo("h#線長 L = " + l.toFixed(3))