直线插补 VB编程

2022-07-13 23:17:13   第一文档网     [ 字体: ] [ 阅读: ] [ 文档下载 ]
说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。下载word有问题请添加QQ:admin处理,感谢您的支持与谅解。点击这里给我发消息

#第一文档网# 导语】以下是®第一文档网的小编为您整理的《直线插补 VB编程》,欢迎阅读!
直线,编程

.

数控技术直线插补vb编程

软件连接网址:



四个象限都可以

提取密码:pmzv

VB程序代码:

Private Sub Command1_Click()

Dim Xe As Integer, Ye As Integer

Xe = Text3: Ye = Text4: Form1.Cls: Picture1.Cls: Picture2.Cls: List1.Clear If Xe > 0 Then If Ye > 0 Then

Picture2.Print "第一象限": Call sub1 Else

Picture2.Print "第四象限": Call sub4 End If Else

If Ye > 0 Then

Picture2.Print "第二象限": Call sub2 Else

Picture2.Print "第三象限": Call sub3 End If End If

Picture1.ForeColor = vbGreen: Picture1.DrawWidth = 2 If Xe > 0 Then If Ye > 0 Then

Picture1.Line (60, 5500)-(60 + 400 * Xe, 5500 - 400 * Ye) '第一象限 Else

Picture1.Line (50, 50)-(50 + 400 * Int(Xe), 50 + 400 * Int(Abs(Ye))) '第四象限 End If Else

If Ye > 0 Then

Picture1.Line (5500, 5500)-(5500 - 400 * Int(Abs(Xe)), 5500 - 400 * Int(Ye)) '第二象限 Else

Picture1.Line (5500, 50)-(5500 + 400 * Int(Xe), 50 - 400 * Int(Ye)) '第三象限 End If End If End Sub

Private Sub sub1() '第一象限

Picture1.ForeColor = vbBlack: Picture1.DrawWidth = 2

Picture1.Line (60, 50)-(60, 5550): Picture1.Line (10, 5500)-(5500, 5500) Picture1.Line (100, 90)-(60, 50): Picture1.Line (20, 90)-(60, 50)

Picture1.Line (5460, 5460)-(5500, 5500): Picture1.Line (5460, 5540)-(5500, 5500)

End Sub

Private Sub sub2() '第二象限

Picture1.ForeColor = vbBlack: Picture1.DrawWidth = 2

Picture1.Line (5500, 50)-(5500, 5550): Picture1.Line (60, 5500)-(5550, 5500) Picture1.Line (5450, 90)-(5500, 50): Picture1.Line (5540, 90)-(5500, 50) Picture1.Line (100, 5450)-(60, 5500): Picture1.Line (100, 5550)-(60, 5500) End Sub

Private Sub sub3() '第三象限

Picture1.ForeColor = vbBlack: Picture1.DrawWidth = 2

Picture1.Line (5500, 50)-(5500, 5500): Picture1.Line (5500, 50)-(500, 50)

Picture1.Line (5400, 5400)-(5500, 5500): Picture1.Line (5550, 5400)-(5500, 5500) Picture1.Line (600, 10)-(500, 50): Picture1.Line (600, 90)-(500, 50) End Sub

Private Sub sub4() '第四象限

Picture1.ForeColor = vbBlack: Picture1.DrawWidth = 2

Picture1.Line (50, 50)-(50, 5500): Picture1.Line (50, 50)-(5500, 50) Picture1.Line (90, 5500)-(50, 5550): Picture1.Line (10, 5500)-(50, 5550) Picture1.Line (5450, 10)-(5500, 50): Picture1.Line (5450, 90)-(5500, 50) End Sub

Private Sub Command2_Click()

Dim Xe As Integer, Ye As Integer Xe = Text3: Ye = Text4: Form1.Cls

Dim i, k, m, j, l, g, s, F(999), n As Integer m = 0: i = 1: k = 0: F(m) = 0

Picture1.ForeColor = vbRed: Picture1.DrawWidth = 2

j = Int(Abs(Xe)) + Int(Abs(Ye)): Form1.CurrentX = 200: Form1.CurrentY = 200

Print "初始:进给方向" & " F(m)= 0" & " Xe=" & Xe & " Ye=" & Ye & " = " & j For n = 1 To Int(Abs(Xe)) + Int(Abs(Ye)) If F(m) >= 0 And j > 0 Then m = m + 1: l = l + 1

F(m) = F(m - 1) - Int(Abs(Text4)) If Xe > 0 Then

..


.

If Ye > 0 Then

Picture1.Line (50 + 400 * (l - 1), 5500 - k * 400)-(50 + 400 * (l), 5500 - k * 400) Else

Picture1.Line (50 + 400 * (l - 1), 50 + k * 400)-(50 + 400 * (l), 50 + k * 400) End If Else

If Ye > 0 Then

Picture1.Line (5500 - 400 * (l - 1), 5500 - k * 400)-(5500 - 400 * (l), 5500 - k * 400) Else

Picture1.Line (5500 - 400 * (l - 1), 50 + k * 400)-(5500 - 400 * (l), 50 + k * 400) End If End If

Form1.CurrentX = 200: Form1.CurrentY = 200 + n * 300

List1.AddItem "" & m & "" & " x F(" & m & ")= " & F(m) & " " & "x=-" & l & " " & "y=-" & k & " =" & j - n Else

k = k + 1: m = m + 1 If Xe > 0 Then If Ye > 0 Then

Picture1.Line (50 + 400 * l, 5500 - (k - 1) * 400)-(50 + 400 * l, 5500 - k * 400) Else

Picture1.Line (50 + 400 * l, 50 + (k - 1) * 400)-(50 + 400 * l, 50 + k * 400) End If Else

If Ye > 0 Then

Picture1.Line (5500 - 400 * l, 5500 - (k - 1) * 400)-(5500 - 400 * l, 5500 - k * 400) Else

Picture1.Line (5500 - 400 * l, 50 + (k - 1) * 400)-(5500 - 400 * l, 50 + k * 400) End If End If

F(m) = F(m - 1) + Int(Abs(Text3))

List1.AddItem "" & m & "" & " y F(" & m & ")= " & F(m) & " " & "x=-" & l & " " & "y=-" & k & " =" & j - n End If Next n End Sub

Private Sub Command3_Click() '清除

Text3 = "": Text4 = "": Form1.Cls: Picture1.Cls: Picture2.Cls: List1.Clear End Sub

Private Sub Command4_Click() '结束 End End Sub

Private Sub Text3_Change() Picture2.Cls End Sub

Private Sub Text4_Change() Picture2.Cls End Sub



软件截图:

..




本文来源:https://www.dywdw.cn/ec88d6182dc58bd63186bceb19e8b8f67d1cefee.html

相关推荐
推荐阅读