jw_cad 外部変形 - (491) tclshで点を打つ -

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

 

tclshで(線の両端に)点を打つ

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

:tclshで点を打つ
@echo off
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 #1ln 基準線を指示してください
REM #e

#!この次の行からプログラムを書いてください
set tcl_precision 16; #文字列を数値演算するときの有効桁数 16 (デフォルト 12)
set f [open myfiles]
foreach 0 [split [read $f] \n] {
  switch -regexp -- $0 {
    {^[ ]} { set l1 $0 }
  }
}
close $f
scan "$l1" "%s %s %s %s" x1 y1 x2 y2
puts "pt $x1 $y1"
puts "pt $x2 $y2"