@REM 配線条数記号の作図
@echo off
REM #jww
REM #cd
REM #h0
REM #c条数の入力 無指定:2/_/a
REM #1ln作図点(線上)を指示してください
REM #99#
REM #bz
REM #e
copy jwc_temp.txt temp.txt > nul
ruby -Ks 条数.rb temp.txt %1 > jwc_temp.txt
include Math
puts "bz";hhp=[];sen=[];picth=1.0;l=3.0;arg=60*2*PI/360;zyousu=2
while ARGV.size > 1
case argument=ARGV.pop
when /\/a/
zyousu = argument[2..-1].to_i
end
end
while ARGF.gets
xy=split
if xy[0]=~/^hp\d+ln/
hhp<<[xy[1].to_f,xy[2].to_f]
end
if xy[0]=~/^\d|^-/
xy.collect!{|item|item.to_f}
if xy[0]>xy[2]
xy[0],xy[2],xy[1],xy[3]=xy[2],xy[0],xy[3],xy[1]
elsif xy[0]==xy[2]
xy[1],xy[3]=xy[3],xy[1] if xy[1]>xy[3]
end
sen< end
end
if zyousu==1 or zyousu%2==1
x=x1+(xl-picth*(zyousu/2))*cos(sen_arg)
y=y1+(xl-picth*(zyousu/2))*sin(sen_arg)
else
x=x1+(xl-picth*(zyousu/2)-picth/2)*cos(sen_arg)
y=y1+(xl-picth*(zyousu/2)-picth/2)*sin(sen_arg)
end
zyousu.times{
if item[0]==item[2]
x1=x+l/2*cos(PI+arg+sen_arg)
x2=x+l/2*cos(arg+sen_arg)
y1=y-l/2*sin(PI+arg+sen_arg)
y2=y-l/2*sin(arg+sen_arg)
else
x1=x+l/2*cos(PI+arg+sen_arg)
x2=x+l/2*cos(arg+sen_arg)
y1=y+l/2*sin(PI+arg+sen_arg)
y2=y+l/2*sin(arg+sen_arg)
end
printf("%.11f %.11f %.11f %.11f\n",x1,y1,x2,y2)
x += picth*cos(sen_arg)
y += picth*sin(sen_arg)
@REM 配線条数記号の作図
@echo off
REM #jww
REM #cd
REM #h0
REM #c条数の入力 無指定:2/_/a
REM #k|1)アース無(L)|2)アース付(R)|/_/b
REM #1ln作図点(線上)を指示してください
REM #99#
REM #bz
REM #e
copy jwc_temp.txt temp.txt > nul
ruby -Ks 条数.rb temp.txt %1 %2 > jwc_temp.txt
◎スクリプトファイル(ファイル名 条数.rb)
include Math
puts "bz";hhp=[];sen=[];picth=1.0;l=3.0;arg=60*2*PI/360;zyousu=2
while ARGV.size > 1
case argument=ARGV.pop
when /\/a/
zyousu = argument[2..-1].to_i
when /\/b/
earth = argument[2..-1]
end
end
while ARGF.gets
xy=split
if xy[0]=~/^hp\d+ln/
hhp<<[xy[1].to_f,xy[2].to_f]
end
if xy[0]=~/^\d|^-/
xy.collect!{|item|item.to_f}
if xy[0]>xy[2]
xy[0],xy[2],xy[1],xy[3]=xy[2],xy[0],xy[3],xy[1]
elsif xy[0]==xy[2]
xy[1],xy[3]=xy[3],xy[1] if xy[1]>xy[3]
end
sen< end
end
sen.each_with_index{|item,i|
hhpx=hhp[i][0];hhpy=hhp[i][1]
x1=item[0];y1=item[1];x2=item[2];y2=item[3]
sen_arg=atan2(y2-y1,x2-x1)
hpx=hhpx-x1;hpy=hhpy-y1
hpxy=sqrt(hpy**2+hpx**2)
hp_arg=atan2(hpy,hpx)
henkaku=hp_arg-sen_arg
xl=hpxy*cos(henkaku)
if zyousu==1 or zyousu%2==1
x=x1+(xl-picth*(zyousu/2))*cos(sen_arg)
y=y1+(xl-picth*(zyousu/2))*sin(sen_arg)
else
x=x1+(xl-picth*(zyousu/2)-picth/2)*cos(sen_arg)
y=y1+(xl-picth*(zyousu/2)-picth/2)*sin(sen_arg)
end
n=0
zyousu.times{
if zyousu==4
if n%2 ==0
x += picth*cos(sen_arg)
y += picth*sin(sen_arg)
end
else
if n%3 ==0
x += picth*cos(sen_arg)
y += picth*sin(sen_arg)
end
end
if item[0]==item[2]
x1=x+l/2*cos(PI-arg+sen_arg)
x2=x+l/2*cos(-arg+sen_arg)
y1=y+l/2*sin(PI-arg+sen_arg)
y2=y+l/2*sin(-arg+sen_arg)
else
x1=x+l/2*cos(PI+arg+sen_arg)
x2=x+l/2*cos(arg+sen_arg)
y1=y+l/2*sin(PI+arg+sen_arg)
y2=y+l/2*sin(arg+sen_arg)
end
x += picth*cos(sen_arg)
y += picth*sin(sen_arg)
printf("%.11f %.11f %.11f %.11f\n",x1,y1,x2,y2)
n += 1
}
if earth == "2"
x += 1.5*picth*cos(sen_arg)
y += 1.5*picth*sin(sen_arg)
if item[0]==item[2]
x1=x+l/2*cos(PI+arg+sen_arg)
x2=x+l/2*cos(arg+sen_arg)
y1=y+l/2*sin(PI+arg+sen_arg)
y2=y+l/2*sin(arg+sen_arg)
else
x1=x+l/2*cos(PI-arg+sen_arg)
x2=x+l/2*cos(-arg+sen_arg)
y1=y+l/2*sin(PI-arg+sen_arg)
y2=y+l/2*sin(-arg+sen_arg)
end
printf("%.11f %.11f %.11f %.11f\n",x1,y1,x2,y2)
end
}
@REM 配線条数記号の作図
@echo off
REM #jww
REM #cd
REM #h0
REM #c条数の入力 無指定:2/_/a
REM #k|1)アース無(L)|2)アース付(R)|/_/b
REM #c倍率 無指定:1/_/c
REM #1ln作図点(線上)を指示してください
REM #99#
REM #bz
REM #e
copy jwc_temp.txt temp.txt > nul
ruby -Ks 条数.rb temp.txt %1 %2 %3 > jwc_temp.txt
include Math
puts "bz";hhp=[];sen=[];picth=1.0;l=3.0;arg=60*2*PI/360;zyousu=2;by=1
while ARGV.size > 1
case argument=ARGV.pop
when /\/a/
zyousu = argument[2..-1].to_i
when /\/b/
earth = argument[2..-1]
when /\/c/
by = argument[2..-1].to_f
end
end
picth *=by;l *= by
while ARGF.gets
xy=split
if xy[0]=~/^hp\d+ln/
hhp<<[xy[1].to_f,xy[2].to_f]
end
if xy[0]=~/^\d|^-/
xy.collect!{|item|item.to_f}
if xy[0]>xy[2]
xy[0],xy[2],xy[1],xy[3]=xy[2],xy[0],xy[3],xy[1]
elsif xy[0]==xy[2]
xy[1],xy[3]=xy[3],xy[1] if xy[1]>xy[3]
end
sen< end
end
sen.each_with_index{|item,i|
hhpx=hhp[i][0];hhpy=hhp[i][1]
x1=item[0];y1=item[1];x2=item[2];y2=item[3]
sen_arg=atan2(y2-y1,x2-x1)
hpx=hhpx-x1;hpy=hhpy-y1
hpxy=sqrt(hpy**2+hpx**2)
hp_arg=atan2(hpy,hpx)
henkaku=hp_arg-sen_arg
xl=hpxy*cos(henkaku)
if zyousu==1 or zyousu%2==1
x=x1+(xl-picth*(zyousu/2))*cos(sen_arg)
y=y1+(xl-picth*(zyousu/2))*sin(sen_arg)
else
x=x1+(xl-picth*(zyousu/2)-picth/2)*cos(sen_arg)
y=y1+(xl-picth*(zyousu/2)-picth/2)*sin(sen_arg)
end
n=0
zyousu.times{
if zyousu==4
if n%2 ==0
x += picth*cos(sen_arg)
y += picth*sin(sen_arg)
end
else
if n%3 ==0
x += picth*cos(sen_arg)
y += picth*sin(sen_arg)
end
end
if item[0]==item[2]
x1=x+l/2*cos(PI-arg+sen_arg)
x2=x+l/2*cos(-arg+sen_arg)
y1=y+l/2*sin(PI-arg+sen_arg)
y2=y+l/2*sin(-arg+sen_arg)
else
x1=x+l/2*cos(PI+arg+sen_arg)
x2=x+l/2*cos(arg+sen_arg)
y1=y+l/2*sin(PI+arg+sen_arg)
y2=y+l/2*sin(arg+sen_arg)
end
x += picth*cos(sen_arg)
y += picth*sin(sen_arg)
printf("%.11f %.11f %.11f %.11f\n",x1,y1,x2,y2)
n += 1
}
if earth == "2"
x += picth*cos(sen_arg)
y += picth*sin(sen_arg)
l2=1.75*by;arg2=75*2*PI/360
if item[0]==item[2]
x1=x+l2/2*cos(PI+arg2+sen_arg)
x2=x+l2/2*cos(arg2+sen_arg)
y1=y+l2/2*sin(PI+arg2+sen_arg)
y2=y+l2/2*sin(arg2+sen_arg)
else
x1=x+l2/2*cos(PI-arg2+sen_arg)
x2=x+l2/2*cos(-arg2+sen_arg)
y1=y+l2/2*sin(PI-arg2+sen_arg)
y2=y+l2/2*sin(-arg2+sen_arg)
end
printf("%.11f %.11f %.11f %.11f\n",x1,y1,x2,y2)
end
}
@REM 配線条数記号の作図
@echo off
REM #jww
REM #cd
REM #h0
REM #c条数の入力 無指定:2/_/a
REM #k|1)アース無(L)|2)アース付(R)|/_/b
REM #c倍率 無指定:1/_/c
REM #1ln作図点(線上)を指示してください
REM #99#
REM #bz
REM #e
copy jwc_temp.txt temp.txt > nul
ruby -Ks 条数.rb temp.txt %1 %2 %3 > jwc_temp.txt
hhp=[];sen=[] #配列変数hhp sen の宣言
while ARGV.size > 1
case argument=ARGV.pop
when /\/a/
zyousu = argument[2..-1].to_i#条数の入力値
when /\/b/
earth = argument[2..-1]#アース線の有("2")無("1")
when /\/c/
by = argument[2..-1].to_f#倍率の入力値
end
end
picth *=by;l *= by;l2 *= by #(picth l l2 を入力した倍率にする)
while ARGF.gets
xy=split
if xy[0]=~/^hp\d+ln/
hhp<<[xy[1].to_f,xy[2].to_f]
end
if xy[0]=~/^\d|^-/
xy.collect!{|item|item.to_f}
if xy[0]>xy[2]
xy[0],xy[2],xy[1],xy[3]=xy[2],xy[0],xy[3],xy[1]
elsif xy[0]==xy[2]
xy[1],xy[3]=xy[3],xy[1] if xy[1] end
if atan2(xy[3]-xy[1],xy[2]-xy[0])>=60*2*PI/360 && atan2(xy[3]-xy[1],xy[2]-xy[0]) xy[0],xy[2],xy[1],xy[3]=xy[2],xy[0],xy[3],xy[1]
end
sen< end
end
sen.each_with_index{|item,i|
hhpx=hhp[i][0];hhpy=hhp[i][1]
x1=item[0];y1=item[1];x2=item[2];y2=item[3]
sen_arg=atan2(y2-y1,x2-x1)
hpx=hhpx-x1;hpy=hhpy-y1
hpxy=sqrt(hpy**2+hpx**2)
hp_arg=atan2(hpy,hpx)
henkaku=hp_arg-sen_arg
xl=hpxy*cos(henkaku)
if zyousu==1 or zyousu%2==1
x=x1+(xl-picth*(zyousu/2))*cos(sen_arg)
y=y1+(xl-picth*(zyousu/2))*sin(sen_arg)
else
x=x1+(xl-picth*(zyousu/2)-picth/2)*cos(sen_arg)
y=y1+(xl-picth*(zyousu/2)-picth/2)*sin(sen_arg)
end
n=0
zyousu.times{
if zyousu==4 #条数4の時
if n%2 ==0 #2の倍数ならば,
x += picth*cos(sen_arg)
y += picth*sin(sen_arg)
end
else #条数4以外の時
if n%3 ==0 #3の倍数ならば
x += picth*cos(sen_arg)
y += picth*sin(sen_arg)
end
end
if sen_arg>=(-90)*PI && sen_arg<=(-60)*2*PI/360 or
sen_arg>=60*2*PI/360 && sen_arg<=PI/2
x1=x+l/2*cos(PI-arg+sen_arg)
x2=x+l/2*cos(-arg+sen_arg)
y1=y+l/2*sin(PI-arg+sen_arg)
y2=y+l/2*sin(-arg+sen_arg)
else
x1=x+l/2*cos(PI+arg+sen_arg)
x2=x+l/2*cos(arg+sen_arg)
y1=y+l/2*sin(PI+arg+sen_arg)
y2=y+l/2*sin(arg+sen_arg)
end
x += picth*cos(sen_arg)
y += picth*sin(sen_arg)
printf("%.11f %.11f %.11f %.11f\n",x1,y1,x2,y2)
n += 1
}
if earth == "2" #アース付きの時
x += picth*cos(sen_arg)
y += picth*sin(sen_arg)
if sen_arg>=(-90)*PI && sen_arg<=(-60)*2*PI/360 or
sen_arg>=60*2*PI/360 && sen_arg<=PI/2
x1=x+l2/2*cos(PI+arg2+sen_arg)
x2=x+l2/2*cos(arg2+sen_arg)
y1=y+l2/2*sin(PI+arg2+sen_arg)
y2=y+l2/2*sin(arg2+sen_arg)
else
x1=x+l2/2*cos(PI-arg2+sen_arg)
x2=x+l2/2*cos(-arg2+sen_arg)
y1=y+l2/2*sin(PI-arg2+sen_arg)
y2=y+l2/2*sin(-arg2+sen_arg)
end
printf("%.11f %.11f %.11f %.11f\n",x1,y1,x2,y2)
end
}