Public Class Form1 Dim pi As Double = Math.PI Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load PictureBox1.Visible = True ToolStripStatusLabel1.Text = "size and Png file name" End Sub Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click Call main_part() End Sub Private Sub main_part() Dim sr As System.IO.StreamReader Dim fnameR As String = "" Dim fnameW As String = "" Dim fnameF As String = "" Dim fnameZ As String = "" Dim dat As String Dim sbuf() As String Dim delim As Char = ","c Dim ksp As Integer Dim B As Double Dim H As Double Dim W As Double Dim Ti As Double Dim ts As Double Dim tp As Double Dim bboxv(3) As Integer Dim rr As Double Dim hh As Double Dim dw As Double Dim RL As Double Dim theta As Double Dim A1 As Double Dim A2 As Double Dim A3 As Double Dim Ae As Double Dim Ac As Double Dim Ls As Double Dim nnn As Integer Dim iii As Integer '入力ファイル指定 OpenFileDialog1.InitialDirectory = System.IO.Directory.GetCurrentDirectory() If OpenFileDialog1.ShowDialog() = DialogResult.OK Then fnameR = OpenFileDialog1.FileName 'データ入力 sr = New System.IO.StreamReader(fnameR, System.Text.Encoding.Default) dat = sr.ReadLine() : sbuf = dat.Split(delim) nnn = Integer.Parse(sbuf(0)) For iii = 1 To nnn dat = sr.ReadLine() : sbuf = dat.Split(delim) fnameW = sbuf(0).Trim() 'コマンド記述ファイル名*/ fnameF = sbuf(1).Trim() '出力画像ファイル名*/ ksp = Integer.Parse(sbuf(2)) '-1:モデル図,0:NATMトンネル*/ B = Double.Parse(sbuf(3)) '内空幅*/ H = Double.Parse(sbuf(4)) '内空高*/ W = Double.Parse(sbuf(5)) 'インバート内空幅*/ Ti = Double.Parse(sbuf(6)) 'インバート厚*/ ts = Double.Parse(sbuf(7)) '吹付厚*/ tp = Double.Parse(sbuf(8)) '設計線から支払線までの距離*/ bboxv(0) = Integer.Parse(sbuf(9)) 'BoundingBox値*/ bboxv(1) = Integer.Parse(sbuf(10)) 'BoundingBox値*/ bboxv(2) = Integer.Parse(sbuf(11)) 'BoundingBox値*/ bboxv(3) = Integer.Parse(sbuf(12)) 'BoundingBox値*/ fnameW = System.IO.Path.GetDirectoryName(fnameR) + "\\" + fnameW ' 掘削面積 (Pay line)*/ rr = 0.5 * B hh = H - rr dw = rr - 0.5 * W RL = 0.5 * (hh * hh + dw * dw) / dw rr = 0.5 * B + ts + tp hh = H - rr + Ti + tp theta = Math.Asin(hh / (RL + ts + tp)) A1 = (RL + ts + tp) * (RL + ts + tp) * (theta - Math.Sin(theta) * Math.Cos(theta)) A2 = (B + 2.0 * ts + 2.0 * tp - (RL + ts + tp) * (1.0 - Math.Cos(theta))) * hh A3 = 0.5 * pi * rr * rr Ae = A1 + A2 + A3 Ae = Ae * 0.000001 ' インバートコン面積 (Concrete)*/ rr = 0.5 * B hh = H - rr theta = Math.Asin(hh / RL) Ac = 0.5 * (W + W - 2.0 * Ti * Math.Tan(theta)) * Ti Ac = Ac * 0.000001 ' 吹付長 (Shotcrete)*/ rr = 0.5 * B + ts hh = H - rr + Ti theta = Math.Asin(hh / (RL + ts)) Ls = rr * pi + 2.0 * (RL + ts) * theta Ls = Ls * 0.001 Call WGPL(fnameW, fnameF, ksp, B, H, W, Ti, ts, tp, Ae, Ac, Ls) 'fnameF のフルパス指定 fnameF = System.IO.Path.GetDirectoryName(fnameR) & "\" & fnameF '************************************************************** 'gnuplot 起動+epsファイル作成 (fnameW: コマンド記述ファイル名) '************************************************************** GPL(fnameW) System.Threading.Thread.Sleep(1000) '1秒待つ '************************************************************** 'eps の BoundingBox 修正 (fnameF: eps画像ファイル名) '************************************************************** fnameZ = fnameF.Replace("_eps_", "_eps_z_") BBOX(fnameF, fnameZ, bboxv) '************************************************************** 'ImageMagick による png 画像作成 (fnameZ: eps画像ファイル名) '************************************************************** IMCVT(fnameZ) '************************************************************** 'ImageMagick による 白背景合成 (fnameZ: png画像ファイル名) '************************************************************** fnameZ = fnameZ.Replace("eps", "png") IMCMP(fnameZ) '************************************************************** 'png 画像画面表示 (fnameZ: png画像ファイル名) '************************************************************** fnameZ = fnameZ.Replace("_png_z_", "_png_zw_") VIEWPNG(fnameZ) Next iii sr.Close() MessageBox.Show("計算完了", "完了通知") End Sub '-------------------------------------------------------------------------------------------- Private Sub GPL(ByVal fnameR As String) '***************************************************** 'gnuplot 起動+epsファイル作成 '***************************************************** Dim pr As System.Diagnostics.Process Dim sw As System.IO.StreamWriter Dim dir As String = "" Dim fname As String = "" Dim dat As String = "" dir = System.IO.Path.GetDirectoryName(fnameR) System.IO.Directory.SetCurrentDirectory(dir) fname = System.IO.Path.GetFileName(fnameR) pr = New System.Diagnostics.Process() pr.StartInfo.FileName = "gnuplot.exe" pr.StartInfo.RedirectStandardInput = True pr.StartInfo.RedirectStandardOutput = True pr.StartInfo.UseShellExecute = False pr.StartInfo.CreateNoWindow = True pr.Start() sw = pr.StandardInput dat = String.Format("load ""{0:s}""", fname) sw.WriteLine(dat) sw.Close() pr.WaitForExit() pr.Close() End Sub '-------------------------------------------------------------------------------------------- Private Sub BBOX(ByVal fnameR As String, ByVal fnameW As String, ByRef bboxv() As Integer) Dim sr As System.IO.StreamReader Dim sw As System.IO.StreamWriter Dim dat As String Dim i As Integer 'データ入力 sr = New System.IO.StreamReader(fnameR, System.Text.Encoding.Default) sw = New System.IO.StreamWriter(fnameW, False, System.Text.Encoding.Default) i = 0 Do Until sr.EndOfStream i = i + 1 dat = sr.ReadLine() If i = 6 Then dat = String.Format("%%BoundingBox: {0:D} {1:D} {2:D} {3:D}", bboxv(0), bboxv(1), bboxv(2), bboxv(3)) sw.WriteLine(dat) Loop sr.Close() sw.Close() End Sub '-------------------------------------------------------------------------------------------- Private Sub IMCVT(ByVal fnameF As String) '***************************************************** 'ImageMagick convert で png 画像作成 '***************************************************** Dim fnameP As String Dim pr As System.Diagnostics.Process Dim sw As System.IO.StreamWriter Dim dat As String = "" fnameP = fnameF.Replace("eps", "png") pr = New System.Diagnostics.Process() pr.StartInfo.FileName = "cmd.exe" pr.StartInfo.RedirectStandardInput = True pr.StartInfo.RedirectStandardOutput = True pr.StartInfo.UseShellExecute = False pr.StartInfo.CreateNoWindow = True pr.Start() sw = pr.StandardInput dat = String.Format("convert -density 300 {0:s} {1:s}", fnameF, fnameP) sw.WriteLine(dat) sw.Close() pr.WaitForExit() pr.Close() End Sub '-------------------------------------------------------------------------------------------- Private Sub IMCMP(ByVal fnameZ As String) '***************************************************** 'ImageMagick convert で 白背景合成画像作成 '***************************************************** Dim fnameP As String Dim fnameB As String Dim pr As System.Diagnostics.Process Dim sw As System.IO.StreamWriter Dim dat As String = "" Dim img As Image Dim ww As Integer Dim hh As Integer img = Image.FromFile(fnameZ) ww = img.Width hh = img.Height img.Dispose() fnameP = fnameZ.Replace("_z_", "_zw_") fnameB = System.IO.Path.GetDirectoryName(fnameP) & "\base.png" pr = New System.Diagnostics.Process() pr.StartInfo.FileName = "cmd.exe" pr.StartInfo.RedirectStandardInput = True pr.StartInfo.RedirectStandardOutput = True pr.StartInfo.UseShellExecute = False pr.StartInfo.CreateNoWindow = True pr.Start() sw = pr.StandardInput dat = String.Format("convert -size {0:D}x{1:D} xc:""#FFFFFF"" {2:s}", ww, hh, fnameB) sw.WriteLine(dat) dat = String.Format("convert {0:s} {1:s} -composite {2:s}", fnameB, fnameZ, fnameP) sw.WriteLine(dat) sw.Close() pr.WaitForExit() pr.Close() End Sub '-------------------------------------------------------------------------------------------- Private Sub VIEWPNG(ByVal fnameZ As String) '***************************************************** 'png 画像画面表示 (50%縮尺) '***************************************************** Dim img As Image Dim bmp As Bitmap Dim g As Graphics Dim ratio As Single = 0.5 Dim ww As Integer Dim hh As Integer Dim w_org As Integer Dim h_org As Integer img = Image.FromFile(fnameZ) w_org = img.Width h_org = img.Height ww = CInt(ratio * w_org) hh = CInt(ratio * h_org) PictureBox1.Size = New Size(ww, hh) bmp = New Bitmap(ww, hh) PictureBox1.Image = bmp g = Graphics.FromImage(PictureBox1.Image) g.DrawImage(img, 0, 0, ww, hh) g.Dispose() img.Dispose() PictureBox1.Left = 0 PictureBox1.Top = ToolStrip1.Height Me.ClientSize = New Size(PictureBox1.Width, PictureBox1.Height + ToolStrip1.Height + StatusStrip1.Height) ToolStripStatusLabel1.Text = String.Format("{0:D} x {1:D} : {2:s}", w_org, h_org, fnameZ) End Sub '-------------------------------------------------------------------------------------------- Private Sub WGPL(ByVal fnameW As String, ByVal fnameF As String, ByVal ksp As Integer, _ ByVal B As Double, ByVal H As Double, ByVal W As Double, ByVal Ti As Double, _ ByVal ts As Double, ByVal tp As Double, _ ByVal Ae As Double, ByVal Ac As Double, ByVal Ls As Double) Dim sw As System.IO.StreamWriter Dim xx As Double Dim yy As Double Dim x1 As Double Dim y1 As Double Dim x2 As Double Dim y2 As Double Dim x3 As Double Dim y3 As Double Dim x4 As Double Dim y4 As Double Dim xc As Double Dim yc As Double Dim phi As Double Dim BB As Double Dim HU As Double Dim HL As Double Dim ds As Double Dim dss As Double Dim dl As Double Dim rr As Double Dim hh As Double Dim dw As Double Dim RL As Double Dim theta As Double Dim dat As String Dim str As String Dim sv As String Dim i As Integer Dim n As Integer = 20 BB = B + 2.0 * ts + 2.0 * tp HU = H + ts + tp HL = (Ti + tp) ds = 1000.0 dss = 200.0 dl = 400.0 rr = 0.5 * B hh = H - rr dw = rr - 0.5 * W RL = 0.5 * (hh * hh + dw * dw) / dw sw = New System.IO.StreamWriter(fnameW, False, System.Text.Encoding.Default) dat = "reset" : sw.WriteLine(dat) dat = "set terminal postscript eps enhanced font ""Helvetica"" 16" : sw.WriteLine(dat) dat = String.Format("set output ""{0:s}""", fnameF) : sw.WriteLine(dat) dat = "#" : sw.WriteLine(dat) dat = "set multiplot" : sw.WriteLine(dat) dat = "#" : sw.WriteLine(dat) dat = "set origin 0,0" : sw.WriteLine(dat) dat = "set size ratio -1" : sw.WriteLine(dat) dat = "#" : sw.WriteLine(dat) dat = "set xrange [-7000:7000]" : sw.WriteLine(dat) dat = "set yrange [-4000:10000]" : sw.WriteLine(dat) dat = "set border 0" : sw.WriteLine(dat) dat = "set xtics 0,0,0" : sw.WriteLine(dat) dat = "set ytics 0,0,0" : sw.WriteLine(dat) dat = "set xtics nomirror" : sw.WriteLine(dat) dat = "set ytics nomirror" : sw.WriteLine(dat) dat = "#" : sw.WriteLine(dat) dat = "set style arrow 1 size graph 0.02,10 filled nohead linewidth 1 linetype 5" : sw.WriteLine(dat) '一点鎖線*/ dat = "set style arrow 2 size graph 0.02,10 filled nohead linewidth 1 linetype 1" : sw.WriteLine(dat) '実線*/ dat = "set style arrow 3 size graph 0.02,10 filled heads linewidth 1 linetype 1" : sw.WriteLine(dat) '両矢印*/ dat = "set style arrow 4 size graph 0.02,10 filled linewidth 1 linetype 1" : sw.WriteLine(dat) '片矢印*/ '一点鎖線*/ x1 = 0.5 * BB + ds + dss : y1 = H - 0.5 * B x2 = -0.5 * BB - 0.5 * ds : y2 = y1 x3 = 0.0 : y3 = -HL - 0.5 * ds x4 = 0.0 : y4 = HU + 0.5 * ds dat = String.Format("set arrow as 1 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) dat = String.Format("set arrow as 1 from {0:F3},{1:F3} to {2:F3},{3:F3}", x3, y3, x4, y4) : sw.WriteLine(dat) dat = "#" : sw.WriteLine(dat) '実線*/ x1 = 0.0 : y1 = H + ts x2 = 0.5 * BB + ds + dss : y2 = y1 dat = String.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) x1 = 0.0 : y1 = H x2 = 0.5 * BB + 2.0 * ds + dss : y2 = y1 dat = String.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) x1 = 0.0 : y1 = 0.0 x2 = 0.5 * BB + 2.0 * ds + dss : y2 = y1 dat = String.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) x1 = 0.0 : y1 = -Ti x2 = 0.5 * BB + ds + dss : y2 = y1 dat = String.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) x1 = -0.5 * B : y1 = H - 0.5 * B x2 = x1 : y2 = -HL - 2.0 * ds - dss dat = String.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) x1 = 0.5 * B : y1 = H - 0.5 * B x2 = x1 : y2 = -HL - 2.0 * ds - dss dat = String.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) x1 = -0.5 * W : y1 = 0.0 x2 = x1 : y2 = -HL - ds - dss dat = String.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) x1 = 0.5 * W : y1 = 0.0 x2 = x1 : y2 = -HL - ds - dss dat = String.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) '両矢印*/ str = (0.5 * B).ToString("0") sv = " rotate by 90" x1 = 0.5 * BB + ds : y1 = H - 0.5 * B x2 = x1 : y2 = H x3 = x1 - dl : y3 = 0.5 * (y1 + y2) dat = String.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) If ksp < 0 Then str = "r" : sv = "" End If dat = String.Format("set label ""{0:s}"" at {1:F3},{2:F3} center{3:s}", str, x3, y3, sv) : sw.WriteLine(dat) str = hh.ToString("0") sv = " rotate by 90" x1 = 0.5 * BB + ds : y1 = 0.0 x2 = x1 : y2 = H - 0.5 * B x3 = x1 - dl : y3 = 0.5 * (y1 + y2) dat = String.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) If ksp < 0 Then str = "h" : sv = "" End If dat = String.Format("set label ""{0:s}"" at {1:F3},{2:F3} center{3:s}", str, x3, y3, sv) : sw.WriteLine(dat) str = H.ToString("0") sv = " rotate by 90" x1 = 0.5 * BB + 2.0 * ds : y1 = 0.0 x2 = x1 : y2 = H x3 = x1 - dl : y3 = 0.5 * (y1 + y2) dat = String.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) If ksp < 0 Then str = "H" : sv = "" End If dat = String.Format("set label ""{0:s}"" at {1:F3},{2:F3} center{3:s}", str, x3, y3, sv) : sw.WriteLine(dat) str = W.ToString("0") x1 = -0.5 * W : y1 = -HL - ds x2 = 0.5 * W : y2 = y1 x3 = 0.5 * (x1 + x2) : y3 = y2 - dl dat = String.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) If ksp < 0 Then str = "W" End If dat = String.Format("set label ""{0:s}"" at {1:F3},{2:F3} center", str, x3, y3) : sw.WriteLine(dat) str = B.ToString("0") x1 = -0.5 * B : y1 = -HL - 2.0 * ds x2 = 0.5 * B : y2 = y1 x3 = 0.5 * (x1 + x2) : y3 = y2 - dl dat = String.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) If ksp < 0 Then str = "B" End If dat = String.Format("set label ""{0:s}"" at {1:F3},{2:F3} center", str, x3, y3) : sw.WriteLine(dat) '片矢印*/ str = ts.ToString("0") sv = " rotate by 90" x1 = 0.5 * BB + ds : y1 = H + ts + 0.7 * ds x2 = x1 : y2 = H + ts x3 = x1 + dl : y3 = 0.5 * (y2 + H) dat = String.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) If ksp < 0 Then str = "t{/=14 s}" : sv = "" End If dat = String.Format("set label ""{0:s}"" at {1:F3},{2:F3} center{3:s}", str, x3, y3, sv) : sw.WriteLine(dat) str = Ti.ToString("0") sv = " rotate by 90" x1 = 0.5 * BB + ds : y1 = -(Ti + 0.7 * ds) x2 = x1 : y2 = -Ti x3 = x1 + dl : y3 = 0.5 * (y2) dat = String.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) If ksp < 0 Then str = "T{/=14 I}" : sv = "" End If dat = String.Format("set label ""{0:s}"" at {1:F3},{2:F3} center{3:s}", str, x3, y3, sv) : sw.WriteLine(dat) str = dw.ToString("0") x1 = -0.5 * B - 0.7 * ds : y1 = -HL - ds x2 = -0.5 * B : y2 = y1 x3 = 0.5 * (x2 - 0.5 * W) : y3 = y1 - dl dat = String.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) If ksp < 0 Then str = "dw" End If dat = String.Format("set label ""{0:s}"" at {1:F3},{2:F3} center", str, x3, y3) : sw.WriteLine(dat) str = dw.ToString("0") x1 = 0.5 * B + 0.7 * ds : y1 = -HL - ds x2 = 0.5 * B : y2 = y1 x3 = 0.5 * (x2 + 0.5 * W) : y3 = y1 - dl dat = String.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) If ksp < 0 Then str = "dw" End If dat = String.Format("set label ""{0:s}"" at {1:F3},{2:F3} center", str, x3, y3) : sw.WriteLine(dat) str = String.Format("r={0:F0}", 0.5 * B) x1 = 0.0 y1 = H - 0.5 * B x2 = rr * Math.Cos(45.0 / 180.0 * pi) y2 = y1 + rr * Math.Sin(45.0 / 180.0 * pi) x3 = 0.5 * x2 - dl * Math.Sin(45.0 / 180.0 * pi) y3 = y1 + 0.5 * rr * Math.Sin(45.0 / 180.0 * pi) + dl * Math.Cos(45.0 / 180.0 * pi) dat = String.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) If ksp < 0 Then str = "r" End If dat = String.Format("set label ""{0:s}"" at {1:F3},{2:F3} center rotate by 45", str, x3, y3) : sw.WriteLine(dat) str = String.Format("R={0:F0}", RL) theta = 0.5 * Math.Asin(hh / RL) / pi * 180.0 x1 = (RL - rr) - (RL - 0.45 * W) * Math.Cos(theta / 180.0 * pi) y1 = (H - 0.5 * B) - (RL - 0.45 * W) * Math.Sin(theta / 180.0 * pi) x2 = (RL - rr) - RL * Math.Cos(theta / 180.0 * pi) y2 = (H - 0.5 * B) - RL * Math.Sin(theta / 180.0 * pi) x3 = (RL - rr) - (RL - 0.1 * W) * Math.Cos(theta / 180.0 * pi) - dl * Math.Sin(theta / 180.0 * pi) y3 = (H - 0.5 * B) - (RL - 0.1 * W) * Math.Sin(theta / 180.0 * pi) + dl * Math.Cos(theta / 180.0 * pi) dat = String.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) If ksp < 0 Then str = "R" End If dat = String.Format("set label ""{0:s}"" at {1:F3},{2:F3} left rotate by {3:F3}", str, x3, y3, theta) : sw.WriteLine(dat) If ksp < 0 Then theta = 45.0 x1 = -(0.5 * B + ts - ds) * Math.Cos(theta / 180.0 * pi) y1 = H - 0.5 * B + (0.5 * B + ts - ds) * Math.Sin(theta / 180.0 * pi) x2 = -(0.5 * B + ts) * Math.Cos(theta / 180.0 * pi) y2 = H - 0.5 * B + (0.5 * B + ts) * Math.Sin(theta / 180.0 * pi) dat = String.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) str = "t{/=14 p}" x1 = -(0.5 * B + ts + tp + ds) * Math.Cos(theta / 180.0 * pi) y1 = H - 0.5 * B + (0.5 * B + ts + tp + ds) * Math.Sin(theta / 180.0 * pi) x2 = -(0.5 * B + ts + tp) * Math.Cos(theta / 180.0 * pi) y2 = H - 0.5 * B + (0.5 * B + ts + tp) * Math.Sin(theta / 180.0 * pi) x3 = 0.5 * (x1 + x2) + dl * Math.Sin(theta / 180.0 * pi) y3 = 0.5 * (y1 + y2) + dl * Math.Cos(theta / 180.0 * pi) dat = String.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2) : sw.WriteLine(dat) dat = String.Format("set label ""{0:s}"" at {1:F3},{2:F3} center rotate by {3:F3}", str, x3, y3, -theta) : sw.WriteLine(dat) End If dat = "#" : sw.WriteLine(dat) If 0 <= ksp Then '数量描画*/ x3 = 0.0 str = String.Format("Ae={0:F1} {1:s}", Ae, "m^{/=10 2}") y3 = 8000.0 dat = String.Format("set label ""{0:s}"" at {1:F3},{2:F3}", str, x3, y3) : sw.WriteLine(dat) str = String.Format("Ac={0:F1} {1:s}", Ac, "m^{/=10 2}") y3 = 7500.0 dat = String.Format("set label ""{0:s}"" at {1:F3},{2:F3}", str, x3, y3) : sw.WriteLine(dat) str = String.Format("Ls={0:F1} {1:s}", Ls, "m") y3 = 7000.0 dat = String.Format("set label ""{0:s}"" at {1:F3},{2:F3}", str, x3, y3) : sw.WriteLine(dat) End If dat = "#" : sw.WriteLine(dat) '構造線描画*/ dat = "plot ""-"" with lines linewidth 5 linetype 1 notitle,\" : sw.WriteLine(dat) '吹付外形線*/ If ksp < 0 Then dat = """-"" with lines linewidth 3 linetype 2 notitle,\" : sw.WriteLine(dat) '支払い線*/ End If dat = """-"" with lines linewidth 5 linetype 1 notitle,\" : sw.WriteLine(dat) '吹付内形線*/ dat = """-"" with lines linewidth 5 linetype 1 notitle,\" : sw.WriteLine(dat) '吹付内形線*/ dat = """-"" with lines linewidth 5 linetype 1 notitle" : sw.WriteLine(dat) 'インバート線*/ '吹付外形(一挙に書く)*/ xc = RL - rr yc = H - 0.5 * B yy = hh + Ti theta = Math.Asin(yy / (RL + ts)) / pi * 180.0 phi = 0.0 For i = 0 To n phi = theta / CDbl(n) * CDbl(i) xx = xc - (RL + ts) * Math.Cos(phi / 180.0 * pi) yy = yc - (RL + ts) * Math.Sin(phi / 180.0 * pi) dat = String.Format("{0:F3} {1:F3}", xx, yy) : sw.WriteLine(dat) Next i xc = rr - RL yc = H - 0.5 * B phi = 0.0 For i = n To 0 Step -1 phi = theta / CDbl(n) * CDbl(i) xx = xc + (RL + ts) * Math.Cos(phi / 180.0 * pi) yy = yc - (RL + ts) * Math.Sin(phi / 180.0 * pi) dat = String.Format("{0:F3} {1:F3}", xx, yy) : sw.WriteLine(dat) Next i dat = "e" : sw.WriteLine(dat) If ksp < 0 Then '支払い線(一挙に書く)*/ xc = RL - rr yc = H - 0.5 * B yy = hh + Ti + tp theta = Math.Asin(yy / (RL + ts + tp)) / pi * 180.0 phi = 0.0 For i = 0 To n phi = theta / CDbl(n) * CDbl(i) xx = xc - (RL + ts + tp) * Math.Cos(phi / 180.0 * pi) yy = yc - (RL + ts + tp) * Math.Sin(phi / 180.0 * pi) dat = String.Format("{0:F3} {1:F3}", xx, yy) : sw.WriteLine(dat) Next i xc = rr - RL yc = H - 0.5 * B phi = 0.0 For i = n To 0 Step -1 phi = theta / CDbl(n) * CDbl(i) xx = xc + (RL + ts + tp) * Math.Cos(phi / 180.0 * pi) yy = yc - (RL + ts + tp) * Math.Sin(phi / 180.0 * pi) dat = String.Format("{0:F3} {1:F3}", xx, yy) : sw.WriteLine(dat) Next i dat = "e" : sw.WriteLine(dat) End If '吹付内形*/ xc = RL - rr yc = H - 0.5 * B yy = hh + Ti theta = Math.Asin(yy / RL) / pi * 180.0 phi = 0.0 For i = 0 To n phi = theta / CDbl(n) * CDbl(i) xx = xc - RL * Math.Cos(phi / 180.0 * pi) yy = yc - RL * Math.Sin(phi / 180.0 * pi) dat = String.Format("{0:F3} {1:F3}", xx, yy) : sw.WriteLine(dat) Next i dat = "e" : sw.WriteLine(dat) xc = rr - RL yc = H - 0.5 * B phi = 0.0 For i = 0 To n phi = theta / CDbl(n) * CDbl(i) xx = xc + RL * Math.Cos(phi / 180.0 * pi) yy = yc - RL * Math.Sin(phi / 180.0 * pi) dat = String.Format("{0:F3} {1:F3}", xx, yy) : sw.WriteLine(dat) Next i dat = "e" : sw.WriteLine(dat) 'インバート線*/ xx = -0.5 * W : yy = 0.0 dat = String.Format("{0:F3} {1:F3}", xx, yy) : sw.WriteLine(dat) xx = 0.5 * W : yy = 0.0 dat = String.Format("{0:F3} {1:F3}", xx, yy) : sw.WriteLine(dat) dat = "e" : sw.WriteLine(dat) '円形部描画*/ dat = "set origin 0,0" : sw.WriteLine(dat) dat = "set parametric" : sw.WriteLine(dat) dat = "set trange [0:pi]" : sw.WriteLine(dat) dat = String.Format("plot {0:F3}*cos(t),{1:F3}+{2:F3}*sin(t) with lines linewidth 5 linetype 1 notitle,\", rr, H - 0.5 * B, rr) : sw.WriteLine(dat) '内空*/ If ksp < 0 Then dat = String.Format("{0:F3}*cos(t),{1:F3}+{2:F3}*sin(t) with lines linewidth 3 linetype 2 notitle,\", rr + ts + tp, H - 0.5 * B, rr + ts + tp) : sw.WriteLine(dat) '支払い線*/ End If dat = String.Format("{0:F3}*cos(t),{1:F3}+{2:F3}*sin(t) with lines linewidth 5 linetype 1 notitle", rr + ts, H - 0.5 * B, rr + ts) : sw.WriteLine(dat) '掘削径*/ dat = "#" : sw.WriteLine(dat) dat = "#" : sw.WriteLine(dat) dat = "unset multiplot" : sw.WriteLine(dat) dat = "#" : sw.WriteLine(dat) dat = "quit" : sw.WriteLine(dat) dat = "#" : sw.WriteLine(dat) sw.Close() End Sub '-------------------------------------------------------------------------------------------- End Class