@REM 寸法値位置の一括変更(寸法図形)
@echo off
REM #jww
REM #cd
REM #ht10
REM #zz
REM #zw
REM #c寸法値と寸法線の距離(図寸) 無指定:1/_/a
REM #h1
REM #e
copy jwc_temp.txt temp.txt > nul
ruby -Ks 寸法値位置変更2.rb temp.txt %1> jwc_temp.txt
include Math
kyori=0.3
while ARGV.size>1
case argument=ARGV.pop
when /\/a/
kyori=eval(argument[2..-1])
end
end
by=[]
puts "hd"
while ARGF.gets
xy=split
if xy[0]=~/^hq/
elsif xy[0]=~/^hs/
xy[1..-1].each{|item|by< elsif xy[0]=~/^lg/
print $_
lg=xy[0][2,1]
zusun=by[lg.hex]
elsif xy[0]=~/^msg/ or xy[0]=~/^\#/
print $_
msg=xy[0]
elsif xy[0]=~/^\d|^-/
print $_
if msg=="msg"
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]
if xy[1]>xy[3]
xy[1],xy[3]=xy[3],xy[1]
end
end
sen=xy
end
elsif xy[0]=~/^cs/
if msg=="msg"
if $_=~/\"/
moji=$'.chop
end
moji_arg=atan2(xy[4].to_f,xy[3].to_f)
x=xy[1].to_f-sen[0]
y=xy[2].to_f-sen[1]
l=sqrt(x**2+y**2)
moji_sen_arg=atan2(y,x)
sen_arg=atan2(sen[3]-sen[1],sen[2]-sen[0])
moji_x=sen[0]+(l*cos(moji_sen_arg-sen_arg))*cos(sen_arg)
moji_y=sen[1]+(l*cos(moji_sen_arg-sen_arg))*sin(sen_arg)
if sen_arg xy[1]=moji_x-kyori*zusun*sin(sen_arg)
xy[2]=moji_y+kyori*zusun*cos(sen_arg)
end
puts xy[0,5].join("\s")+"\s\""+moji
else
print $_
end
else
print $_
end
end
if sen_arg xy[1]=moji_x-kyori*zusun*sin(sen_arg)
xy[2]=moji_y+kyori*zusun*cos(sen_arg)
end
↓
xy[1]=moji_x-kyori*zusun*sin(sen_arg)
xy[2]=moji_y+kyori*zusun*cos(sen_arg)