jw_cad 外部変形 - (494) tclshで円を点に変換する -

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

 

tclshで円を点に変換する

tclsh.exe は tcl のスクリプトを実行するツールです。

:tclshで円を点に変換する
@echo off
set ci=円を残す
:set ci=円を残さない
for /f "delims=:" %%n in ('findstr /n "^#!" %0') do (
  copy jwc_temp.txt myfiles > nul
  more +%%n %0 | C:\ActiveTcl\bin\tclsh - > jwc_temp.txt
)
goto:eof

REM #jww
REM #h1
REM #g1
REM #hc 円を選択してください
REM #e

#!この次の行からプログラムを書いてください
set f [open myfiles]
foreach 0 [split [read $f] \n] {
  switch -regexp -- $0 {
    ^ci {
      lassign $0 1 2 3
      set NF [llength $0]
      if {$NF == 4} { puts "pt $2 $3" }
      if {$env(ci) == "円を残す"} { puts $0 }
      continue
    }
    ^hq { puts "hd"; continue }
    . { puts $0 }
  }
}
close $f