📄 form01.frm
字号:
Dim nj As Double '内径-半径
Dim ndj As Double '内倒角
dwxz = zbjl
zxxsp = tzg / 2 + 20
zxxy = tzc - 2 * e - tkc / 4
wide = 40
dj = 2
ndj = 2
nj = 10
ybjl = zxxy
If Option5.Value Then
zbjl = 40
End If
If Option4.Value Then
zbjl = 50
End If
If Option3.Value Then
zbjl = 60
End If
If Option2.Value Then
zbjl = 70
End If
If Option1.Value Then
zbjl = 80
End If
''''''''''''''''''''''''左视图
Dim ab As AcadLine
Dim startpointab(0 To 2) As Double
Dim endpointab(0 To 2) As Double
startpointab(0) = zbjl#: startpointab(1) = zxxsp#: startpointab(2) = 0#
endpointab(0) = zbjl#: endpointab(1) = zxxsp - cra + 2#: endpointab(2) = 0#
Set ab = acadapp.ActiveDocument.ModelSpace.AddLine(startpointab, endpointab)
Dim bc As AcadLine
Dim startpointbc(0 To 2) As Double
Dim endpointbc(0 To 2) As Double
startpointbc(0) = zbjl#: startpointbc(1) = zxxsp - cra + dj#: startpointbc(2) = 0#
endpointbc(0) = zbjl + dj#: endpointbc(1) = zxxsp - cra#: endpointbc(2) = 0#
Set bc = acadapp.ActiveDocument.ModelSpace.AddLine(startpointbc, endpointbc)
Dim cd As AcadLine
Dim startpointcd(0 To 2) As Double
Dim endpointcd(0 To 2) As Double
startpointcd(0) = zbjl + dj#: startpointcd(1) = zxxsp - cra#: startpointcd(2) = 0#
endpointcd(0) = zbjl + dj + wide - 2 * dj#: endpointcd(1) = zxxsp - cra#: endpointcd(2) = 0#
Set cd = acadapp.ActiveDocument.ModelSpace.AddLine(startpointcd, endpointcd)
Dim de As AcadLine
Dim startpointde(0 To 2) As Double
Dim endpointde(0 To 2) As Double
startpointde(0) = zbjl + wide - dj#: startpointde(1) = zxxsp - cra#: startpointde(2) = 0#
endpointde(0) = zbjl + wide#: endpointde(1) = zxxsp - cra + dj#: endpointde(2) = 0#
Set de = acadapp.ActiveDocument.ModelSpace.AddLine(startpointde, endpointde)
Dim ef As AcadLine
Dim startpointef(0 To 2) As Double
Dim endpointef(0 To 2) As Double
startpointef(0) = zbjl + wide#: startpointef(1) = zxxsp - cra + dj#: startpointef(2) = 0#
endpointef(0) = zbjl + wide#: endpointef(1) = zxxsp + cra - dj#: endpointef(2) = 0#
Set ef = acadapp.ActiveDocument.ModelSpace.AddLine(startpointef, endpointef)
Dim fg As AcadLine
Dim startpointfg(0 To 2) As Double
Dim endpointfg(0 To 2) As Double
startpointfg(0) = zbjl + wide#: startpointfg(1) = zxxsp + cra - dj#: startpointfg(2) = 0#
endpointfg(0) = zbjl + wide - dj#: endpointfg(1) = zxxsp + cra#: endpointfg(2) = 0#
Set fg = acadapp.ActiveDocument.ModelSpace.AddLine(startpointfg, endpointfg)
Dim gh As AcadLine
Dim startpointgh(0 To 2) As Double
Dim endpointgh(0 To 2) As Double
startpointgh(0) = zbjl + wide - dj#: startpointgh(1) = zxxsp + cra#: startpointgh(2) = 0#
endpointgh(0) = zbjl + dj#: endpointgh(1) = zxxsp + cra#: endpointgh(2) = 0#
Set gh = acadapp.ActiveDocument.ModelSpace.AddLine(startpointgh, endpointgh)
Dim hi As AcadLine
Dim startpointhi(0 To 2) As Double
Dim endpointhi(0 To 2) As Double
startpointhi(0) = zbjl + dj#: startpointhi(1) = zxxsp + cra#: startpointhi(2) = 0#
endpointhi(0) = zbjl#: endpointhi(1) = zxxsp + cra - dj#: endpointhi(2) = 0#
Set hi = acadapp.ActiveDocument.ModelSpace.AddLine(startpointhi, endpointhi)
Dim ia As AcadLine
Dim startpointia(0 To 2) As Double
Dim endpointia(0 To 2) As Double
startpointia(0) = zbjl#: startpointia(1) = zxxsp + cra - dj#: startpointia(2) = 0#
endpointia(0) = zbjl#: endpointia(1) = zxxsp#: endpointia(2) = 0#
Set ia = acadapp.ActiveDocument.ModelSpace.AddLine(startpointia, endpointia)
Dim jk As AcadLine
Dim startpointjk(0 To 2) As Double
Dim endpointjk(0 To 2) As Double
startpointjk(0) = zbjl#: startpointjk(1) = zxxsp + crf#: startpointjk(2) = 0#
endpointjk(0) = zbjl + wide#: endpointjk(1) = zxxsp + crf#: endpointjk(2) = 0#
Set jk = acadapp.ActiveDocument.ModelSpace.AddLine(startpointjk, endpointjk)
Dim lm As AcadLine
Dim startpointlm(0 To 2) As Double
Dim endpointlm(0 To 2) As Double
startpointlm(0) = zbjl#: startpointlm(1) = zxxsp - crf#: startpointlm(2) = 0#
endpointlm(0) = zbjl + wide#: endpointlm(1) = zxxsp - crf#: endpointlm(2) = 0#
Set lm = acadapp.ActiveDocument.ModelSpace.AddLine(startpointlm, endpointlm)
Dim no As AcadLine
Dim startpointno(0 To 2) As Double
Dim endpointno(0 To 2) As Double
startpointno(0) = zbjl#: startpointno(1) = zxxsp + nj#: startpointno(2) = 0#
endpointno(0) = zbjl + wide#: endpointno(1) = zxxsp + nj#: endpointno(2) = 0#
Set no = acadapp.ActiveDocument.ModelSpace.AddLine(startpointno, endpointno)
Dim pq As AcadLine
Dim startpointpq(0 To 2) As Double
Dim endpointpq(0 To 2) As Double
startpointpq(0) = zbjl#: startpointpq(1) = zxxsp - nj#: startpointpq(2) = 0#
endpointpq(0) = zbjl + wide#: endpointpq(1) = zxxsp - nj#: endpointpq(2) = 0#
Set pq = acadapp.ActiveDocument.ModelSpace.AddLine(startpointpq, endpointpq)
''''''''''''''''''''''''右视图
Dim cdy As AcadCircle '齿顶圆
Dim centerpointcdy(0 To 2) As Double
centerpointcdy(0) = ybjl#: centerpointcdy(1) = zxxsp#: centerpointcdy(2) = 0#:
Set cdy = acadapp.ActiveDocument.ModelSpace.AddCircle(centerpointcdy, cra)
cdy.Lineweight = acLnWt030
Dim cgy As AcadCircle '齿根圆
Dim centerpointcgy(0 To 2) As Double
centerpointcgy(0) = ybjl#: centerpointcgy(1) = zxxsp#: centerpointcgy(2) = 0#:
Set cgy = acadapp.ActiveDocument.ModelSpace.AddCircle(centerpointcgy, crf)
cgy.Lineweight = acLnWt30
Dim nk As AcadCircle '内孔
Dim centerpointnk(0 To 2) As Double
centerpointnk(0) = ybjl#: centerpointnk(1) = zxxsp#: centerpointnk(2) = 0#:
Set nk = acadapp.ActiveDocument.ModelSpace.AddCircle(centerpointnk, nj)
nk.Lineweight = acLnWt030
'''''''''''标题栏(btl)书写
Dim styobj1 As AcadTextStyle '定义格式一。
Dim typeface As String
Dim bold As Boolean
Dim italic As Boolean
Dim charset As Long
Dim pitchandfamily As Long
Set styobj1 = acadapp.ActiveDocument.TextStyles.Add("样式一")
typeface = "宋体"
italic = False
bold = False
charset = 1
pitchandfamily = 1 '?
styobj1.SetFont typeface, bold, italic, charest, pitchandfimily
Dim styobj2 As AcadTextStyle '定义样式二。
Set styobj2 = acadapp.ActiveDocument.TextStyles.Add("样式二")
styobj2.fontFile = "c:\windows\fonts\simhei.ttf" '仿宋体'
Dim btl1 As AcadText
Dim textstring1 As String
Dim height1 As Double
Dim insertionpoint1(0 To 2) As Double
'定义文字的高度和书写位置
textstring1 = "大齿轮"
height1 = 8
insertionpoint1(0) = tkc - 130 + 3#: insertionpoint1(1) = 29: insertionpoint1(2) = 0#
acadapp.ActiveDocument.ActiveTextStyle = styobj2
Set btl1 = acadapp.ActiveDocument.ModelSpace.AddText(textstring1, insertionpoint1, height1)
Dim btl2 As AcadText
Dim textstring2 As String
Dim height2 As Double
Dim insertionpoint2(0 To 2) As Double
'定义文字的高度和书写位置
textstring2 = "比例"
height2 = 3.5
insertionpoint2(0) = tkc - 65 + 1#: insertionpoint2(1) = 33.5: insertionpoint2(2) = 0#
acadapp.ActiveDocument.ActiveTextStyle = styobj2
Set btl2 = acadapp.ActiveDocument.ModelSpace.AddText(textstring2, insertionpoint2, height2)
Dim btl3 As AcadText '''比例
Dim textstring3 As String
Dim height3 As Double
Dim insertionpoint3(0 To 2) As Double
'定义文字的高度和书写位置
If Option6.Value = True Then
textstring3 = "1:1"
End If
If Option7.Value = True Then
textstring3 = "1:2"
End If
If Option8.Value = True Then
textstring3 = "1:5"
End If
If Option9.Value = True Then
textstring3 = "1:10"
End If
If Option10.Value = True Then
textstring3 = "5:1"
End If
If Option11.Value = True Then
textstring3 = "2:1"
End If
height3 = 3.5
insertionpoint3(0) = tkc - 53 + 1#: insertionpoint3(1) = 33.5: insertionpoint3(2) = 0#
acadapp.ActiveDocument.ActiveTextStyle = styobj2
Set btl3 = acadapp.ActiveDocument.ModelSpace.AddText(textstring3, insertionpoint3, height3)
Dim btl4 As AcadText
Dim textstring4 As String
Dim height4 As Double
Dim insertionpoint4(0 To 2) As Double
'定义文字的高度和书写位置
textstring4 = "数量"
height4 = 3.5
insertionpoint4(0) = tkc - 65 + 1#: insertionpoint4(1) = 25.5: insertionpoint4(2) = 0#
acadapp.ActiveDocument.ActiveTextStyle = styobj2
Set btl4 = acadapp.ActiveDocument.ModelSpace.AddText(textstring4, insertionpoint4, height4)
Dim btl5 As AcadText
Dim textstring5 As String
Dim height5 As Double
Dim insertionpoint5(0 To 2) As Double
'定义文字的高度和书写位置
textstring5 = "1"
height5 = 3.5
insertionpoint5(0) = tkc - 53 + 1#: insertionpoint5(1) = 25.5: insertionpoint5(2) = 0#
acadapp.ActiveDocument.ActiveTextStyle = styobj2
Set btl5 = acadapp.ActiveDocument.ModelSpace.AddText(textstring5, insertionpoint5, height5)
Dim btl6 As AcadText
Dim textstring6 As String
Dim height6 As Double
Dim insertionpoint6(0 To 2) As Double
'定义文字的高度和书写位置
If Option5.Value Then
textstring6 = "A4"
End If
If Option4.Value Then
textstring6 = "A3"
End If
If Option3.Value Then
textstring6 = "A2"
End If
If Option2.Value Then
textstring6 = "A1"
End If
If Option1.Value Then
textstring6 = "A0"
End If
height6 = 8
insertionpoint6(0) = tkc - 35 + 3#: insertionpoint6(1) = 25.5: insertionpoint6(2) = 0#
acadapp.ActiveDocument.ActiveTextStyle = styobj2
Set btl6 = acadapp.ActiveDocument.ModelSpace.AddText(textstring6, insertionpoint6, height6)
'''制图
Dim btl7 As AcadText
Dim textstring7 As String
Dim height7 As Double
Dim insertionpoint7(0 To 2) As Double
'定义文字的高度和书写位置
textstring7 = "制图"
height7 = 3.5
insertionpoint7(0) = tkc - 130 + 1#: insertionpoint7(1) = 17.5: insertionpoint7(2) = 0#
acadapp.ActiveDocument.ActiveTextStyle = styobj2
Set btl7 = acadapp.ActiveDocument.ModelSpace.AddText(textstring7, insertionpoint7, height7)
Dim btl8 As AcadText
Dim textstring8 As String
Dim height8 As Double
Dim insertionpoint8(0 To 2) As Double
'定义文字的高度和书写位置
textstring8 = Text5.Text
height8 = 3.5
insertionpoint8(0) = tkc - 118 + 1#: insertionpoint8(1) = 17.5: insertionpoint8(2) = 0#
acadapp.ActiveDocument.ActiveTextStyle = styobj2
Set btl8 = acadapp.ActiveDocument.ModelSpace.AddText(textstring8, insertionpoint8, height8)
Dim btl9 As AcadText
Dim textstring9 As String
Dim height9 As Double
Dim insertionpoint9(0 To 2) As Double
'定义文字的高度和书写位置
textstring9 = Text9.Text
height9 = 3.5
insertionpoint9(0) = tkc - 90 + 1#: insertionpoint9(1) = 17.5: insertionpoint9(2) = 0#
acadapp.ActiveDocument.ActiveTextStyle = styobj2
Set btl9 = acadapp.ActiveDocument.ModelSpace.AddText(textstring9, insertionpoint9, height9)
Dim btl10 As AcadText
Dim textstring10 As String
Dim height10 As Double
Dim insertionpoint10(0 To 2) As Double
'定义文字的高度和书写位置
textstring10 = "重量"
height10 = 3.5
insertionpoint10(0) = tkc - 65 + 1#: insertionpoint10(1) = 17.5: insertionpoint10(2) = 0#
acadapp.ActiveDocument.ActiveTextStyle = styobj2
Set btl10 = acadapp.ActiveDocument.ModelSpace.AddText(textstring10, insertionpoint10, height10)
Dim btl11 As AcadText
Dim textstring11 As String
Dim height11 As Double
Dim insertionpoint11(0 To 2) As Double
'定义文字的高度和书写位置
textstring11 = "5.2KG"
height11 = 3.5
insertionpoint11(0) = tkc - 53 + 1#: insertionpoint11(1) = 17.5: insertionpoint11(2) = 0#
acadapp.ActiveDocument.ActiveTextStyle = styobj2
Set btl11 = acadapp.ActiveDocument.ModelSpace.AddText(textstring11, insertionpoint11, height11)
Dim btl12 As AcadText
Dim textstring12 As String
Dim height12 As Double
Dim insertionpoint12(0 To 2) As Double
'定义文字的高度和书写位置
textstring12 = "材料"
height12 = 3.5
insertionpoint12(0) = tkc - 35 + 1#: insertionpoint12(1) = 17.5: insertionpoint12(2) = 0#
acadapp.ActiveDocument.ActiveTextStyle = styobj2
Set btl12 = acadapp.ActiveDocument.ModelSpace.AddText(textstring12, insertionpoint12, height12)
Dim btl13 As AcadText
Dim textstring13 As String
Dim height13 As Double
Dim insertionpoint13(0 To 2) As Double
'定义文字的高度和书写位置
textstring13 = Text8.Text
height13 = 3.5
insertionpoint13(0) = tkc - 23 + 1#: insertionpoint13(1) = 17.5: insertionpoint13(2) = 0#
acadapp.ActiveDocument.ActiveTextStyle = styobj2
Set btl13 = acadapp.ActiveDocument.ModelSpace.AddText(textstring13, insertionpoint13, height13)
'''绘图
Dim btl14 As AcadText
Dim textstring14 As String
Dim height14 As Double
Dim insertionpoint14(0 To 2) As Double
'定义文字的高度和书写位置
textstring14 = "绘图"
height14 = 3.5
insertionpoint14(0) = tkc - 130 + 1#: insertionpoint14(1) = 9.5: insertionpoint14(2) = 0#
acadapp.ActiveDocument.ActiveTextStyle = styobj2
Set btl14 = acadapp.ActiveDocument.ModelSpace.AddText(textstring14, insertionpoint14, height14)
Dim btl15 As AcadText
Dim textstring15 As String
Dim height15 As Double
Dim insertionpoint15(0 To 2) As Double
'定义文字的高度和书写位置
textstring15 = Text6.Text
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -