jw_cad 外部変形 - (1052) tclshでスケールを取得する(hs) -

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

 

tclshでスケールを取得する(hs)

:tclshでスケールを取得する(hs)
@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 #e

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

set f [open myfiles]
foreach 0 [split [read $f] \n] {
  switch -regexp -- $0 {
    ^hs {
      for {set i 0} {$i <= 15} {incr i} {
        set hs([format "%x" $i]) [lindex $0 [expr $i + 1]]
      }
      continue
    }
    ^lg[0-9a-f] {
      set plg [string index $0 2]
      if {$lg == ""} {set lg $plg}
      puts "h#S=1/$hs($lg)"
      #puts "[format "h#S=1/%.01f" $hs($lg)]"
    }
  }
}
close $f