jw_cad 外部変形 - (495) clispで線を引く -

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

 

clispで線を引く

:clispで線を引く
@echo off
if not exist %~dpn0.lisp (
  for /f "delims=:" %%n in ('findstr /n "^#!" %0') do (
    more +%%n %0 > %~dpn0.lisp
  )
)
clisp %~dpn0.lisp
goto:eof

REM #jww
REM #1-%d 始点を指示してください
REM #2%d 終点を指示してください
REM #e

#!この次の行からプログラムを書いてください
(defmacro while (test &body body)
  `(do ()
   ( (not ,test) )
   ,@body)
)
(with-open-file (f "jwc_temp.txt" :direction :input)
  (while (setq line (read-line f nil))
    (setq a (regexp:regexp-split "\\s\\+" line))
    (if (regexp:match "^hp1" line) (setq p1 (format nil "~A ~A" (nth 1 a) (nth 2 a))) nil)
    (if (regexp:match "^hp2" line) (setq p2 (format nil "~A ~A" (nth 1 a) (nth 2 a))) nil)
  )
  (close f)
)
(with-open-file (f "jwc_temp.txt" :direction :output)
  (write-line (format nil "~A ~A" p1 p2) f)
  (close f)
)

 

 

コンピューター言語の神さまにコメントはいりません。ありがとうございます。