外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
mshtaで点と点マーカを円に変換する
:mshtaで点と点マーカを円に変換する
@echo off
set pt=点を残す
:set pt=点を残さない
set r=10
if exist jwc_temp.txt (
copy jwc_temp.txt myfiles > nul
mshta %~f0 < myfiles > jwc_temp.txt
)
goto:eof
REM #jww
REM #h1
REM #g1
REM #hc 点と点マーカを選択してください
REM #bz
REM #e
<script>
/*
点を円に変換する / JW_CAD 外部変形
*/
ENV = new ActiveXObject("WScript.Shell").Environment("Process")
r = ENV("r") ? ENV("r") : 10
with (new ActiveXObject("Scripting.FileSystemObject")) {
f = GetStandardStream(0) //stdin
g = GetStandardStream(1) //stdout
while (! f.AtEndOfLine) {
line = f.ReadLine()
if (/^pt/ .test(line)) {
str = line.split(/\s+/)
if (str.length == 3) {
g.WriteLine(line.replace( /^pt/,"ci" ).split(/\s+/).join(" ")+" "+r)
if (ENV("pt") == "点を残す") { g.WriteLine(line) } // 点を復帰する
} else {
g.WriteLine(line.replace( /^pt/,"ci" ).split(/\s+/).slice(0, 3).join(" ")+" "+r)
if (ENV("pt") == "点を残す") { g.WriteLine(line) } // 点マーカを復帰する
}
} else {
if (/^hq/ .test(line)) {
g.WriteLine("hd")
} else {
g.WriteLine(line) // hq を除き 復帰する
}
}
}
f.Close()
g.Close()
}
close()
</script>