jw_cad 外部変形 - (1174) javaでレイヤを取得する(ly) -

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

 

javaでレイヤを取得する(ly)

:javaでレイヤを取得する(ly)
@echo off
if not exist %~dp0Ly.class (
  for /f "delims=:" %%n in ('findstr /n "^#!" %0') do (
    more +%%n %0 > %~dpn0.java
    javac -encoding shift_jis %~dpn0.java
  )
)

copy jwc_temp.txt myfiles > nul
java -Dfile.encoding=shift_jis -classpath %~dp0 Ly > jwc_temp.txt
goto:eof

REM #jww
REM #e

#!この次の行からプログラムを書いてください
import java.io.*;
import java.util.regex.Pattern;

class Ly {
  public static void main(String[] args) {
    try {
      BufferedReader f = new BufferedReader(new FileReader("myfiles"));
      String line;
      String ly, ply;
      ly = ply = "";
      while ( (line = f.readLine()) != null) {
        if (Pattern.compile("^ly[0-9a-f]").matcher(line).find()) {
          ply = line.substring(2, 3);
          if (ly.equals("") || ly.equals(null)) { ly = ply; }
          continue;
        }
      }
      f.close();
      System.out.printf("h#ly=%s\n", ly);
    } catch (IOException e) {
      System.out.println(e);
    }
  }
}