什么都有了,就缺您了,元芳你怎么看???,,谢谢了
谢谢了,期望您的指导。附件中有1.机构运动视频2.机构视图分析3.机构简化图4.代码5.各部分运动计算6.自我分析谢谢了,怎么运动起来那?什么都有了。(视频)(简化图)(代码),谢谢了,期望得到您的指导了,谢谢。
程序代码:Option Explicit
Const PI = 3.14159
Dim xa(0 To 360) As Double
Dim ya(0 To 360) As Double
Dim xb(0 To 360) As Double
Dim yb(0 To 360) As Double
Dim xc(0 To 360) As Double
Dim yc(0 To 360) As Double
Dim afai1(0 To 360) As Double
Dim afai2(0 To 360) As Double
Dim afai3(0 To 360) As Double
Dim xd As Double
Dim yd As Double
Dim L1 As Double
Dim L2 As Double
Dim L3 As Double
Dim L4 As Double
Dim W As Integer
Dim a20 As Integer
Dim a2 As Integer
Public Sub readdate()
L1 = Val(Text1.Text)
L2 = Val(Text2.Text)
L3 = Val(Text3.Text)
L4 = Val(Text4.Text)
xd = Val(Text5.Text)
yd = Val(Text6.Text)
W = Val(Text7.Text)
a20 = Val(Text8.Text)
End Sub
Public Sub jigoujisuan()
Dim k1 As Integer
For k1 = 0 To 360
a2 = 2 * k1 * W + a20
xa(k1) = L1 * Cos(k1 * PI / 180)
ya(k1) = L1 * Sin(k1 * PI / 180)
xb(k1) = L1 * Cos(k1 * PI / 180) + L2 * Cos(a2)
xb(k1) = L1 * Sin(k1 * PI / 180) + L2 * Sin(a2)
Next k1
End Sub
Public Function arcsin(x) As Double
arcsin = Atn(x / Sqr(1 - x * x))
End Function
For k1 = 0 To 360
afai1(k1) = arcsin(e)
afai2(k1) = Atn(f)
afai3(k1) = afai1(k1) - afai2(k1)
Next k1
For k1 = 0 To 360
xc = xd + L4 * Cos(afai3(k1))
yc = yd + L4 * Sin(afai3(k1))
Next k1
Public Sub chushiweizhi()
Picture1.Scale (-72, 72)-(72, -72)
Picture1.Line (0, 0)-(xa(0), ya(0)), RGB(0, 0, 0)
Picture1.Line (xa(0), ya(0))-(xb(0), yb(0)), RGB(0, 0, 0)
Picture1.Line (xb(0), yb(0))-(xc(0), yc(0)), RGB(0, 0, 0)
Picture1.Line (xc(0), yc(0))-(xd, yd), RGB(0, 0, 0)
Picture1.Circle (0, 0), 1, RGB(0, 0, 0)
Picture1.Circle (xa(0), ya(0)), 2, RGB(0, 0, 0)
Picture1.Circle (xb(0), yb(0)), 5, RGB(0, 0, 0)
Picture1.Circle (xc(0), yc(0)), 5, RGB(0, 0, 0)
Picture1.Circle (xd, yd), 3, RGB(0, 0, 0)
Dim k4 As Integer
For k4 = 0 To 359
Picture1.Line (xb(k4), yb(k4))-(xb(k4 + 1), yb(k4 + 1)), RGB(0, 0, 0)
Next k4
End Sub
Private Sub Command1_Click()
Call readdate
Call jigoujisuan
Timer1.Enabled = False
Call chushiweizhi
End Sub
Private Sub Command2_Click()
Timer1.Enabled = True
Picture1.Cls
End Sub
Private Sub Timer1_Timer()
Picture1.Scale (-72, 72)-(72, -72)
Static k2 As Integer
Dim k3 As Integer
If k2 = 0 Then
k3 = 359
Else
k3 = k2 - 1
End If
If k2 = 360 Then k2 = 0
Picture1.Line (0, 0)-(xa(k3), ya(k3)), Picture1.BackColor
Picture1.Line (xa(k3), ya(k3))-(xb(k3), yb(k3)), Picture1.BackColor
Picture1.Line (xb(k3), yb(k3))-(xc(k3), yc(k3)), Picture1.BackColor
Picture1.Line (xc(k3), yc(k3))-(xd, yd), Picture1.BackColor
Picture1.Circle (0, 0), 1, Picture1.BackColor
Picture1.Circle (xa(k3), ya(k3)), 2, Picture1.BackColor
Picture1.Circle (xb(k3), yb(k3)), 5, Picture1.BackColor
Picture1.Circle (xc(k3), yc(k3)), 10, Picture1.BackColor
Picture1.Circle (xd, yd), 3, Picture1.BackColor
Picture1.Line (0, 0)-(xa(k2), ya(k2)), RGB(0, 0, 0)
Picture1.Line (xa(k2), ya(k2))-(xb(k2), yb(k2)), RGB(0, 0, 0)
Picture1.Line (xb(k2), yb(k2))-(xc(0), yc(k2)), RGB(0, 0, 0)
Picture1.Line (xc(k2), yc(k2))-(xd, yd), RGB(0, 0, 0)
Picture1.Circle (0, 0), 1, RGB(0, 0, 0)
Picture1.Circle (xa(k2), ya(k2)), 2, RGB(0, 0, 0)
Picture1.Circle (xb(k2), yb(k2)), 5, RGB(0, 0, 0)
Picture1.Circle (xc(k2), yc(k2)), 5, RGB(0, 0, 0)
Picture1.Circle (xd, yd), 3, RGB(0, 0, 0)
k2 = k2 + 1
End Sub

程序代码:Private Type PointApi
x As Double
y As Double
End Type
Dim activeP As PointApi, slaveP As PointApi '主动点和从动点坐标
Dim noteScale As Double '斜边节点比例
Dim Angle As Integer '角度
Private Sub Drawl(oS As PointApi, oE As PointApi)
Pic1.Line (oS.x, oS.y)-(oE.x, oE.y), vbBlack
Pic1.Circle (oS.x, oS.y), 30, vbBlue
Pic1.Circle (oE.x, oE.y), 30, vbBlue
End Sub
Private Sub Drawp(oA As PointApi, oS As PointApi, nS As Double, Ag As Integer)
'根据输入参数画机械图,oA主动点坐标,oS从动点坐标,nS从动臂动点分割比例
Const PI = 3.1415926
Dim l As Double, l1 As Double, l2 As Double, l3 As Double, i As Integer
Dim o1 As PointApi, o2 As PointApi, o3 As PointApi
Pic1.Cls
l1 = oS.x - oA.x
l = Sqr(2 * l1 ^ 2)
l2 = nS * l
l3 = l - l2
l1 = l1 * 0.5
o1.x = oA.x + l1 * Cos(Ag * PI / 180)
o1.y = oA.y - l1 * Sin(Ag * PI / 180)
o2.x = o1.x + l1 * Cos((360 - Ag + 180) * PI / 180)
o2.y = o1.y - l1 * Sin((360 - Ag + 180) * PI / 180)
For i = 0 To -270 Step -1
o3.x = oS.x + l2 * Cos(i * PI / 180)
o3.y = oS.y - l2 * Sin(i * PI / 180)
l = Sqr((o3.x - o2.x) ^ 2 + (o3.y - o2.y) ^ 2)
If Abs(l - l3) < 15 Then Exit For
Next
Drawl o1, oA
Drawl o1, o2
Drawl o2, o3
Drawl o3, oS
o3.x = o2.x
o3.y = o2.y + 450
Pic1.Line (o3.x - 150, o3.y)-(o3.x + 150, o3.y + 300), vbRed, BF
Drawl o3, o2
End Sub
Private Sub readCfg()
'参数读取
Dim l As Double
activeP.x = Val(Text1) * 15
activeP.y = Val(Text2) * 15
slaveP.x = activeP.x + Val(Text3) * 15
slaveP.y = activeP.y
noteScale = Val(Text4)
If noteScale > 0.5 Or noteScale < 0.15 Then noteScale = 0.3 '从动臂分割比例必须小于0.5大于0.15,否则转动会卡死
Text4 = noteScale
End Sub
Private Sub Command1_Click()
If Command1.Caption = "转动" Then
Timer1.Interval = 10
Timer1.Enabled = True
Command1.Caption = "暂停"
Else
Timer1.Interval = 0
Timer1.Enabled = False
Command1.Caption = "转动"
End If
End Sub
Private Sub Command2_Click()
readCfg
Drawp activeP, slaveP, noteScale, Angle
End Sub
Private Sub Form_Load()
Command2_Click
Angle = 270
Drawp activeP, slaveP, noteScale, Angle
End Sub
Private Sub Timer1_Timer()
Drawp activeP, slaveP, noteScale, Angle
Angle = Angle + 1
If Angle > 359 Then Angle = 0
End Sub