U字溝自動作図 |
---|
Public Class Form1 ''------------------------------------------------------------------------------------------------------------------------------------- 'Form1が開かれた時に、TextBox1-8に項目を追加します。 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load TextBox1.Text = 150 TextBox2.Text = 150 TextBox3.Text = 400 TextBox4.Text = 80 TextBox5.Text = 70 TextBox6.Text = 80 TextBox7.Text = 50 TextBox8.Text = 1000 End Sub ''------------------------------------------------------------------------------------------------------------------------------------- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim A1, B1, C1, D1, E1, F1, G1, H1 As Integer Dim dist1 As Integer 'TextBoxの文字を数値に変換します。 A1 = Integer.Parse(TextBox1.Text) B1 = Integer.Parse(TextBox2.Text) C1 = Integer.Parse(TextBox3.Text) D1 = Integer.Parse(TextBox4.Text) E1 = Integer.Parse(TextBox5.Text) F1 = Integer.Parse(TextBox6.Text) G1 = Integer.Parse(TextBox7.Text) H1 = Integer.Parse(TextBox8.Text) dist1 = (0.5 * H1) - (G1 + D1 + E1) ' AutoCAD をアクティブにします。 AppActivate("Autodesk AutoCAD") 'LTに[PLINE]コマンドを送ります。 SendKeys.Send("Pline " & G1 & "," & A1 & " @0," & (B1 + C1) & " @" & D1 & ",0" & " @0," & (F1 * -1) & " @" & E1 & ",0" & " @0," & (-1 * (C1 - F1)) & " @" & ((0.5 * H1) - (G1 + D1 + E1)) & ",0" & Chr(13) & Chr(13)) 'LTに[MIRROR]コマンドを送ります。 SendKeys.Send("Mirror L " & (0.5 * H1) & ",0" & Chr(13) & (0.5 * H1) & "," & A1 & " N ") SendKeys.Send("select P L ") 'LTに[RECTANG]コマンドを送ります。 SendKeys.Send("rectang 0,0 " & H1 & "," & A1 & Chr(13)) SendKeys.Send("select p l ") 'LTに[MOVE]コマンドを送ります。 SendKeys.Send("Move " & ("0,0") & Chr(13)) End Sub ''------------------------------------------------------------------------------------------------------------------------------------- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Application.Exit() End Sub ''------------------------------------------------------------------------------------------------------------------------------------- End Class |