首页 > 文章 > 数控插补

逐点比较法圆弧插补VB程序

       2023-05-29 来源:互联网热度:77评论:0
    广告
    核心提示:逐点比较法第一象限逆圆插补VB源程序(仅供参考):Sub偏差计算()偏差= Sqr((x动点- x圆心) 2 + (z动点- z圆心) 2) - REnd SubSub插补() x动点= x起点: z动点= z起点:动点象限判别xx: Select Case象限标志 Case 1:单步连续判断 If顺逆标志= 顺 Then '第一象限插补 Do Until (x

逐点比较法第一象限逆圆插补VB源程序(仅供参考):

Sub 偏差计算()

    偏差 = Sqr((x动点 - x圆心)  2 + (z动点 - z圆心)  2) - R

End Sub

Sub 插补()

    x动点 = x起点: z动点 = z起点:

    动点象限判别

xx: Select Case 象限标志

        Case 1: 单步连续判断

            If 顺逆标志 = "顺" Then    '第一象限插补

                Do Until (x动点 - x终点) = 0 And (z动点 - z终点) = 0

                If 偏差 >= 0 Then

                   x动点 = x动点 - 1:

                   Line -Step(0, -x步长), vbRed

                Else

                   z动点 = z动点 + 1:

                   Line -Step(z步长, 0), vbRed

                End If

                   偏差计算

                   动点象限判别

                   If 象限标志 <> 1 Then

                      GoTo xx

                   End If

                   单步连续判断

                Loop

            ElseIf 顺逆标志 = "逆" Then

                Do Until (x动点 - x终点) = 0 And (z动点 - z终点) = 0

                If 偏差 >= 0 Then

                   z动点 = z动点 - 1:

                   Line -Step(-z步长, 0), vbRed

                Else

                   x动点 = x动点 + 1:

                   Line -Step(0, x步长), vbRed

                End If

                   DoEvents

                   偏差计算

                   动点象限判别

                   If 象限标志 <> 1 Then

                      GoTo xx

                   End If

                Loop

            End If

        Case 2: 单步连续判断

            If 顺逆标志 = "顺" Then    '第二象限插补

                Do Until (x动点 - x终点) = 0 And (z动点 - z终点) = 0

                If 偏差 >= 0 Then

                   z动点 = z动点 - 1:

                   Line -Step(-z步长, 0), vbRed

                Else

                   x动点 = x动点 - 1:

                   Line -Step(0, -x步长), vbRed

                End If

                   偏差计算

                   动点象限判别

                   If 象限标志 <> 2 Then

                      GoTo xx

                   End If

                Loop

            ElseIf 顺逆标志 = "逆" Then

                Do Until (x动点 - x终点) = 0 And (z动点 - z终点) = 0

                If 偏差 >= 0 Then

                   x动点 = x动点 + 1:

                   Line -Step(0, x步长), vbRed

                Else

                   z动点 = z动点 + 1:

                   Line -Step(z步长, 0), vbRed

                End If

                   偏差计算

                   动点象限判别

                   If 象限标志 <> 2 Then

                      GoTo xx

                   End If

                Loop

            End If

         Case 3: 单步连续判断

            If 顺逆标志 = "顺" Then    '第三象限插补

                Do Until (x动点 - x终点) = 0 And (z动点 - z终点) = 0

                If 偏差 >= 0 Then

                   x动点 = x动点 + 1:

                   Line -Step(0, x步长), vbRed

                Else

                   z动点 = z动点 - 1:

                   Line -Step(-z步长, 0), vbRed

                End If

                   DoEvents

                   偏差计算

                   动点象限判别

                   If 象限标志 <> 3 Then

                      GoTo xx

                   End If

                Loop

            ElseIf 顺逆标志 = "逆" Then

                Do Until (x动点 - x终点) = 0 And (z动点 - z终点) = 0

                If 偏差 >= 0 Then

                   z动点 = z动点 + 1:

                   Line -Step(z步长, 0), vbRed

                Else

                   x动点 = x动点 - 1:

                   Line -Step(0, -x步长), vbRed

                End If

                   偏差计算

                   动点象限判别

                   If 象限标志 <> 3 Then

                      GoTo xx

                   End If

                Loop

            End If

         Case 4: 单步连续判断

            If 顺逆标志 = "顺" Then    '第三象限插补

                Do Until (x动点 - x终点) = 0 And (z动点 - z终点) = 0

                If 偏差 >= 0 Then

                   z动点 = z动点 + 1:

                   Line -Step(z步长, 0), vbRed

                Else

                   x动点 = x动点 + 1:

                   Line -Step(0, x步长), vbRed

                End If

                   偏差计算

                   动点象限判别

                   If 象限标志 <> 4 Then

                      GoTo xx

                   End If

                Loop

            ElseIf 顺逆标志 = "逆" Then

                Do Until (x动点 - x终点) = 0 And (z动点 - z终点) = 0

                If 偏差 >= 0 Then

                   x动点 = x动点 - 1:

                   Line -Step(0, -x步长), vbRed

                Else

                   z动点 = z动点 - 1:

                   Line -Step(-z步长, 0), vbRed

                End If

                   偏差计算

                   动点象限判别

                   If 象限标志 <> 4 Then

                      GoTo xx

                   End If

                Loop

            End If

    End Select

End Sub


  • 信息来源:互联网
  • 版权声明:本站部分内容文章及图片来自互联网或自媒体,版权归属于原作者。如内容、图片有任何版权侵权问题,请联系我们处理,我们将在第一时间删除内容。
  • 免责声明:数控信息网发布此文目的在于促进信息交流,不存在盈利性目的,此文观点与本站立场无关,不承担任何责任。未经证实的信息仅供参考,据此操作风险自担。
  • 文本链接:https://skxx.site/news/show-4389.html
  • 小黑共发布427篇

  • 生成海报

    分享到微信

    分享到QQ

    更多分享

0相关评论
  • 小黑
这小子很懒什么也没留下。
  • 文章427
  • 浏览3224
  • 收藏0
  • 粉丝 0
    推荐图文