在CAD中,用vb编程来画图,下面是程序的一部分,画出一条直线,但是结果不对,请高手看下这段程序有没错误 10
SubCh2_AddLineVBA()'本例在模型空间中添加一条直线a=InputBox("请输入a")b=InputBox("请输入b")r=InputBox("请输入...
Sub Ch2_AddLineVBA()
' 本例在模型空间中添加一条直线
a = InputBox("请输入a")
b = InputBox("请输入b")
r = InputBox("请输入r")
α = InputBox("请输入α")
大b1 = InputBox("请输入大b1")
大b2 = InputBox("请输入大b2")
大b3 = InputBox("请输入大b3")
b2 = InputBox("请输入b2")
b3 = InputBox("请输入b3")
i = InputBox("请输入i")
D = r * Sin(α) - b * Cos(α)
H = r * Cos(α) + b * Sin(α)
t = (r * Cos(α) + b * Sin(α) - 500 - b2) / (r + b3)
MN = 大b3 * Sqr(1 - (t) * (t))
TN = 大b3 * t + 500 + 大b2
TM = Sqr(MN * MN + TN * TN)
L0 = (TN - 大b1) / i
q = 1 - (t) * (t)
L1 = r * (Sqr(q)) + b3 * (Sqr(q)) + D + a
Dim lineObj As AcadLine
Dim startPoint(0 To 2) As Double
Dim endPoint(0 To 2) As Double
' 为直线定义起点和终点(总)
startPoint(0) = 0
startPoint(1) = 10
startPoint(2) = 0
endPoint(0) = L1 + 2000
endPoint(1) = 10
endPoint(2) = 0
' 在模型空间中创建该直线
Set lineObj = ThisDrawing. _
ModelSpace.AddLine _
(startPoint, endPoint) 展开
' 本例在模型空间中添加一条直线
a = InputBox("请输入a")
b = InputBox("请输入b")
r = InputBox("请输入r")
α = InputBox("请输入α")
大b1 = InputBox("请输入大b1")
大b2 = InputBox("请输入大b2")
大b3 = InputBox("请输入大b3")
b2 = InputBox("请输入b2")
b3 = InputBox("请输入b3")
i = InputBox("请输入i")
D = r * Sin(α) - b * Cos(α)
H = r * Cos(α) + b * Sin(α)
t = (r * Cos(α) + b * Sin(α) - 500 - b2) / (r + b3)
MN = 大b3 * Sqr(1 - (t) * (t))
TN = 大b3 * t + 500 + 大b2
TM = Sqr(MN * MN + TN * TN)
L0 = (TN - 大b1) / i
q = 1 - (t) * (t)
L1 = r * (Sqr(q)) + b3 * (Sqr(q)) + D + a
Dim lineObj As AcadLine
Dim startPoint(0 To 2) As Double
Dim endPoint(0 To 2) As Double
' 为直线定义起点和终点(总)
startPoint(0) = 0
startPoint(1) = 10
startPoint(2) = 0
endPoint(0) = L1 + 2000
endPoint(1) = 10
endPoint(2) = 0
' 在模型空间中创建该直线
Set lineObj = ThisDrawing. _
ModelSpace.AddLine _
(startPoint, endPoint) 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询