明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1541|回复: 3

高手可以帮忙看看,找错误

[复制链接]
发表于 2003-4-17 09:23:00 | 显示全部楼层 |阅读模式
Option Explicit
Const pi = 3.14159
Dim point(0 To 2) As Double, point2(0 To 2) As Double
Dim textposition(0 To 2) As Double
Dim center(0 To 2) As Double, radius As Double
Dim offset As Double

Private Sub cmdexit_click()
   Unload Me
End Sub

Private Sub userform_initialize()
   point1(0) = 1#: point1(1) = 1#: point1(2) = 0#
   point2(0) = 5#: point2(1) = 1#: point2(2) = 0#
   offset = 0.25
   textposition(0) = 2#
   textposition(1) = 1# + offset
   textposition(2) = 0#
   center(0) = 0#: center(1) = 0#: center(2) = 0#
   radius = 2#
End Sub

Private Sub opt3pointangular_Click()
   Dim dimensionobject As AcadDim3PointAngular
   Dim circleobject As AcadCircle
   Dim firstendpoint(0 To 2) As Double
   Dim secondendpoint(0 To 2) As Double
   Set circleobject = ThisDrawing.ModelSpace.AddCircle(center, radius)
   circleobject.Update
   firstendpoint(0) = center(0) + radius
   firstendpoint(1) = center(1)
   firstendpoint(2) = center(2)
   secondendpoint(0) = center(0) + radius * Cos(45 * pi / 180)
   secondendpoint(1) = center(1) + radius * Sin(45 * pi / 180)
   secondendpoint(2) = center(2)
   Set dimensionobject = ThisDrawing.ModelSpace.AddDim3PointAngular _
                         (center, firstendpoint, secondendpoint, textposition)
   dimensionobject.AngleFormat = acDegrees
   dimensionobject.Update
   ZoomAll
End Sub

Private Sub optangular_Click()
   Dim dimensionobject As AcadDimAngular
   Dim circleobject As AcadCircle
   Dim firstendpoint(0 To 2) As Double
   Dim secondendpoint(0 To 2) As Double
   Set circleobject = thhisdrawing.ModelSpace.AddCircle(center, radius)
   circleobject.Update
   firstendpoint(0) = center(0) + radius
   firstendpoint(1) = center(1)
   firstendpoint(2) = center(2)
   secondendpoint(0) = center(0) + radius * Cos(45 * pi / 180)
   secondendpoint(1) = center(1) + radius * Sin(45 * pi / 180)
   secondendpoint(2) = center(2)
   Set dimensionobject = ThisDrawing.ModelSpace.AddDimAngular _
                         (center, firstendpoint, secondendpoint, textposition)
   dimensionobject.AngleFormat = acDegrees
   dimensionobject.Update
   ZoomAll
End Sub

Private Sub optdiametric_Click()
   Dim dimensionobject As AcadDimDiametric
   Dim lineobject As AcadLine
   Dim circleobject As AcadCircle
   Dim chordpoint(0 To 2) As Double, farchordpoint(0 To 2) As Double
   Set circleobject = ThisDrawing.ModelSpace.AddCircle(center, radius)
   circleobject.Update
   chordpoint(0) = center(0) + radius * Cos(45 * pi / 180)
   chordpoint(1) = center(1) + radius * Sin(45 * pi / 180)
   chordpoint(2) = center(2)
   farchordpoint(0) = center(0) + radius * Cos(225 * pi / 180)
   farchordpoint(1) = center(1) + radius * Sin(225 * pi / 180)
   farchordpoint(2) = center(2)
   Set lineobject = ThisDrawing.ModelSpace.AddLine(chordpoint, farchordpoint)
   lineobject.Update
   Set dimensionobject = ThisDrawing.ModelSpace.AddDimDiametric _
                         (chordpoint, farchordpoint, 1.5)
   dimensionobject.Update
   ZoomAll
End Sub

Private Sub optordinate_Click()
   Dim dimensionobject As AcadDimOrdinate
   Dim lineobject As AcadLine
   Dim definitionpoint(0 To 2) As Double
   Dim leaderendpoint(0 To 2) As Double
   Set lineobject = ThisDrawing.ModelSpace.AddLine(point1, point2)
   lineobject.Update
   definitionpoint(0) = (point1(0) + point2(0)) / 2#
   definitionpoint(1) = (point1(1) + point2(1)) / 2#
   definitionpoint(2) = (point1(2) + point2(2)) / 2#
   leaderendpoint(0) = definitionpoint(0)
   leaderendpoint(1) = definitionpoint(1) + 2#
   leaderendpoint(2) = definitionpoint(2)
   Set dimensionobject = ThisDrawing.ModelSpace.AddDimOrdinate _
                         (definitionpoint, leaderendpoint, True)
   dimensionobject.ExtensionLineOffset = offset
   dimensionobject.Update
   ZoomAll
End Sub

Private Sub optradial_Click()
   Dim dimensionobject As AcadDimRadial
   Dim circleobject As AcadCircle
   Dim lineobject As AcadLine
   Dim chordpoint(0 To 2) As Double
   Set circleobject = ThisDrawing.ModelSpace.AddCircle(center, radius)
   circleobject.Update
   chordpoint(0) = center(0) + radius
   chordpoint(1) = center(1)
   chordpoint(2) = center(2)
   Set lineobject = ThisDrawing.ModelSpace.AddLine(center, chordpoint)
   lineobject.Update
   Set dimensionobject = ThisDrawing.ModelSpace.AddDimRadial(center, chordpoint, 1.25)
   dimensionobject.Update
   ZoomAll
End Sub

Private Sub optrotated_Click()
   Dim dimensionobject As AcadDimRotated
   Dim lineobject As AcadLine
   Dim dimlinelocation(0 To 2) As Double
   dimlinelocation(0) = point1(0) - 1#
   dimlinelocation(1) = point1(1)
   dimlinelocation(2) = point1(2)
   Set lineobject = ThisDrawing.ModelSpace.AddLine(point1, point2)
   lineobject.Update
   Set dimensionobject = ThisDrawing.ModelSpace.AddDimRotated _
                         (point1, point2, dimlinelocation, (45 * pi / 180))
   dimensionobject.Update
   ZoomAll
End Sub



Private Sub optaligned_Click()
   Dim dimensionobject As AcadDimAligned
   Dim lineobject As AcadLine
   Set lineobject = ThisDrawing.ModelSpace.AddLine(point1, point2)
   lineobject.Update
   Set dimensionobject = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, textposition)
   dimensionobject.ExtensionLineOffset = offset
dimensionobject.ArrowheadSize = 0.5
dimensionobject.Color = acCyan
ThisDrawing.Preferences.LineWeightDisplay = True
dimensionobject.DimensionLineWeight = acLnWt030
   dimensionobject.Update
   ZoomAll
End Sub
发表于 2003-4-17 19:10:00 | 显示全部楼层

你连注释都不写,让我们怎么看??也不知你是哪抄的程序??

你连注释都不写,让我们怎么看??也不知你是哪抄的程序??
 楼主| 发表于 2003-4-17 21:32:00 | 显示全部楼层

呵呵

不好意思,我不知道!
哪个是一个标注的程序,基本感觉没什么问题,可是就是运行不了
老是子函数未定义哦
HELPPPPPPPPPPP
发表于 2003-4-17 21:44:00 | 显示全部楼层

这么多的按钮,不会每一个都出问题吧,你把出问题的那个说出来

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-28 18:59 , Processed in 0.178854 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表