数控大作业

  • 格式:doc
  • 大小:195.50 KB
  • 文档页数:5

数控技术及其应用大作业
班级:机092
姓名: 张珈玮
学号:40940111
一、解答说明
待译码的数控加工程序对应的插补路线的起点和终点在工件坐标系中分别是(15,50)和(25,40)。

为了能够按照所学的原理实现此插补,须进行坐标系平移,将工件坐标系原
点平移到插补起点(15,50),得到一个新的坐标系(横坐标为x,纵坐标为y,正方向均不变)。

在此坐标系中,要进行插补的直线的起点和终点变为(0,0)和(-10,10),直线位于第二象限,因此偏差判别函数为F=yxe-|x|ye=-10y+10x,进给规则为:若F≧0,则沿-x
方向进给一步,F←F-|ye|=F-10;若F<0,则沿+y方向进给一步,F←F+|xe|=F+10。

总步数n=10+10=20。

二、环境交互界面的编辑(VB语句环境下运行)
VERSION 5.00
Begin VB.Form Form1
Caption = "数控技术大作业"
ClientHeight = 8145
ClientLeft = 120
ClientTop = 450
ClientWidth = 11145
LinkTopic = "Form1"
ScaleHeight = 8145
ScaleWidth = 11145
StartUpPosition = 3 '窗口缺省
Begin mandButton Command1
Caption = "开始绘制"
Height = 495
Left = 360
TabIndex = 1
Top = 1080
Width = 1095
End
Begin bel Label2
Caption = "机092 张珈玮2011.12.17 "
Height = 375
Left = 360
TabIndex = 2
Top = 720
Width = 3615
End
Begin bel Label1
AutoSize = -1 'True
Caption = "刀具动点插补轨迹曲线"
Height = 195
Left = 360
TabIndex = 0
Top = 360
Width = 1800
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
三.主体译码程序
Option Explicit
Private Sub Command1_Click()
'设定并绘制用户笛卡尔坐标系
Me.ScaleMode = vbCentimeters
Me.Scale (-15, 15)-(4, -4)
Me.DrawWidth = 1
Me.DrawStyle = 4
Me.Line (-13, 0)-(2, 0)
Me.Line (0, -2)-(0, 13)
'将当前绘图位置移动到原点,准备绘图
Me.Line (0, 0)-(0, 0)
'设置插补初始值
Dim n As Integer '插补总步数
Dim F As Integer '偏差判别函数值
n = 20
F = 0
Me.DrawWidth = 3
Me.DrawStyle = 0
Me.ForeColor = vbRed
'进入插补循环
Do
If F >= 0 Then
Me.Line -Step(-1, 0)
F = F - 10
Else
Me.Line -Step(0, 1)
F = F + 10
End If
n = n - 1
Loop Until n = 0
End Sub
四.插补轨迹曲线图。