@REM 連番作図(引出線付バルーン)
@echo off
REM #jww
REM #cd
REM #h0
REM #c最初の記入番号を入力
REM #h/連番2.bat
REM #1-
REM #2-
REM #e
copy jwc_temp.txt temp.txt > nul
ruby -Ks 連番1.rb temp.txt %1 > jwc_temp.txt
○バッチファイル(ファイル名 連番2.bat)
@REM 連番作図(引出線付バルーン)
@echo off
REM #jww
REM #cd
REM #h0
REM #1-
REM #2-
REM #hr
REM #e
copy jwc_temp.txt temp.txt > nul
ruby -Ks 連番2.rb temp.txt > jwc_temp.txt
○スクリプトファイル(ファイル名 連番1.rb)
BEGIN{
$no=ARGV[1]
while ARGV.length > 1
ARGV.pop
end
$by=Array.new;$hcw=Array.new
$hch=Array.new;$hcd=Array.new
}
def main
while ARGF.gets
xy =split
if xy[0] =~ /^hs/
n=1;while (nend
if xy[0] =~ /^lg/
$lg=xy[0].delete("lg");$zusun=$by[$lg.to_i]
end
if xy[0] =~ /^hcw/
m=1;while (mend
end
if xy[0] =~ /^hch/
l=1;while (lend
if xy[0] =~ /^hcd/
s=1;while (send
if xy[0] =~ /^cn/ && xy[0] =~ /[0-9]$/
$cn=xy[0].delete("cn")
$mojiw=$hcw[$cn.to_i-1]/2
$mojih=$hch[$cn.to_i-1]
$mojid=$hcd[$cn.to_i-1]
end
if xy[0] =~ /^hp1-/
x1=xy[1].to_f
y1=xy[2].to_f
end
if xy[0] =~ /^hp2-/
x2=xy[1].to_f
y2=xy[2].to_f
end
end
$xy=Math.sqrt((x2-x1)**2+(y2-y1)**2)
dx=(x2-x1)/$xy
dy=(y2-y1)/$xy
mojin=$no.size
if mojin==1;r=($mojih+1)/2*$zusun
elsif mojin==2;r=($mojih+1)/1.5*$zusun
else;r=($mojih+1)*$zusun
end
naname(x1,y1,x2-r*dx,y2-r*dy)
naname(x1,y1,x1+2*$zusun*dx+0.52*$zusun*dy,
y1+2*$zusun*dy-0.52*$zusun*dx)
naname(x1,y1,x1+2*$zusun*dx-0.52*$zusun*dy,
y1+2*$zusun*dy+0.52*$zusun*dx)
printf("ci %e %e %e \n",x2,y2,r)
printf("ch %e %e %e %e\"%s\n",x2-mojin*($mojiw/2)*$zusun,y2-($mojih/2)*$zusun,1,0,$no)
text=$no;nlines = 0;File.open("連番.txt","w"){|file|
text.each{|line|;file.puts line
nlines += 1;};}
end
def naname(x1,y1,x2,y2)
printf("%e %e %e %e\n", x1, y1, x2, y2)
end
main()
○スクリプトファイル(ファイル名 連番2.rb)
BEGIN{
File.foreach("連番.txt","r") do |line|
$foo=line.split(/\n/)
$no=$foo[0].succ
end
$by=Array.new;$hcw=Array.new
$hch=Array.new;$hcd=Array.new
}
def main
while ARGF.gets
xy =split
if xy[0] =~ /^hs/
n=1;while (nend
if xy[0] =~ /^lg/;$lg=xy[0].delete("lg")
$zusun=$by[$lg.to_i]
end
if xy[0] =~ /^hcw/
m=1;while (mend
if xy[0] =~ /^hch/
l=1;while (lend
if xy[0] =~ /^hcd/
s=1;while (send
if xy[0] =~ /^cn/ && xy[0] =~ /[0-9]$/
$cn=xy[0].delete("cn")
$mojiw=$hcw[$cn.to_i-1]/2
$mojih=$hch[$cn.to_i-1]
$mojid=$hcd[$cn.to_i-1]
end
if xy[0] =~ /^hp1-/
x1=xy[1].to_f
y1=xy[2].to_f
end
if xy[0] =~ /^hp2-/
x2=xy[1].to_f
y2=xy[2].to_f
end
end
$xy=Math.sqrt((x2-x1)**2+(y2-y1)**2)
dx=(x2-x1)/$xy;dy=(y2-y1)/$xy;mojin=$no.size
if mojin==1;r=($mojih+1)/2*$zusun
elsif mojin==2;r=($mojih+1)/1.5*$zusun
else;r=($mojih+1)*$zusun
end
naname(x1,y1,x2-r*dx,y2-r*dy)
naname(x1,y1,x1+2*$zusun*dx+0.52*$zusun*dy,
y1+2*$zusun*dy-0.52*$zusun*dx)
naname(x1,y1,x1+2*$zusun*dx-0.52*$zusun*dy,
y1+2*$zusun*dy+0.52*$zusun*dx)
printf("ci %e %e %e \n",x2,y2,r)
printf("ch %e %e %e %e\"%s\n",x2-mojin*($mojiw/2)*$zusun,y2-($mojih/2)*$zusun,1,0,$no)
text=$no;nlines = 0;File.open("連番.txt","w"){|file|
text.each{|line|;file.puts line
nlines += 1;};}
end
def naname(x1,y1,x2,y2)
printf("%e %e %e %e\n", x1, y1, x2, y2)
end
main()
@REM JWW起動BAT(もうひとつのJWW起動)
@echo off
REM #jww
REM #cd
REM #e
echo # > jwc_temp.txt
del jwc_temp.txt
start Jw_win.exe
echo h#もうひとつの Jw_cad を起動しました > jwc_temp.txt
goto end
:END
BEGIN{
$no=ARGV[1]
while ARGV.length > 1
ARGV.pop
end
$by=Array.new;$hcw=Array.new
$hch=Array.new;$hcd=Array.new
}
def main
while ARGF.gets
xy =split
if xy[0] =~ /^hs/
n=1;while (nend
if xy[0] =~ /^lg/
$lg=xy[0].delete("lg");$zusun=$by[$lg.to_i]
end
if xy[0] =~ /^hcw/
m=1;while (mend
end
if xy[0] =~ /^hch/
l=1;while (lend
if xy[0] =~ /^hcd/
s=1;while (send
if xy[0] =~ /^cn/ && xy[0] =~ /[0-9]$/
$cn=xy[0].delete("cn")
$mojiw=$hcw[$cn.to_i-1]/2
$mojih=$hch[$cn.to_i-1]
$mojid=$hcd[$cn.to_i-1]
end
if xy[0] =~ /^hp1-/
x1=xy[1].to_f
y1=xy[2].to_f
end
if xy[0] =~ /^hp2-/
x2=xy[1].to_f
y2=xy[2].to_f
end
end
$xy=Math.sqrt((x2-x1)**2+(y2-y1)**2)
dx=(x2-x1)/$xy
dy=(y2-y1)/$xy
mojin=$no.size
tango=$no.split('')
if tango[0].size==1
if mojin%2==0
mojil=mojin*$mojiw+$mojid*(mojin-1.5)
else
mojil=mojin*$mojiw+$mojid*(mojin-2)
end
else
mojil=mojin*$mojiw+$mojid*(mojin-2)/2
end
if mojin==1;r=($mojih+2)/2*$zusun
elsif mojin==2;r=(mojil+2)/1.75*$zusun
elsif mojin==3;r=(mojil+2)/1.75*$zusun
else;r=(mojil+2)*$zusun/2
end
if r+2*$zusun < $xy
naname(x1,y1,x2-r*dx,y2-r*dy)
naname(x1,y1,x1+2*$zusun*dx+0.52*$zusun*dy,
y1+2*$zusun*dy-0.52*$zusun*dx)
naname(x1,y1,x1+2*$zusun*dx-0.52*$zusun*dy,
y1+2*$zusun*dy+0.52*$zusun*dx)
end
printf("ci %e %e %e \n",x2,y2,r)
printf("ch %e %e %e %e\"%s\n",x2-mojil*$zusun/2,y2-($mojih/2)*$zusun,1,0,$no)
text=$no;nlines = 0;File.open("連番.txt","w"){|file|
text.each{|line|;file.puts line
nlines += 1;};}
end
def naname(x1,y1,x2,y2)
printf("%e %e %e %e\n", x1, y1, x2, y2)
end
main()
○スクリプトファイル(ファイル名 連番2.rb)
BEGIN{
File.foreach("連番.txt","r") do |line|
$foo=line.split(/\n/)
$no=$foo[0].succ
end
$by=Array.new;$hcw=Array.new
$hch=Array.new;$hcd=Array.new
}
def main
while ARGF.gets
xy =split
if xy[0] =~ /^hs/
n=1;while (nend
if xy[0] =~ /^lg/;$lg=xy[0].delete("lg")
$zusun=$by[$lg.to_i]
end
if xy[0] =~ /^hcw/
m=1;while (mend
if xy[0] =~ /^hch/
l=1;while (lend
if xy[0] =~ /^hcd/
s=1;while (send
if xy[0] =~ /^cn/ && xy[0] =~ /[0-9]$/
$cn=xy[0].delete("cn")
$mojiw=$hcw[$cn.to_i-1]/2
$mojih=$hch[$cn.to_i-1]
$mojid=$hcd[$cn.to_i-1]
end
if xy[0] =~ /^hp1-/
x1=xy[1].to_f
y1=xy[2].to_f
end
if xy[0] =~ /^hp2-/
x2=xy[1].to_f
y2=xy[2].to_f
end
end
$xy=Math.sqrt((x2-x1)**2+(y2-y1)**2)
dx=(x2-x1)/$xy;dy=(y2-y1)/$xy;mojin=$no.size
tango=$no.split('')
if tango[0].size==1
if mojin%2==0
mojil=mojin*$mojiw+$mojid*(mojin-1.5)
else
mojil=mojin*$mojiw+$mojid*(mojin-2)
end
else
mojil=mojin*$mojiw+$mojid*(mojin-2)/2
end
if mojin==1;r=($mojih+2)/2*$zusun
elsif mojin==2;r=(mojil+2)/1.75*$zusun
elsif mojin==3;r=(mojil+2)/1.75*$zusun
else;r=(mojil+2)*$zusun/2
end
if r+2*$zusun < $xy
naname(x1,y1,x2-r*dx,y2-r*dy)
naname(x1,y1,x1+2*$zusun*dx+0.52*$zusun*dy,
y1+2*$zusun*dy-0.52*$zusun*dx)
naname(x1,y1,x1+2*$zusun*dx-0.52*$zusun*dy,
y1+2*$zusun*dy+0.52*$zusun*dx)
end
printf("ci %e %e %e \n",x2,y2,r)
printf("ch %e %e %e %e\"%s\n",x2-mojil*$zusun/2,y2-($mojih/2)*$zusun,1,0,$no)
text=$no;nlines = 0;File.open("連番.txt","w"){|file|
text.each{|line|;file.puts line
nlines += 1;};}
end
def naname(x1,y1,x2,y2)
printf("%e %e %e %e\n", x1, y1, x2, y2)
end
main()
BEGIN{
$no=ARGV[1]
while ARGV.length > 1
ARGV.pop
end
$by=Array.new;$hcw=Array.new
$hch=Array.new;$hcd=Array.new
}
def main
while ARGF.gets
xy =split
if xy[0] =~ /^hs/
n=1;while (nend
if xy[0] =~ /^lg/
$lg=xy[0].delete("lg");$zusun=$by[$lg.to_i]
end
if xy[0] =~ /^hcw/
m=1;while (mend
end
if xy[0] =~ /^hch/
l=1;while (lend
if xy[0] =~ /^hcd/
s=1;while (send
if xy[0] =~ /^cn/ && xy[0] =~ /[0-9]$/
$cn=xy[0].delete("cn")
$mojiw=$hcw[$cn.to_i-1]
$mojih=$hch[$cn.to_i-1]
$mojid=$hcd[$cn.to_i-1]
end
if xy[0] =~ /^hp1-/
x1=xy[1].to_f
y1=xy[2].to_f
end
if xy[0] =~ /^hp2-/
x2=xy[1].to_f
y2=xy[2].to_f
end
end
$xy=Math.sqrt((x2-x1)**2+(y2-y1)**2)
dx=(x2-x1)/$xy
dy=(y2-y1)/$xy
tango=$no.split('')
mojin=tango.size
if tango[0].size==1
mojil=mojin*$mojiw/2+$mojid/2*(mojin-1)
else
mojil=mojin*$mojiw+$mojid*(mojin-1)
end
if mojin==1;r=($mojih+2)/2*$zusun
elsif mojin==2;r=(mojil+2)/1.75*$zusun
elsif mojin>=3;r=(mojil+2)/2*$zusun
end
if r+2*$zusun < $xy
naname(x1,y1,x2-r*dx,y2-r*dy)
naname(x1,y1,x1+2*$zusun*dx+0.52*$zusun*dy,
y1+2*$zusun*dy-0.52*$zusun*dx)
naname(x1,y1,x1+2*$zusun*dx-0.52*$zusun*dy,
y1+2*$zusun*dy+0.52*$zusun*dx)
end
printf("ci %e %e %e \n",x2,y2,r)
printf("ch %e %e %e %e\"%s\n",x2-mojil*$zusun/2,y2-($mojih/2)*$zusun,1,0,$no)
text=$no;nlines = 0;File.open("連番.txt","w"){|file|
text.each{|line|;file.puts line
nlines += 1;};}
end
def naname(x1,y1,x2,y2)
printf("%e %e %e %e\n", x1, y1, x2, y2)
end
main()
○スクリプトファイル(ファイル名 連番2.rb)
BEGIN{
File.foreach("連番.txt","r") do |line|
$foo=line.split(/\n/)
$no=$foo[0].succ
end
$by=Array.new;$hcw=Array.new
$hch=Array.new;$hcd=Array.new
}
def main
while ARGF.gets
xy =split
if xy[0] =~ /^hs/
n=1;while (nend
if xy[0] =~ /^lg/;$lg=xy[0].delete("lg")
$zusun=$by[$lg.to_i]
end
if xy[0] =~ /^hcw/
m=1;while (mend
if xy[0] =~ /^hch/
l=1;while (lend
if xy[0] =~ /^hcd/
s=1;while (send
if xy[0] =~ /^cn/ && xy[0] =~ /[0-9]$/
$cn=xy[0].delete("cn")
$mojiw=$hcw[$cn.to_i-1]
$mojih=$hch[$cn.to_i-1]
$mojid=$hcd[$cn.to_i-1]
end
if xy[0] =~ /^hp1-/
x1=xy[1].to_f
y1=xy[2].to_f
end
if xy[0] =~ /^hp2-/
x2=xy[1].to_f
y2=xy[2].to_f
end
end
$xy=Math.sqrt((x2-x1)**2+(y2-y1)**2)
dx=(x2-x1)/$xy;dy=(y2-y1)/$xy
tango=$no.split('')
mojin=tango.size
if tango[0].size==1
mojil=mojin*$mojiw/2+$mojid/2*(mojin-1)
else
mojil=mojin*$mojiw+$mojid*(mojin-1)
end
if mojin==1;r=($mojih+2)/2*$zusun
elsif mojin==2;r=(mojil+2)/1.75*$zusun
elsif mojin>=3;r=(mojil+2)/2*$zusun
end
if r+2*$zusun < $xy
naname(x1,y1,x2-r*dx,y2-r*dy)
naname(x1,y1,x1+2*$zusun*dx+0.52*$zusun*dy,
y1+2*$zusun*dy-0.52*$zusun*dx)
naname(x1,y1,x1+2*$zusun*dx-0.52*$zusun*dy,
y1+2*$zusun*dy+0.52*$zusun*dx)
end
printf("ci %e %e %e \n",x2,y2,r)
printf("ch %e %e %e %e\"%s\n",x2-mojil*$zusun/2,y2-($mojih/2)*$zusun,1,0,$no)
text=$no;nlines = 0;File.open("連番.txt","w"){|file|
text.each{|line|;file.puts line
nlines += 1;};}
end
def naname(x1,y1,x2,y2)
printf("%e %e %e %e\n", x1, y1, x2, y2)
end
main()