jw_cad 外部変形 - (1067) tclshで指示文字を確認する(ch) -

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

 

tclshで指示文字を確認する(ch)

:tclshで指示文字を確認する(ch)
@echo off
for /f "delims=:" %%n in ('findstr /n "^#!" %0') do (
  copy jwc_temp.txt myfiles > nul
  more +%%n %0 | tclsh - > jwc_temp.txt
)
goto:eof

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

#!この次の行からプログラムを書いてください
set tcl_precision 16; #文字列を数値演算するとき有効桁数 16 (デフォルト 12)

set f [open myfiles]
foreach 0 [split [read $f] \n] {
  switch -regexp -matchvar n -- $0 {
    ^hq {
      puts "hd"
      continue
    }
    {^hp(\d+)} {
      set hpn [lindex $n 1]
      set hp($hpn) [lrange $0 1 2]
      continue
    }
    {^hhp(\d+)ch} {
      set chn [lindex $n 1]
      continue
    }
    ^c[hvsroptkz2] {
      set i [string first \" $0]
      set str [string range $0 [expr $i+1] end]
      scan $0 "%s %g %g %g %g" 1 2 3 4 5
      set x1 $2
      set y1 $3
      set lx $4
      set ly $5
      set ch($chn) "$1 $x1 $y1 $lx $ly \"$str"
      set d [expr atan2($ly, $lx)]
      set l [expr hypot($lx, $ly)]
      set x2 [expr $x1 + $l * cos($d)]
      set y2 [expr $y1 + $l * sin($d)]
      puts "$x1 $y1 $x2 $y2"
      puts $0
      continue
    }
    . { puts $0 }
  }
}
close $f