@rem 格子状直線のタイル変換(斜線は未対応)
@echo off
REM #jww
REM #cd
REM #c面取寸法
REM #c目地寸法
REM #h1
REM #hc面取する矩形を選択してください
REM #e
copy jwc_temp.txt temp.txt > nul
cscript //nologo 格子タイル.rb temp.txt %1 %2> jwc_temp.txt
◎スクリプトファイル(ファイル名 格子タイル.rb)
# 格子状直線を割付タイルに変換 外部変形Rubyスクリプト
BEGIN{
print "hd\n" # 選択したデータの削除
$tate=Array.new
$tatey1=Array.new
$tatey2=Array.new
$yoko=Array.new
$yokox1=Array.new
$yokox2=Array.new
$lyy=Array.new;$lyt=Array.new
$lcy=Array.new;$lct=Array.new
$lty=Array.new;$ltt=Array.new
$men = ARGV[1].to_f #面取寸法
$meji = ARGV[2].to_f/2 #目地寸法
while ARGV.length > 1
ARGV.pop
end
}
def main
while ARGF.gets
xy =split
if xy[0]=~/^pt|^ch|^cs|^cn/;print $_;end
if xy[0]=~/^ly/;$senly=xy[0];end
if xy[0]=~/^lc/;$senlc=xy[0];end
if xy[0]=~/^lt/;$senlt=xy[0];end
if xy[0]=~ /^[0-9]|^-/
xy.collect!{ |item| item.to_f }# 数値化
if xy[0]==xy[2]
if xy[3] < xy[1];y=xy[3];xy[3]=xy[1];xy[1]=y;end
$tate.push(xy[0]);$tatey1.push(xy[1]);$tatey2.push(xy[3])
$lyt.push($senly);$lct.push($senlc);$ltt.push($senlt)
elsif xy[1]==xy[3]
if xy[2] < xy[0];x=xy[2];xy[2]=xy[0];xy[0]=x;end
$yoko.push(xy[1]);$yokox1.push(xy[0]);$yokox2.push(xy[2])
$lyy.push($senly);$lcy.push($senlc);$lty.push($senlt)
else;print $senly+"\n";print $senlc+"\n";print $senlt+"\n";print $_
end
end
end
$yo=$yoko.sort;$yox1=$yokox1.sort;$yox2=$yokox2.sort
$ta=$tate.sort;$tay1=$tatey1.sort;$tay2=$tatey2.sort
m=-1;while (m < $ta.size-2);m += 1
o=-1;while (o < $yo.size-2);o += 1
yokosen($ta[m]+$meji+$men,$ta[m+1]-$meji-$men,$yo[o]+$meji)
yokosen($ta[m]+$meji+$men,$ta[m+1]-$meji-$men,$yo[o+1]-$meji)
end
end
n=-1;while (n < $yo.size-2);n += 1
p=-1;while (p < $ta.size-2);p += 1
tatesen($yo[n]+$meji+$men,$yo[n+1]-$meji-$men,$ta[p]+$meji)
tatesen($yo[n]+$meji+$men,$yo[n+1]-$meji-$men,$ta[p+1]-$meji)
end
end
q=-1;while (q < $ta.size-2);q += 1
r=-1;while (r < $yo.size-2);r += 1
enko ($ta[q]+$meji+$men,$yo[r]+$meji+$men,$men,180)
end
end
s=-1;while (s < $ta.size-2);s += 1
t=0;while (t < $yo.size-1);t += 1
enko ($ta[s]+$meji+$men,$yo[t]-$meji-$men,$men,90)
end
end
u=0;while (u < $ta.size-1);u += 1
v=0;while (v < $yo.size-1);v += 1
enko ($ta[u]-$meji-$men,$yo[v]-$meji-$men,$men,0)
end
end
w=0;while (w < $ta.size-1);w += 1
ww=-1;while (ww < $yo.size-2);ww += 1
enko ($ta[w]-$meji-$men,$yo[ww]+$meji+$men,$men,270)
end
end
end
def yokosen( x1,x2, y1)
printf("%e %e %e %e\n", x1, y1, x2, y1)
end
def tatesen( y1,y2, x1)
printf("%e %e %e %e\n", x1, y1, x1, y2)
end
def enko( x,y,r,ziku)
printf("ci %e %e %e %e %e %e %e\n",x,y,r,0,90,1,ziku)
end
main()