jw_cad 外部変形 - (647) コマンドプロンプトで指示文字を確認する(ch) -

外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。

 

コマンドプロンプトで指示文字を確認する(ch)

/* コマンドプロンプトで指示文字を確認する(ch)
@cls & echo off
copy jwc_temp.txt myfiles > nul
cscript //nologo //e:jscript %0 < myfiles > jwc_temp.txt
goto:eof

REM #jww
REM #1%dch 文字を指示してください
REM #99#
REM #e
*/

hp =
ch =

i = 0
with (WScript) {
  f = StdIn
  while (! f.AtEndOfStream) {
    $_ = f.ReadLine()
    if (/^hp(\d+)ch-?\s+(\S+ \S+)/i .test($_)) {
      hp[RegExp.$1 * 1] = RegExp.$2
      continue
    }
    if (/^hhp(\d+)ch/i .test($_)) {
      i = RegExp.$1 * 1
      continue
    }
    if (/^(c[hvsroptkz2]\s+\S+ \S+ \S+ \S+) (.+)/i .test($_)) {
      str = (RegExp.$2).slice(1)
      ch[i] = (RegExp.$1).split(/\s+/)
      ch[i][5] = str
      //ch[i][5] = $_.split('"')[1]
      x1 = ch[i][1] * 1.0
      y1 = ch[i][2] * 1.0
      lx = ch[i][3] * 1.0
      ly = ch[i][4] * 1.0
      a = Math.atan2(ly, lx)
      l = Math.sqrt(lx * lx + ly * ly)
      x2 = x1 + l * Math.cos(a)
      y2 = y1 + l * Math.sin(a)
      echo([x1, y1, x2, y2].join(" "))
      continue
    }
  }
}

 

 

外部変形のバッチファイルの構成は以下のとおりです。
/* タイトル
@cls & echo off
コマンドによるスクリプト
goto:eof
*/
jscriptによるスクリプト
=>コマンドによるスクリプトは jscript のコメント文に記述しています。